dual processor

Thomas Bellman bellman at lysator.liu.se
Tue Sep 6 15:35:49 EDT 2005


Michael Sparks <ms at cerenity.org> writes:

> Similarly, from
> a unix command line perspective, the following will automatically take
> advantage of all the CPU's I have available:

>    (find |while read i; do md5sum $i; done|cut -b-32) 2>/dev/null |sort

No, it won't.  At the most, it will use four CPU:s for user code.

Even so, the vast majority of CPU time in the above pipeline will
be spent in 'md5sum', but those calls will be run in series, not
in parallell.  The very small CPU bursts used by 'find' and 'cut'
are negligable in comparison, and would likely fit within the
slots when 'md5sum' is waiting for I/O even on a single-CPU
system.

And I'm fairly certain that 'sort' won't start spending CPU time
until it has collected all its input, so you won't gain much
there either.


-- 
Thomas Bellman,   Lysator Computer Club,   Linköping University,  Sweden
"We don't understand the software, and        ! bellman @ lysator.liu.se
 sometimes  we don't understand the hardware, ! 
 but we can *see* the blinking lights!"       ! Make Love -- Nicht Wahr!



More information about the Python-list mailing list