Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^7: Need help with Perl multi threading

by chromatic (Archbishop)
on Jan 27, 2012 at 20:09 UTC ( #950437=note: print w/ replies, xml ) Need Help??


in reply to Re^6: Need help with Perl multi threading
in thread Need help with Perl multi threading

BrowserUK and I said essentially the same thing. If you write your thread code as you did, you're not getting any advantage of threading. All of your threads will run serially.


Comment on Re^7: Need help with Perl multi threading
Re^8: Need help with Perl multi threading
by ashok.g (Beadle) on Jan 30, 2012 at 16:35 UTC
    I am able to run the scripts with Net:;OpenSSH module having the statements like threads->create()->join(). may be it is not a good idea but the script execution time drastically changed and my script is also working as I want.....
      I am able to run the scripts with Net:;OpenSSH module having the statements like threads->create()->join(). may be it is not a good idea but the script execution time drastically changed and my script is also working as I want.....

      You are not listening. This

      threads->create( \&someFunc, $arg1, $arg2 )->join()

      Is exactly the same as:

      someFunc( $arg1, $arg2 );

      Except it takes LONGER!

      Because it starts a whole new thread, and then waits for it to complete before looping around and doing the same again.

      In other words. You are getting no benefit from the threading. (Though you would if you used threading correctly!)

      If you are seeing a speed up, it is because you are now using a different SSH module which is better written and works properly. That's all.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      The start of some sanity?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (11)
As of 2014-09-19 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (145 votes), past polls