CS FundamentalsHardGATE CS

A pipe has capacity 64 KB. A writer process writes 100 KB with a single write() call while no process ever reads from the pipe. What happens (blocking mode)?

  1. A. The writer blocks once the pipe is full and stays blocked
  2. B. write() returns 100 KB immediately and the extra data is discarded
  3. C. The kernel grows the pipe to 100 KB
  4. D. write() fails with an error immediately

Correct answer: A. The writer blocks once the pipe is full and stays blocked

In blocking mode write() puts as much as fits and then sleeps until a reader drains the pipe; with no reader activity it stays blocked. If every read end were closed instead, it would get SIGPIPE/EPIPE.

More Operating Systems questions

Exams that ask this topic