Date: Mon, 1 Nov 1999 16:53:10 -0500 (EST) From: Peter Dufault <dufault@hda.com> To: jb@cimlogic.com.au (John Birrell) Cc: dufault@hda.com, julian@whistle.com, freebsd-arch@freebsd.org Subject: Re: Threads goals version III Message-ID: <199911012153.QAA19185@hda.hda.com> In-Reply-To: <19991102084448.A66172@freebsd1.cimlogic.com.au> from John Birrell at "Nov 2, 99 08:44:49 am"
next in thread | previous in thread | raw e-mail | index | archive | help
> On Mon, Nov 01, 1999 at 07:33:52AM -0500, Peter Dufault wrote: > > > 4/ All threads in a processs see the same address space (exactly). > > > > Stacks too? Is that a rule implied from POSIX or one for portability? > > I think so. There is nothing to stop a thread from passing a pointer > to something on it's stack to another thread, assuming that it will > ensure that the stack will remain valid. This is common practice where > one thread parents one or more child threads and wishes to share > information with them. Obviously he can't return though. Here's what I would argue for in setting a standards document: main() { int mainvar; newthread(t1); /* t1 is a thread and it can access mainvar... */ sub(); } sub() { int subvar; newthread(t2); /* t2 can access subvar or mainvar, but maybe * t1 can't access subvar. * Maybe the stack just crossed a page boundary. */ while(1) keep_stack_context(); } Essentially threads would only be guaranteed access to stack variables both in existence and valid when the thread is created. All stack growth can be in separate address spaces. If a stackless main() creates a bunch of threads at that level and then idles those threads would have completely disjoint stacks. Peter -- Peter Dufault (dufault@hda.com) Realtime development, Machine control, HD Associates, Inc. Safety critical systems, Agency approval To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911012153.QAA19185>