named pipe question

John Lenton jlenton at gmail.com
Thu Jul 15 07:52:11 EDT 2004


On Wed, 14 Jul 2004 17:57:42 -0700, Tobiah <toby.nospam at rcsreg.com> wrote:
> > Don't use a named pipe if an ordinary disk file would do.
> 
> This may be a tad off topic, but in some ways it seems to
> me that the converse is true.  Discussion?

Files are both simpler and more powerful than named pipe: they don't
block, they don't necessarily have race conditions (on posix
filesystems), they can be locked, seeked, mmaped, compressed,
encrypted, ...

So, if a file does what you want, use a file. A named pipe is good for
the one thing it is good at: connecting _one_ reader and _one_ writer
in strict unidrectional synchrony when they aren't directly related in
the process tree, and when either one (or both) can't be modified to
use sockets instead. That's a niche for you.

-- 
John Lenton (jlenton at gmail.com) -- Random fortune:
bash: fortune: command not found



More information about the Python-list mailing list