Pergunta

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?

Foi útil?

Solução

You seem to be overloading the term 'blocking'.

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a cs.stackexchange
scroll top