Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Perl thread confustion

by sundialsvc4 (Abbot)
on Feb 15, 2013 at 13:21 UTC ( #1018890=note: print w/replies, xml ) Need Help??

in reply to Perl thread confustion

Data sharing is, as BrowserUK said, easy, and that’s most important in a good threaded design.   Your programs won’t bugger up their storage-pool and crash.   If you need to share data between threads, simply try to minimize the amount of code that actually contends for shared variables ... within sensible reason.   It’s often the case that threads communicate with one another by means of thread-safe queues ... work-to-do lists and work-completed lists.   This creates a simple way, not only to reduce contention, but to allow the various threads to work at their own naturally varying speeds.   If a particular set of shared variables is frequently and contentiously shared by everyone, they would represent a “hot spot” in any design regardless of language used ... they would tend to cause the threads to be synchronous with one another and to spend too much time waiting on locks, which is not what you want to see.   (Maybe the threads could instead include updated values in the messages they return to the work-completed queue.)   Obviously, design is a nest of competing trade-offs.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1018890]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2018-08-16 17:22 GMT
Find Nodes?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:

    Results (169 votes). Check out past polls.