Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>When the process does a blocking call, it waits for the operation to complete.</p> </blockquote> <p>I am not entirely sure you understood this correctly. Say your program issues an I/O command, for instance <code>read()</code>. Your process does not wait for the operation to complete: it does not hold the processor until the I/O operation is done. When <code>read()</code> is called, the control of the processor is yield to the OS, which will prompt I/O operations. Those operations are extremely slow in comparison to the CPU speed, and they are executed by dedicated hardware, which means that the CPU will be free to execute something else in the meantime until the hardware signals that it is done (by a hardware interruption, for instance).</p> <p>From the point of view of the program that run <code>read()</code>, all it knows is that <code>read()</code> has been called: the register that pointed to the current instruction has not changed, its virtual memory is the same as before. The process is "blocked". It does not mean that the CPU is not running.</p> <p>From the point of view of the OS, the program is in waiting mode until the hardware signals that it has carried out its task. In the meantime, the scheduler has waken up another process, restored its context (i.e. the value of the CPU registers have been set to what they were just before it felt asleep, etc.), and started executing its code.</p> <p>When the hardware is done, an interruption happens and the OS acknowledges it by marking the process as executable. Depending on the scheduler policy, it can restore the process context and start executing it right away, or wait until the current process has finished its time slice before switching context.</p> <p>To read more about the implementation of the linux scheduler: <a href="http://shop.oreilly.com/product/9780596005658.do" rel="nofollow noreferrer">Understanding the linux kernel is a very good book</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload