Is Unix stdio slow?

John Chambers jc at minya.UUCP
Tue Oct 11 03:13:06 AEST 1988


> I will go as far as to say that standard output to pipes should be
> line buffered, since we no longer put pipes in files.

And I will go as far as to say that, in my experience, this is one of
the biggest pains in the [expletive deleted] when you want to get your
software to work reliably.  I've long since lost count of how many times
I've wasted time trying to solve the problem that program A has written
to a pipe (or socket), program B has done a read on the pipe, and both
are sitting there getting no cpu time.  True, there are always ways to
get it to work right.  But the ways are different on every release of
Unix, and so far, when I ask how to do it right and portably, all I get
are insults from supposed experts (who I suspect are just trying to cover
up the fact that they don't know the answer, either).

Perhaps with POSIX, there will be a way for B to say "wake me up when there
is input on a file (pipe or disk or stream or socket or ...), and give me
whatever is there".  On the other hand, I can't quite tell from the manual
just how to do it *exactly* right, so maybe they won't help either, and I'll
have to add a new #ifdef for every vendor's POSIX-compliant system.

OK, maybe I'm just a stupid idiot, not to understand something so trivial.
But I suspect I'm not the only one.

BTW, on every Unix system I've ever used, a pipe is a file.  What could
the stuff after the comma in the above quote possibly mean?  Is there a
new implementation of pipes that doesn't use file descriptors?  I sure
hope not; that sure would be a giant step backwards.

-- 
John Chambers <{adelie,ima,maynard,mit-eddie}!minya!{jc,root}> (617/484-6393)

[Any errors in the above are due to failures in the logic of the keyboard,
not in the fingers that did the typing.]



More information about the Comp.unix.wizards mailing list