From owner-freebsd-arch Mon Nov 1 13:59:27 1999 Delivered-To: freebsd-arch@freebsd.org Received: from ns1.yes.no (ns1.yes.no [195.204.136.10]) by hub.freebsd.org (Postfix) with ESMTP id 1AF0214E2A for ; Mon, 1 Nov 1999 13:59:13 -0800 (PST) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [195.204.143.218]) by ns1.yes.no (8.9.3/8.9.3) with ESMTP id WAA08691 for ; Mon, 1 Nov 1999 22:59:09 +0100 (CET) Received: (from eivind@localhost) by bitbox.follo.net (8.8.8/8.8.6) id WAA75851 for freebsd-arch@freebsd.org; Mon, 1 Nov 1999 22:59:09 +0100 (MET) Received: from hda.hda.com (hda.bicnet.net [208.220.68.243]) by hub.freebsd.org (Postfix) with ESMTP id BE19E14EAD for ; Mon, 1 Nov 1999 13:58:52 -0800 (PST) (envelope-from dufault@hda.hda.com) Received: (from dufault@localhost) by hda.hda.com (8.8.5/8.8.5) id QAA19185; Mon, 1 Nov 1999 16:53:11 -0500 (EST) From: Peter Dufault Message-Id: <199911012153.QAA19185@hda.hda.com> Subject: Re: Threads goals version III In-Reply-To: <19991102084448.A66172@freebsd1.cimlogic.com.au> from John Birrell at "Nov 2, 99 08:44:49 am" To: jb@cimlogic.com.au (John Birrell) Date: Mon, 1 Nov 1999 16:53:10 -0500 (EST) Cc: dufault@hda.com, julian@whistle.com, freebsd-arch@freebsd.org X-Mailer: ELM [version 2.4ME+ PL25 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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