Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Locking/unlocking program execution using a queue

by RazorbladeBidet (Friar)
on Mar 31, 2005 at 13:23 UTC ( [id://443798]=note: print w/replies, xml ) Need Help??


in reply to Re: Locking/unlocking program execution using a queue
in thread Locking/unlocking program execution using a queue

Thank you for pointing out that flaw, gam3 - I had figured the timestamp was more granular than that. I will try something like you have suggested instead.

However, I'm thinking of several other options:
  1. Not requiring a program to remove itself from the queue. This will force the other programs to check to see if the process is still running, yes, but a process could always die, so, IMHO, I think the check_queue would always have to have a kill 0.
  2. Having a program signal the next process to wake up by sending an alarm and then bumping the sleep length up to a larger number. The wasted time between one process execution and another is less important than the wasted CPU cycles from waking up and checking on processes.
Update: I just thought of this... what if instead of the single queue file, or creating a file named PID.lock and sorting by modification time, I were to use Time::HiRes' gettimeofday and name the file gettimeofday.PID.lock (with the values in there of course)

Then... sorting the files numerically, should work, no?
--------------
"But what of all those sweet words you spoke in private?"
"Oh that's just what we call pillow talk, baby, that's all."
  • Comment on Re^2: Locking/unlocking program execution using a queue

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-04-18 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found