Boost logo

Boost :

From: John Max Skaller (skaller_at_[hidden])
Date: 2001-08-07 11:56:18


Darryl Green wrote:

> > Question: does anyone share stack data between threads?
> >
> > Reason for asking:
> >
> > 1) Bemans model tries to ban this
> > 2) I objected
> >
> > but it occurs to me that on a multi-processor, the constraint
> > would allow CPU local memory to be used for the stack, which
> > could be a significant optimisation.

> I can't help thinking I must have misunderstood
> your point somehow?

        No, you didn't misunderstand.

> In what way did you envisage
> the sharing of stack data being useful - or were
> you just concerned that someone might have a use
> for it?

        It is obviously useful to share data between threads.
It is obvious that almost always, that data is going to be
connected to the stack: it may not be ON the stack, but
if it isn't, a pointer to it MUST be (directly or indirectly).
[I won't even consider static storage here]

        So, there's no good reason why the shared
data shouldn't be on _someones_ stack: perhaps the main
thread, but who knows?

        Yes, in many cases a ref counted object which
all threads point to seems best, but I can't exclude
a thread exposing part of its stacdk to a thread which
it outlives -- which it can ensure by 'join'ing that
thread: this is quite safe.

        So the question is whether anyone actually
does it. Would anyone be hurt if sharing auto data
were not permitted?

-- 
John (Max) Skaller, mailto:skaller_at_[hidden] 
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
New generation programming language Felix  http://felix.sourceforge.net
Literate Programming tool Interscript     
http://Interscript.sourceforge.net

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk