CS FundamentalsModerateGATE CS · Amazon/Microsoft SDE MCQ

What does it mean that the read() system call on a terminal is 'blocking', and what state does the process enter while no input is available?

  1. A. read() returns −1 at once with EAGAIN and the process stays running
  2. B. It spins in a loop inside the kernel and stays in the running state
  3. C. It moves to the waiting state until input arrives, then becomes ready
  4. D. The process is swapped out to disk until the next key is pressed

Correct answer: C. It moves to the waiting state until input arrives, then becomes ready

A blocking call puts the process on the device's wait queue in the waiting state; the interrupt for new input moves it to the ready queue, not straight to running. Returning −1 with EAGAIN is non-blocking mode.

More Operating Systems questions

Exams that ask this topic