Model and this model is organised by what’s called Event Loop Event loop brought about the Non-Blocking Nature of Nodejs it’s doesn’t mean we can’t write blocking code in Nodejs but should should be avoided.
and callbacks so that they don’t block the main execution runtime (Call Stack) Nodejs revolves around this concept. show example code in nodejs terminal
the process of a computer CPU and anything external to that CPU in Node This is used to reference accessing disk or Network Resources which is the most time expensive part of most operation
handle external events and convert them into callback invocations Event Loop is the guy that summon event from the Event Queue and pushes thier callbacks to the Call Stack, with an order of operation which is referred to as the “phase” of the Event Loop
ming style possible in Nodejs - Event Loop start automatically when a script is excuted - Event Loop will exit when their are no more callback to perfom on - Event Loop is on the browser and it’s similar to how Event Loop work in Nodejs but not the samething - You can make the Event Loop busy with process.stdin.re- sume() Things to know.
allocations gets memory to be allocated here Call Stack this is a list of function in a stack data structure (FILO) (visualise the call stack in action with loupe, what happen’s when there is an infinity loop ?) Heap and Stack are part of the run-time engine not Node itself Node API this provides an interface to interact with the Operating System eg doing I/O expensive tasks.
to visualise the Browser Event Loop but thier some general principle both of them have. They both have single main execution thread They both have Event Queue Instead of Browser API we have Node API