# Are all system calls blocking?

I was reading an article that describes the switch between user-space and kernel-space that happens upon a system call. The article says

An application expects the completion of the system call before resuming user-mode execution.

Now, until now I was assuming that some system calls are blocking, whereas others are non-blocking. With the comment above, I am now confused. Does this mean that all system calls are blocking or did I misunderstand a concept?

• @Ankit Please explain why you rolled back the edit. Note that editing to improve a post's details is standard policy on SE and does not imply an implicit critique.
– Raphael
Mar 14 '12 at 8:52
• @Raphael Sorry bro! I was just fiddling around and pushed the rollback by mistake and then could not find the previous version. In fact, I really liked your edit. :P Mar 14 '12 at 13:42
• @Raphael Got it back. Actually I got duped by the revision system (did not recognize 'article' was a link). Thanks for the edits. Mar 14 '12 at 13:45
• @Ankit: Glad I could help!
– Raphael
Mar 14 '12 at 13:54

Any context switch you make to the kernel, you have to wait for it to switch back to the usermode before your application can continue. This is not what is usually called 'blocking'.

In the current kernel design, blocking calls are calls where the kernel returns only when the request is complete (or error happens). These calls usually take longer amounts of time and usually lead your process to be scheduled out. For instance, many IO calls are blocking.

There are system call which provides asynchronous IO and they are non-blocking. Note that there is still a context switch that happens here, only the application has to take care of the asynchronous nature of the call.

The paper seems to aim to do away with this context switch back and forth (exception-less system calls) and try to make all the calls asynchronous.

• Its actually a research paper. Here is the URL: eecg.toronto.edu/~livio/papers/flexsc-osdi10.pdf Mar 13 '12 at 17:12
• @Ankit: Please edit the question and include it there. Mar 13 '12 at 17:12