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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.