Skip to main content

Timeline for How big is the pipe buffer?

Current License: CC BY-SA 4.0

15 events
when toggle format what by license comment
May 16, 2023 at 18:07 history edited Pablo A CC BY-SA 4.0
Improved formatting. Minor fixes.
Feb 3, 2022 at 19:54 comment added Max Heiber Great answer. I think there's a minor typo and that you probably meant 65536, not 65336 for the big pipe size for mac. In the header file it's defined as 64*1024, which is 65536. 65536 is also what your empirical tests showed.
May 1, 2015 at 6:46 comment added Chris Johnsen @CMCDragonkai: That is probably too much to address in a comment. Perhaps ask it as a new question? You might find some answers in the POSIX spec: FIFO definition, open(2), read(2), and write(2) (search for FIFO in these later ones).
May 1, 2015 at 3:38 comment added CMCDragonkai Is it possible for a process to write to the named pipe (that has no readers) a piece of data that is smaller than the pipe buffer size, and just exit straight away? How does the blocking semantics of a named pipe determine when when a write has finished and allow the reader to read? What if a process write 1 kb, waited 10 seconds, wrote another 1kb without ever exiting? Does the reader get 1kb, then 1kb, or does it block until getting 2kb?
S Mar 24, 2015 at 8:26 history suggested Jakob CC BY-SA 3.0
Add test-case data from Linux
Mar 24, 2015 at 8:07 review Suggested edits
S Mar 24, 2015 at 8:26
Mar 12, 2015 at 1:27 comment added Chris Johnsen @WakanTanka: The Perl program writes to its stdout (a shell-created pipe—the one that is being tested) in blocks of a given size and reports to its stderr a running total of how much it has written (until it gets an error—usually because the pipe’s buffer is full or possibly because the reading end of the pipe has been closed after a short time (exec 0<&-)). The final report is collected (tail -1) and printed along with the write size.
Mar 12, 2015 at 0:55 comment added Wakan Tanka @ChrisJohnsen thank you for explaining syntax, can you please simply describe the main idea?
Mar 12, 2015 at 0:51 comment added Chris Johnsen @WakanTanka: It is a bit much to describe in a comment, but that particular construct is a parameter assignment (var=…) of the output of a command substitution ($(…)) that includes grouped commands ({…}, and (…)). It also uses several (less common) redirections (i.e. 0<&- and 3>&1).
Mar 12, 2015 at 0:24 comment added Wakan Tanka Can you please explain the basic idea of your script? I am staring at it and I cannot figure out how it works? Especially what is the purpose using curly brackets here VAR=$({})? Thank you.
Aug 4, 2013 at 18:43 comment added Daniel H Thanks for mentioning fcntl() on Linux; I had spent a while looking for userspace buffering programs because I thought the built-in pipes didn't have a large enough buffer. Now I see that they do, if I have CAP_SYS_RESOURCE or root is willing to expand the maximum pipe size. As what I want will only be run on a specific Linux computer (mine), this shouldn't be a problem.
Apr 26, 2011 at 0:14 vote accept Kit Sunde
Apr 25, 2011 at 5:59 comment added Mikel Great answer. Especially for the link to POSIX write(2), which says: The effective size of a pipe or FIFO (the maximum amount that can be written in one operation without blocking) may vary dynamically, depending on the implementation, so it is not possible to specify a fixed value for it.
Apr 25, 2011 at 5:39 history edited Chris Johnsen CC BY-SA 3.0
added 83 characters in body; added 1 characters in body
Apr 25, 2011 at 5:32 history answered Chris Johnsen CC BY-SA 3.0