[EMAIL PROTECTED] wrote:

> I've been looking at this small program which performs an "ls | wc",
> trying to work out how the blocking semantics works.
> 
> I understand that fork() has resulted in two identical processes being
> run simultaneously but I can't work out how the parent process is
> being forced to execute before the child.

The parent process isn't forced to execute before the child.

However, as wc continuously reads from stdin, if wc is started first,
it will block as soon as it tries to read from stdin. It will be
reawakened once ls has actually written something to the pipe.

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to