I have to limit number of threads as they are consuming considerable amounts of memory.

The memory footprint of threads can usually be dramatically reduced with very little effort.

IO handles can't be shared between threads, so once my thread worker connect to remote address I have to use this particular worker for all future communication,

Not so. IO handles can be reopened in multiple threads; though it is rarely useful to do so.

Almost always the desire to do so indicates a bad design.

which doesn't go well along with worker pattern. http://www.perlmonks.org/?node_id=967149

That argument makes no sense. The boss says, create a telnet connection to these machines and perform this/these tasks -- by queuing the relevant session information -- and the workers dequeue a set of instructions and perform them.

everything is shared

True. Everything is shared -- which means you have manage the problem of ensuring that different contexts do not trample all over each others private data.

/no need for variable locking

True. No need to lock since only one execution context can run at any given time.

Which means if you have a 16 core machine you're ignoring 93.75% of your potential cpu and wasting 10%+ of the one cpu you are utilising, perform crude context swapping in user level code; and another 5% fighting the system scheduler.

But if you really want to return to the mid-90s, Windows95-style of cooperative multitasking, with all of its inherent problems...


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

In reply to Re^3: Using Coro with Telnet by BrowserUk
in thread Using Coro with Telnet by mpapec

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.