Multiprocessing takes higher execution time
Nick Craig-Wood
nick at craig-wood.com
Wed Jan 7 11:31:15 EST 2009
Grant Edwards <invalid at invalid> wrote:
> On 2009-01-07, Steve Holden <steve at holdenweb.com> wrote:
>
> >> I use multiprocessing to compare more then one set of files.
> >>
> >> For comparison each set of files (i.e. Old file1 Vs New file1)
> >> I create a process,
> >>
> >> Process(target=compare, args=(oldFile, newFile)).start()
> >>
> >> It takes 61 seconds execution time.
> >>
> >> When I do the same comparison without implementing
> >> multiprocessing, it takes 52 seconds execution time.
>
> > My first suggestion would be: show us some code. We aren't
> > psychic, you know.
>
> I am!
>
> He's only got one processor, and he's just been bit by Amdahl's
> law when P<1 and S<1.
>
> There you have a perfectly "psychic" answer: an educated guess
> camoflaged in plausible-sounding but mostly-bullshit buzzwords.
> A better psychic would have avoided making that one falsifiable
> statement (he's only got one processor).
;-)
My guess would be that the job is IO bound rather than CPU bound, but
that is covered by Amdahl's Law too where P is approx 0, N
irrelevant...
Being IO bound explains why it takes longer with multiprocessing - it
causes more disk seeks to run an IO bound algorithm in parallel than
running it sequentially.
--
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick
More information about the Python-list
mailing list