Re: help with huge memory consumption??
- From: Rainer Weikusat <rainer.weikusat@xxxxxxxxx>
- Date: Sun, 04 Mar 2007 18:14:21 +0100
Robert Redelmeier <redelm@xxxxxxxxxxxxxxx> writes:
Rainer Weikusat <rainer.weikusat@xxxxxxxxx> wrote in part:
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.
Agreed that the stack is often written, so goes CoW quickly.
It would probably be best for the kernel to copy the page
right away rather than wait for the inevitable exception.
There is no CoW sharing of anything for multiple threads existing
within a single process.
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).
Oh? I agree it doesn't need the activation records.
It is more than that: The control flow information, as stored on a
thread stack, pretty much defines the thread itself (where it came
from and where it will be going to). A new thread shares none of this
information with the thread that created it but is going to have its
own execution path through the binary --- that's what makes it a
thread.
By definition, threads run in the same address space and each thread
as access to the memory all other threads have access to, too
(assuming it has a pointer pointing into first).
.
- 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: 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
- 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: help with huge memory consumption??
- 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):