1/14
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
What is the primary function of the Node.js Event Loop?
It enables non-blocking I/O operations by offloading tasks to the system kernel whenever possible
Which C library implements the Event Loop in Node.js?
Libuv
What are the six phases of the Event Loop execution order?
Timers
What specific callbacks are executed during the Timers phase?
Callbacks scheduled by setTimeout() and setInterval()
What occurs during the Poll phase?
The event loop retrieves new I/O events and executes I/O related callbacks
When are callbacks scheduled by setImmediate() executed?
During the Check phase
What is the difference between process.nextTick() and setImmediate()?
process.nextTick() runs immediately after the current operation and before the loop continues
What are Microtasks in Node.js?
High-priority tasks like Promise callbacks and process.nextTick() that drain completely between operation phases
What is the default size of the Libuv thread pool used for file system and DNS operations?
4 threads
Why is blocking the main thread dangerous in Node.js?
Because it stops the Event Loop from processing any further I/O or client requests until the blocking task finishes
What happens in the Close Callbacks phase?
Callbacks for close events are handled
If setImmediate() and setTimeout(fn
0) are called within an I/O callback
What is the purpose of the Pending Callbacks phase?
It executes I/O callbacks deferred to the next loop iteration
Does the Event Loop run on a separate thread from the JavaScript code?
No
How does Node.js handle concurrent operations if it is single-threaded?
It uses the Event Loop to manage asynchronous callbacks and the Libuv thread pool for expensive tasks like file I/O or crypto