The Effect of Pipe Capacity on Unix Pipeline Performance
dongyuxuan.me
dongyuxuan.me
I wanted to see:
- What happens when piping an 8 TiB file through awk to be stored on another physical volume (proly want to use xfs).
- A graph of various block sizes, various file sizes, pipeline sizes and timing using a HPET. I don't know how you make an 2+-way pipe like it the diagrams except by process substitution, except that doesn't always work and you can't create cycles without creating FIFO (named pipes):
cmd0 <(cmd1 here) <(cmd2 here)
mkfifo -m600 ~joe/foo
cmd0 <(cmd1 here) <(cmd2 here) | cmd3 > ~joe/foo &
cmd4 <(cmd5 here) >(cmd6 here ~joe/foo)
<>(...) # outer can r/w
<(...) # outer can r
>(...) # outer can wHowever, arbitrary graphs are possible with the system calls available -- just create all the pipes in the spawning process with pipe(), and after fork(), but before exec() move the right ends into the file descriptors 0, 1, and 2 with dup2().
I don't think this is correct! Context switches are expensive -- a small pipe size will force both processes to make more system calls to move the same amount of data through the pipe.
In this light, the UNIX specification's requirement of 4 KB is definitely too small; even the Linux 2.6+ default of 64 KB feels like it might be on the small side.
Actually, come to think of it named pipes would be another good place to fuzz.