> My generic question is: When I'm using a pipe line series of commands
> do I use up more/less space than doing things in sequence?

When you use a pipe you don't need the space to store intermediate
results between the two programs. Thepipe is backed by a small
system-allocated RAM buffer (4k under linux AFAIK) and program execution
is controlled according to the amount of data in the buffer.

Not having to save intermediate results generally means that you will
need less disk space: this is especially true in the mysqldump-gzip
example as the uncompressed dump will not be written to the disk at any
stage.

Note however (this is the "it depends" part :) that piping does not
affect whatever the programs might allocate or save internally: in your
second example (which does not involve any disk writing in either case)
"sort" needs to see the complete input before producing any output, so
it will allocate enough memory to store it whether it is invoked alone
or as part of a pipeline (in which case it will also stall the
downstream pipeline section until the upstream pipe is closed).

HTH,
andrea

Reply via email to