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)?
- A. The writer blocks once the pipe is full and stays blocked
- B. write() returns 100 KB immediately and the extra data is discarded
- C. The kernel grows the pipe to 100 KB
- 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
- A process ignores SIGINT and then calls exec() to run a new program. Which statement is correct?
- Which signals can neither be caught nor ignored by a process?
- How many of these statements about microkernels are correct? 1. Device drivers and file systems typically run in user space as servers. 2…
- What is the purpose of the dual-mode (user/kernel) bit together with a timer interrupt?
- A system call such as getpid() costs about 100 ns, while a plain function call costs about 2 ns. Which is the main reason?
- In which order does the long-term, medium-term and short-term scheduler act on a process, and which one runs most frequently?