If Node JS also uses a I/O thread in libuv to perform IO, how is that thread different from a thread created by IIS when it receives request for simple I/O?
            Asked
            
        
        
            Active
            
        
            Viewed 254 times
        
    1 Answers
2
            - Node.js does not use separate thread(s) for I/O. It multiplexes the single thread between many tasks. 
- At high level, I/O is divided into 2: n/w IO and disc IO. While the former has buffering mechanism at kernel level, node.js manages the IO in a completely asynchronous model - meaning the data is processed when the kernel buffers are absolutely ready to reciprocate the operation in a fully non-blocking mode. Disc IO still involves blocking sequences, so ndoe.js employs libuv worker threads to simulate asynchronous IO. In either ways, there is no blocking code anywhere. 
- libuv threads are pre-created and fixed in number, so there is no runtime overhead of using them. 
Hope this helps.
 
    
    
        Gireesh Punathil
        
- 1,344
- 8
- 18
