4 ms·
This article only shows basic usage of pipes (this is what they mean by "how pipes works"), but doesn't explain at all "how pipe works" (as in: how are they imp
by ur-whale 7y ago
This article only shows basic usage of pipes (this is what they mean by "how pipes works"), but doesn't explain at all "how pipe works" (as in: how are they implemented).
- chaps 7y agoSame, I was hoping for some mention of /proc/PID/fd*, but nothin'.
- emmelaich 7y ago/proc/ is not a fundamental to understanding Unix or Unix pipes and is not present on many Unixes.
- chaps 7y agoYou're right, but for what it's worth, the folks that I've taught the nuance of pipes seem to really only "get it" after pointing them to /proc/PID/fd* and having them cat in/out the files there. It directly leads into much deeper understandings of what "everything is a file" means.
- userbinator 7y agoIt's implemented as a buffer and some associated state. A process that writes to the buffer can do so until it is full, at which point the thread is suspended (blocked on the write() call) until it is not full. The read() side is similar --- reads return successive data in the buffer unless it is empty, at which point the read() call will block.
- emmelaich 7y agour-whale probably knows that