P is for Practical | |
PerlMonks |
Multialarm loopby Excalibor (Pilgrim) |
on Oct 10, 2005 at 14:38 UTC ( [id://498816]=perlquestion: print w/replies, xml ) | Need Help?? |
Excalibor has asked for the wisdom of the Perl Monks concerning the following question: Greetings, dear brothers in the Monastery To-day I seek you to illuminate on a complex matter I cannot find a satisfactory way to solve... I have a process creating objects on a database that must be garbage collected by another process. Those object live in process 1 core memory as avatars of the DB objects. but their demise must not mean the deletion from the DB (thus I cannot user DESTROY() nor END()). I have a second process that will do garbage collection of the DB objects. This GC is based on object status (a field in the DB object) and on time (since creation time, last access by other processeses, etc). I have three different collecting priorities, and thus I thought a kind of generational GC could be "nice": phase_1 objects have been marked by a process to be collected ASAP (really ASAP. they are occupying resources that must be liberated to the program resources pool manager so other processes can use them (IP addresses, and the like)); phase_2 object are marked for recollection "when the system can, no rush"; phase_3 objects are all that surpass a given timeout, independently of their status. Now, phase_1 time is circa 10 smaller than phase_2, which is about 100 times smaller than phase_3 times... phase 1 can be around 30 seconds, more or less... So, I loop over all objects, locate those belonging to each "generation" and proceed to recollection, then sleep... What I'd actually like is to have three timers, that lauch the appropriate kind of recolection, but SIGALRM won't do... Suggestions, please? Note: I tried to read through EventServer, but I don't understand it... I basically need 3 "concurrent" loops, that's "all"... Thanks, today's a hard day, I'm obscure... --
Back to
Seekers of Perl Wisdom
|
|