Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Sleep has high cpu (sleep spins madly behind the scenes)

by UnderMine (Friar)
on Nov 09, 2002 at 12:25 UTC ( #211638=note: print w/ replies, xml ) Need Help??


in reply to Re: Sleep has high cpu (sleep spins madly behind the scenes)
in thread Sleep has high cpu

Some time ago I needed to have that kind of spinning (scanning large number of connections on a chat room for activity) but under low load, in the middle of the night, the same code killed the machine.

I found using Time::HiRes to put a micro sleep inversely proportional to the number of active connections stopped the process from spinning out of control and allowed the OS to pre-empt the loop.

Thanks

UnderMine


Comment on Re: Re: Sleep has high cpu (sleep spins madly behind the scenes)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2016-02-10 05:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?





    Results (332 votes), past polls