Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: When to use forks, when to use threads ...?

by zentara (Archbishop)
on Sep 04, 2008 at 18:13 UTC ( #709085=note: print w/ replies, xml ) Need Help??


in reply to Re: When to use forks, when to use threads ...?
in thread When to use forks, when to use threads ...?

Ah... I just posted a node about Perl releasing memory back to the system when using threads... see OS memory reclamation with threads on linux From my previous experimentation, it was almost certain that Perl would hold onto the memory, but that may have been because I was testing at a "sweet spot" where Perl's calculations of free memory-vs-it's use allowed it to retain the memory. But when it is very high mem usage, Perl will release it. It's a crap shoot, and may depend on Perl versions, thread versions, and even the kernel.

But the gist is, Perl will release large memory chunks if it's in a thread. And the c guru said that top and ps cannot always be trusted as an accurate measure of mem use. So I would ask, as your memory climbed, did the system slowdown, or did things keep running normally.


I'm not really a human, but I play one on earth Remember How Lucky You Are


Comment on Re^2: When to use forks, when to use threads ...?
Re^3: When to use forks, when to use threads ...?
by Krambambuli (Deacon) on Sep 05, 2008 at 08:16 UTC
    So I would ask, as your memory climbed, did the system slowdown, or did things keep running normally.

    I watched the RES column from ps's output, first via top, then also using a code snippet taken out from Process::MaxSize like
    [...] my $size; open PIPE, "/bin/ps wwaxo 'pid,rss' |"; while(<PIPE>) { next unless /^\s*$$\s/; s/^\s+//g; chomp; $size = (split(' ', $_))[1]; } close PIPE; return $size; }
    I didn't wait to let the system really slowdown, but stopped when it became obvious that swapping would have to start.


    Krambambuli
    ---

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2014-09-21 15:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (172 votes), past polls