off topic: combined output of concurrent processes

Amadeus W.M. amadeus84 at verizon.net
Sat Apr 14 01:35:38 UTC 2012


This is not Fedora specific, so apologies for posting it here. I used to 
post this kind of questions in comp.linux.misc or the like but I don't 
have access to usenet groups anymore.

So here is the question. Suppose I have several processes that run 
concurrently and each outputs stuff to stdout. Can the combined output be 
intermingled? 


Example: script ioTest.sh:


#!/bin/bash

i=0
while [ $i -lt 100 ];
do
    echo "AAAAA" &    # e.g. 500 As
    echo "BBBBB" & 
    echo "CCCCC" & 

    i=$(($i+1))
done


Then 

./ioTest.sh > out

The A's and B's and C's always seem to be in contiguous blocks of 500 in 
the output file, but is that guaranteed? 

Thanks!



More information about the users mailing list