Plays from YouTube. Watch on YouTube
Why can a Unix pipe reader hang forever after its writer finishes?
Meet Pipes: Communication Between Processes: an original animated lesson in C and Unix systems programming.
We start with the two pipe descriptors and show how data moves through the kernel's ordered byte buffer.
Then we trace inheritance across fork, short reads, PIPE_BUF atomicity, blocking, EOF, SIGPIPE and deadlocks caused by forgotten closes.
The big idea: The behavior of a pipe depends on every open endpoint across every process.
C and Unix explained visually, one concept at a time.