1.

How does Node.js overcome the problem of blocking of I/O operations?

Answer»

Since the node has an event loop that can be used to handle all the I/O operations in an ASYNCHRONOUS manner without blocking the main function. 

So for example, if some network call needs to happen it will be SCHEDULED in the event loop INSTEAD of the main thread(single thread). And if there are multiple such I/O calls each one will be queued accordingly to be executed separately(other than the main thread). 

THUS even though we have single-threaded JS, I/O ops are handled in a nonblocking way.



Discussion

No Comment Found