Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: How can I force thread switching?

by sundialsvc4 (Abbot)
on Sep 29, 2013 at 20:36 UTC ( #1056257=note: print w/ replies, xml ) Need Help??


in reply to How can I force thread switching?

What?   Did I hear my name used in vain, on such a pleasant Sunday morn?

He has a point:   use a thread to enqueue the jobs for the other threads.   This thread is the “nanny,” whose only purpose is to keep the children fed.   (Or in the good ol’ days, it is the Job Entry Subsystem of what was then called MVS now z/OS.)   It runs until it runs out of food, then quits.   If that thread winds up waiting-forever, so what.

The bottom line is that the parent does not have to be directly responsible for job-queueing.   The parent does not have to wait for it, and so, job-queueing will occur properly no matter what the user (interface ...) is or is not doing.   It is no longer “the parent’s concern.”   The parent’s only concern, now, is to run the user-interface until all of its children die (or until “the last man standing” is the scheduler).   Although the responsibilities of one particular child are somewhat greater than that of all the others, the parent has no need to “be concerned.”

It’s very hard, in any language, to have a (especially, to have a parent) thread with two concerns, and also to be both user-facing and peer-facing at the same time.


Comment on Re: How can I force thread switching?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2014-09-19 17:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (143 votes), past polls