Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Perl threads: using yield() and Time::HiRes usleep() in Linux/*nix

by Anonymous Monk
on May 12, 2011 at 07:43 UTC ( #904308=note: print w/replies, xml ) Need Help??


in reply to Re: Perl threads: using yield() and Time::HiRes usleep() in Linux/*nix
in thread Perl threads: using yield() and Time::HiRes usleep() in Linux/*nix

sleep and yield both take the thread off the cpu. If priorities are involved (which they prolly are not in this) then the thread that yields could get put back on immediatly. the sleeping thread will wait until it is woken up at the end of its time. so both should accomplish the goal giving up the cpu, the sleep just wastes a lot processor time. If only one thread is running then you have to wait all that time with the cpu at 0%. yield should give everyone else a chance then come back ASAP. Well it depends on the schedluer of course, but linux is smart
  • Comment on Re^2: Perl threads: using yield() and Time::HiRes usleep() in Linux/*nix

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2020-01-28 06:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?