Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Problem handling 2 simultaneous socket streams

by sundialsvc4 (Abbot)
on Sep 15, 2011 at 17:15 UTC ( #926190=note: print w/ replies, xml ) Need Help??


in reply to Re: Problem handling 2 simultaneous socket streams
in thread Problem handling 2 simultaneous socket streams

Good advice.   (Fav'd.)

A thread can indeed be assigned to do nothing more than sit there, parked on a blocking-read, and maybe posting the received lines to a common queue for processing if the processing that needs to be done happens to favor some serialized approach.   The threads basically will consume almost-no resources other than a process-table entry somewhere in the guts of the operating system, and they permit you to use the “simple calls” to entirely avoid logical complexity.   They are also in the perfect position to recognize when a connection dies, and to record statistics about the connection.


Comment on Re^2: Problem handling 2 simultaneous socket streams
Re^3: Problem handling 2 simultaneous socket streams
by BrowserUk (Pope) on Sep 15, 2011 at 17:31 UTC
    The threads basically will consume almost-no resources other than a process-table entry somewhere in the guts of the operating system

    Oh. Thank you for explaining that to me. Except you're wrong!

    Threads are not processes, so therefore do not have "process-table entries".

    On the other hand, threads have their own stacks; their own interpreter contexts; their own copies of the environment; their own copies of pre-existing global context; their own proxies for any shared data; their own ...

    In other words, you aren't just slightly off, but absolutely diametrically wrong on all counts.

    So why post? Why do you -- who evidently know little of the subject, and understand even less of the little you have some inkling of -- feel the need to demonstrate to me -- I think fair to say, one of the more knowledgeable monks with regard to threading -- just how useless your home-spun wisdom fairy stories on this subject, as with so many others, really are?

    Are you hoping to help me? Or help the OP? Or to ingratiate yourself with me in particular or the monks in general?

    What is the point of your posting this garbage?

    Oh look, someone front paged this thread. I wonder if that could have influenced your need to "say something"?


    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.
      What is the point of your posting this garbage?

      What is the point of your posting this garbage? (ask me the same - om mani padme hum....)

        Since when has a rational, logical refutation of bad information been "garbage"?

        Because if that is the case, you've just condemned the entire basis of the scientific process.


        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.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2014-12-21 08:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (104 votes), past polls