Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Alternatives for "sleepy" while loop

by DACONTI (Scribe)
on Mar 18, 2008 at 03:13 UTC ( [id://674700]=note: print w/replies, xml ) Need Help??


in reply to Alternatives for "sleepy" while loop

Hi walto
if you want to minimize os ressource consumption
I think you are a bit on the wrong path
What are you doing here in fact is a job scheding work.
So if I would be in you I would just use system's provided ressources i.e. someting like 'at'
I browsed for you at CPAN and found out:
Schedule::At
which seems to be os independent. I never tried it, but I would start from this approach.
Perhaps it is precise enough for your purposes.
Of course then you would need to store/retrieve back any runtime info.
Because of this you would maybe pay a bit of performance on one side, on the other side you would however even free system's memory.
Best Regs,
Davide.
  • Comment on Re: Alternatives for "sleepy" while loop

Replies are listed 'Best First'.
Re^2: Alternatives for "sleepy" while loop
by walto (Pilgrim) on Mar 18, 2008 at 04:39 UTC
    Thanks for your answers.
    I already changed my script to moritz suggestion. This is a much better approach and allows a more exact control for timing.

    A script that can handle threads is the way it should go, but for this I must rewrite some other parts of the script regarding killing the running processes etc...

    I do not know where I read about the memory and cpu consumption of sleep. Actually I googled around and could not verify my statement. So probably this is not true (Although I remember one of my scripts using quite a lot cpu or mem while sleeping, but this can also have other reasons).Anyway the alternatives are great and improved my script very much.

    I searched CPAN before writing my script and could not find anything suitable. Schedule::At seems to do what I need. I will give it a second thought.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-25 11:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found