4 ms·
Wouldn’t the seq process keep writing to output until the output buffer of the pipe got full and then the next write would block and seq would just pause waitin
by brabel 5mo ago
Wouldn’t the seq process keep writing to output until the output buffer of the pipe got full and then the next write would block and seq would just pause waiting for the write call to unblock? Or my understanding of piping is incorrect?
- js2 5mo agoYour understanding is correct. `seq` blocks when the pipe is full and is killed with SIGPIPE after `less` quits, closing the pipe.
- syncsynchalt 5mo agoWhat you've said is correct. The slide says something like "run the command `seq 2 10000000 | less` and check `ps`, notice that `seq` isn't running". But that isn't how the processes will behave, `seq` will continue running (albeit blocked) until `less` is dead or closes the pipe.