How does Linux blocking I/O actually work?

Posted by tgguy on Stack Overflow See other posts from Stack Overflow or by tgguy
Published on 2010-05-05T22:25:20Z Indexed on 2010/05/05 22:38 UTC
Read the original article Hit count: 348

Filed under:
|

In Linux, when you make a blocking i/o call like read or accept, what actually happens?

My thoughts: the process get taken out of the run queue, put into a waiting or blocking state on some wait queue. Then when a tcp connection is made (for accept) or the hard drive is ready or something for a file read, a hardware interrupt is raised which lets those processes waiting to wake up and run (in the case of a file read, how does linux know what processes to awaken, as there could be lots of processes waiting on different files?). Or perhaps instead of hardware interrupts, the individual process itself polls to check availability. Not sure, help?

© Stack Overflow or respective owner

Related posts about blocking

Related posts about linux