Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Perl thread confustion

by sundialsvc4 (Monsignor)
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.


Comment on Re: Perl thread confustion

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2014-08-28 23:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (275 votes), past polls