Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Perl forked processes and variable sharing

by perlfan (Vicar)
on Feb 04, 2022 at 06:40 UTC ( [id://11141132]=note: print w/replies, xml ) Need Help??


in reply to Perl forked processes and variable sharing

You're looking for a shared memory programming model, Perl doesn't support that. It's ruthlessly single process, save some nice child process management and an interface to fork. If you want true SMP, you're gonna have to deal with esoteric IPC, made a bit easier with modules like IPC::Shareable and related. You've also got file based comms, like what's described in Parallel::ForkManager. And if you want to get fancy, take a look at MCE - but even that just gives you a fancy file-based communication fabric. There are also interfaces to actual shared memory, shared C libraries. Another interesting idea is to use Redis, which is fundamentally a data structure middleware that provides atomic guarantees among competing processes - but it runs as a daemon and it'd have to be treated with a client/server type architecture in your program; which means you have to manage this "helper" process in the environment you're running your code. May also want to take a look at mkfifo.
  • Comment on Re: Perl forked processes and variable sharing

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-24 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found