Questions: Pipes and Named Pipes (FIFOs) for IPC

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

Two completely unrelated processes — a log producer and a log consumer started independently — need to stream data between them. Which statement is correct?

AAn unnamed pipe works; the kernel automatically connects processes that want to communicate
BA named pipe (FIFO) works; an unnamed pipe would not, because unnamed pipes require file descriptors shared through fork()
CNeither works; only sockets support communication between unrelated processes
DBoth work as long as both processes run as the same user
Question 2 Multiple Choice

A process writes 'hello' and then 'world' to a pipe in two separate write() calls. What can the reader reliably expect?

AExactly two reads: first 'hello', then 'world' — pipes preserve write boundaries
BAny byte split: 'helloworld' in one read, 'hel'+'loworld', or other arbitrary divisions — pipes are byte streams
COnly the second write survives — 'world' — because pipes work like a single-slot queue
DThe reader blocks indefinitely because pipes don't support back-to-back writes
Question 3 True / False

Data written to a named pipe (FIFO) travels through a kernel memory buffer and is never written to disk, even though the FIFO appears as a file in the filesystem.

TTrue
FFalse
Question 4 True / False

When a writer process finishes and closes its end of a pipe, the reader receives an error code indicating failure on its next read() call.

TTrue
FFalse
Question 5 Short Answer

Explain why an unnamed pipe cannot be used between two unrelated processes, and what mechanism named pipes use to solve this problem.

Think about your answer, then reveal below.