Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
So it looks like that 100MB of shared data is really shared! There seems to be an 11MB fixed overhead per thread, which is probably why it reported 214MB instead of 100MB.use threads; use threads::shared; my @a : shared; sub foo { sleep 5; print @a . " elements in \@a\n"; } for (1..10) { threads->new(\&foo); } my $s = " " x 1e6; for (1..100) { push @a, $s; } system "grep VmSize /proc/$$/status";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: threads::shared variables not really shared... or are they?
by renodino (Curate) on Mar 06, 2008 at 23:51 UTC | |
Re: threads::shared variables not really shared... or are they?
by Joost (Canon) on Mar 06, 2008 at 23:49 UTC | |
Re: threads::shared variables not really shared... or are they?
by zentara (Cardinal) on Mar 07, 2008 at 15:02 UTC | |
by renodino (Curate) on Mar 08, 2008 at 03:21 UTC | |
by zentara (Cardinal) on Mar 08, 2008 at 18:47 UTC |