in reply to Share hash across processes

What is the best method to handle access to variables in shared memory directly?

Best? An open question, but certainly easy. 25 x 2MB strings shared between 10 +1 threads will run you ~80MB:

#! perl -slw use strict; use threads; use threads::shared; our $N ||= 100; our $M ||= 2e6; my %hash : shared; sub process { my $tid = threads->self->tid; for( 1 .. $N ) { for( keys %hash ) { lock( %hash ); printf "$tid: (%d) $_ => %s\n", length $hash{ $_ }, substr $hash{ $_ }, 0, 50; } } } $hash{ $_ } = chr( 64 + $_ ) x $M for 1 .. 25; my @threads = map{ threads->create( \&process ) } 1 .. 10; $_->join for @threads;

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."