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

Re: Using clone/dclone with threads

by exussum0 (Vicar)
on Nov 23, 2004 at 12:12 UTC ( [id://409875]=note: print w/replies, xml ) Need Help??


in reply to Using clone/dclone with threads

BrowserUK said everything, 'cept, you are trying to imitate fork. :) (though most if not all implementations of fork do a copy on write)

----
Then B.I. said, "Hov' remind yourself nobody built like you, you designed yourself"

Replies are listed 'Best First'.
Re^2: Using clone/dclone with threads
by BrowserUk (Patriarch) on Nov 23, 2004 at 13:45 UTC

    There is another difference.

    You can easily code your programs using threads in (almost) exactly the same way as you would using fork. Simply not sharing the data will cause it to be duplicated(without the COW obviously) and each thread will be able to use it's copy of the data saftly without performing any locking, or even giving it any consideration.

    The advantage comes when each of the 'processes' has reach a result. At that point, it becomes extremely easy for the 'parent process' (originating thread) to gather all the results from its children together and perform further processing -- eg. collating those results -- without requiring a tiresome and dangerous adventure holiday to the mysterious world of Eyepee Sea.


    Examine what is said, not who speaks.
    "But you should never overestimate the ingenuity of the sceptics to come up with a counter-argument." -Myles Allen
    "Think for yourself!" - Abigail        "Time is a poor substitute for thought"--theorbtwo         "Efficiency is intelligent laziness." -David Dunham
    "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (8)
As of 2024-04-18 21:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found