Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: unix loops in perl

by i5513 (Monk)
on Oct 26, 2011 at 15:40 UTC ( #933918=note: print w/ replies, xml ) Need Help??


in reply to Re^2: unix loops in perl
in thread unix loops in perl

Ok, I should say 'probabbly' less time is needed

If your proccess doesn't take many resources (cpu/network/memory), then probably it is true, isn't it?

So you have 30 process running at same time in an computer which is perfectly capable to do its work, the it will be faster than running 30 process one by one in a bucle.

If you have an algorithm wich consume all (or near to) cpu / memory / network, then it will not be fastest but slower

Do you agree now ?

Regards,


Comment on Re^3: unix loops in perl
Re^4: unix loops in perl
by SuicideJunkie (Priest) on Oct 26, 2011 at 17:38 UTC

    If each process takes up very little resources, then the overhead of creating them will cause it all to go slower.

    If the bottleneck is network or memory, then extra processes won't help.

    If the bottleneck is CPU, then the processes will let you use more cores, so that will help to a point. You probably don't have 30 cores, so a smaller number of them doing more work each would be better.

    If you've got a healthy mix of resources, then a second process could help, allowing one to crunch numbers while the other waits for the disk and then vice versa.

    Like so many things in life, one is good, a few more are convenient, but too much will kill you.

      I really save time with pdsh in many common task in a day to day administration.

      - When you need connect to various machines (300 machines?), launch a command in that machines and get result, you won if use pdsh.

      - If you need download with wget from many websites (again 300), you won using pdsh vs loop

      And citing you:

      "If each process takes up very little resources, then the overhead of creating them will cause it all to go slower."

      Each process will be created ever you use parallel system or use an loop to create it. So no will be overhead if you have enough resources.

      Of course, as I said before:

      If you don't have enough CPU / Memory / network bandwith, parallel computation will not work better than loop ... even worse than it ...

      Regards,

        You can certainly pull from multiple places, but once you've saturated your network, more connections won't help.

        If you do the work in a loop, you only use one process. If you create new processes and have each process do a portion of the work, then you create new processes. I don't see where that gets confusing.


        When I say 'each process takes up very little', I mean when it is easy for your process to just do the job itself. You've seen the classic extreme case of "lets fork off a thread to print one character" loops right?

        It is starting to sound like we are violently agreeing.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://933918]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2014-12-28 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (183 votes), past polls