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...

--
our $Perl6 is Fantastic;


In reply to Multialarm loop by Excalibor

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.