Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is meant by "blocking system call"?

What is the meaning of "blocking system call"?

In my operating systems course, we are studying multithreaded programming. I'm unsure what is meant when I read in my textbook "it can allow another thread to run when a thread make a blocking system call"

like image 948
sam Avatar asked Oct 11 '13 02:10

sam


People also ask

What is the blocking system?

(blɒk ˈsɪstəm ) noun. the system whereby a railway is divided up into separate sections of track where only one train can travel at a time. Collins English Dictionary. Copyright © HarperCollins Publishers.

What is the difference between blocking and non-blocking calls?

Blocking refers to operations that block further execution until that operation finishes while non-blocking refers to code that doesn't block execution. Or as Node. js docs puts it, blocking is when the execution of additional JavaScript in the Node. js process must wait until a non-JavaScript operation completes.

What is mean by blocking and non-blocking systems?

In a blocking thread model, when the program carries out a blocking action such as IO, the OS level thread also blocks. In contrast, a non-blocking system does not block an OS thread when the thread needs to block on a blocking operation (e.g. I/O) rather it frees up the OS thread.

What is blocking call in C?

Blocking means that execution of your code (in that thread) will stop for the duration of the call. Essentially, the function call will not return until the blocking operation is complete. A blocking read will wait until there is data available (or a timeout, if any, expires), and then returns from the function call.


1 Answers

A blocking system call is one that must wait until the action can be completed. read() would be a good example - if no input is ready, it'll sit there and wait until some is (provided you haven't set it to non-blocking, of course, in which case it wouldn't be a blocking system call). Obviously, while one thread is waiting on a blocking system call, another thread can be off doing something else.

like image 51
Crowman Avatar answered Oct 08 '22 20:10

Crowman