Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Threads or Forking?

by cmeyer (Pilgrim)
on Jul 29, 2005 at 00:10 UTC ( [id://479184]=note: print w/replies, xml ) Need Help??


in reply to Threads or Forking?

If you would like to share large amounts of read-only memory between the processes (read: threads or processes), then fork is your choice. Perl's ithreads implementation doesn't support truly shared memory, or COW (copy-on-write) shared memory.

On the other hand, if you want to share large amounts of read-write memory, or if you want to share objects between the processes, then there is no reasonable option that I am aware of. The best option that I've found for communicating complex data structures between processes is serializing the data and printing it over a socket or pipe. The best option for sharing objects may be SOAP, RPC::PlServer, or something similarly obnoxious (or beautiful, depending on your point of view).

I would love to learn that I am wrong about this.

-Colin.

WHITEPAGES.COM | INC

Replies are listed 'Best First'.
Re^2: Threads or Forking?
by mugwumpjism (Hermit) on Jul 29, 2005 at 00:40 UTC

    Of course databases are the "usual" way to share state between concurrent processes. All the hard problems are already solved that way...

    $h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/." ."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 13:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found