Re: help with huge memory consumption??
- From: Rainer Weikusat <rainer.weikusat@xxxxxxxxx>
- Date: Sun, 04 Mar 2007 14:12:32 +0100
Robert Redelmeier <redelm@xxxxxxxxxxxxxxx> writes:
Rainer Weikusat <rainer.weikusat@xxxxxxxxx> wrote in part:
The original article talked about stacks allocated for thread
within a process and I did, too. So, how can stack pages allocated
for threads withing a single process be shared with whom?
They can RO -- so long as no one writes to them.
The stack is the area of memory that is constantly written to, because
it contains storage for local variables of subroutines and is used to
temporarily save register values and subroutine return addresses.
[...]
AFAIK, a thread has the spawner's stack until one of them writes
to it, then the page gets copied (CoW). You can make private
stacks, but it's more work: they have to be specially allocated
and mapped with all the usual overflow worries.
Each newly created (NPTL) thread has an 8M area (by default) mapped as its
private stack with an adjacent 4K guard page. That's what the original
poster kind of complained about and by actually looking at a
multi-threaded Linux process, you could very easily have determined
that by yourself (eg by using pmap -d).
Your idea about 'copy on write' stacks is grotesque: The stack
contains the call chain of the thread that uses it for running, ie
activation records of currently active subroutines, and the newly
created thread does not share any of this state with its creator (and
could not meaningfully share it anyhow).
.
- Follow-Ups:
- Re: help with huge memory consumption??
- From: Robert Redelmeier
- Re: help with huge memory consumption??
- References:
- help with huge memory consumption??
- From: Dan Miller
- Re: help with huge memory consumption??
- From: Bin Chen
- Re: help with huge memory consumption??
- From: Dan Miller
- Re: help with huge memory consumption??
- From: Bin Chen
- Re: help with huge memory consumption??
- From: Robert Redelmeier
- Re: help with huge memory consumption??
- From: Bin Chen
- Re: help with huge memory consumption??
- From: Robert Redelmeier
- Re: help with huge memory consumption??
- From: Rainer Weikusat
- Re: help with huge memory consumption??
- From: Robert Redelmeier
- Re: help with huge memory consumption??
- From: Rainer Weikusat
- Re: help with huge memory consumption??
- From: Robert Redelmeier
- help with huge memory consumption??
- Prev by Date: Re: measured cpu time + sleep
- Next by Date: Re: help with huge memory consumption??
- Previous by thread: Re: help with huge memory consumption??
- Next by thread: Re: help with huge memory consumption??
- Index(es):
Relevant Pages
|