This is a really interesting post, and reminds me of doing assembler programming using Interrupt Service Routines in the 70's and 80's. To handle the highest possible rate of interrupts, the ISR code needed to be as brief as possible -- it would wake up, grab the data that's just arrived, and stuff it into a circular buffer, for example. The data might be a single character, several characters, or even an entire message.

Somewhere else, an idle loop would be watching the same circular buffer for activity, and as soon as something arrived, it would deal with it at normal priority.

These two activities live in different worlds -- one doing as little as possible, as quickly as possible, and the other doing the needful, as data arrived. Ideally, this would avoid the situation where interrupts happen faster than they could be processed, resulting in dropped events, and therefore lost data.

Applying this to your situation, I might have the parent handle the clunkier processing, and have the child handle the SNMP traps .. but if there are plenty of solutions already in CPAN, that would probably be a better way forward. Thanks again for the intriguing post.

Alex / talexb / Toronto

Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.


In reply to Re: worker threads - one does all the work by talexb
in thread worker threads - one does all the work by jvuman

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.