CS FundamentalsHardGATE CS · Amazon/Microsoft SDE MCQ

A process writes to a pipe whose read end has been closed by every process. What happens by default?

  1. A. The write blocks until some process opens the read end
  2. B. The data is discarded and write() returns the byte count
  3. C. The writer receives SIGPIPE, which terminates it by default
  4. D. write() returns 0 to signal end of file

Correct answer: C. The writer receives SIGPIPE, which terminates it by default

With no readers left, write() raises SIGPIPE; if the signal is ignored or caught, write() fails with EPIPE instead. End of file (read returning 0) is what a READER sees when all write ends are closed.

More Operating Systems questions

Exams that ask this topic