off topic: combined output of concurrent processes

Ed Greshko Ed.Greshko at greshko.com
Sat Apr 14 02:36:18 UTC 2012


On 04/14/2012 10:33 AM, Ed Greshko wrote:
> No....  Not only that, you are placing the echo commands in the background.  So, it
> is certainly possible that the script will finish before the echos are completed. 
> Not only that, there is no guarantee that all output from the echos will be written
> to "out".  You can see this if you put a sleep after the last echo.
>
> [egreshko at meimei test]$ grep ^A out | wc
>      97      97     582
> [egreshko at meimei test]$ grep ^B out | wc
>      94      94     564
> [egreshko at meimei test]$ grep ^C out | wc
>      96      96     576
>
> Your results will vary depending on the number of CPU's.  If you have a single CPU
> system, you may very well get all 300.

My "poor" English may be misleading/ambiguous ....  The output of the greps was
*without* the sleep in the script.

-- 
Never be afraid to laugh at yourself, after all, you could be missing out on the joke
of the century. -- Dame Edna Everage


More information about the users mailing list