DEV Community

Cover image for Inside Node.Js I/O
Rwik Mukhopadhyay
Rwik Mukhopadhyay

Posted on

Inside Node.Js I/O

Node.Js introduces iteslf as a asynchronous event driven javascript runtime. To acheive this asynchronous nature , node uses a open source library called libuv.

libuv even though built for Node , it is not exclusive to Node.js. There are plenty of other projects which uses libuv.

While network i/o is asynchronous , same can't be said for disk i/o .
libuv uses single threaded operation to use event loop and produce asynchronus network i/o . Mostly lib pool apis are not thread safe as it is designed to work in single threaded mode only.

Disk i/o has some platform specific differences . Every majore APIs for disk I/O has it's own limitations, also this increases complexity. So libuv uses blocking disk operations using thread pool.

Discussion (0)