off topic: combined output of concurrent processes

Amadeus W.M. amadeus84 at verizon.net
Sat Apr 14 15:20:30 UTC 2012


> If you really would like to get output in sequence, write to a pipe, and
> have a reader process drain the pipe to a logfile.  It's pretty easy;
> look at "mknod" with the 'p' option, or "mkfifo".  I'd still suggest
> tagging each output line with an identifier and sequence number.
> 

For the sake of the argument, assume I echo 500 As, 500 Bs and 500 Cs. 

I don't care which process the output is coming from. It doesn't matter 
which order the As, Bs and Cs are output. All I care about is that I 
don't get 349As followed by 245Bs, etc. I want to see blocks of 500 each. 

I don't see how echoing into a pipe would change the problem. 
Theoretically, if several processes (e.g. echo) are running in the 
background, e.g. on a round robin basis, then potentially I could see 
random sequences of As, Bs and Cs. It doesn't seem to be the case in 
practice though. So which is it?

This has to do with the operating system internals, it's not a trivial 
question.



More information about the users mailing list