Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.misty.com!news.iecc.com!.POSTED!nerds-end From: George Neuner Newsgroups: comp.compilers Subject: Re: Question about inter-thread stack references Date: Sun, 18 Jan 2015 01:58:20 -0500 Organization: A noiseless patient Spider Lines: 23 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <15-01-027@comp.compilers> References: <15-01-015@comp.compilers> NNTP-Posting-Host: news.iecc.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit X-Trace: miucha.iecc.com 1421608056 17982 2001:470:1f07:1126:0:676f:7373:6970 (18 Jan 2015 19:07:36 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Sun, 18 Jan 2015 19:07:36 +0000 (UTC) Keywords: architecture, parallel Posted-Date: 18 Jan 2015 14:07:36 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1484 Hi Ivan, On Thu, 15 Jan 2015 23:54:57 -0800, Ivan Godard wrote: >If a process has two or more threads running in it, what are the rules >regarding one thread referencing memory in a different thread's stack? No rules per se, but it isn't even feasible unless the lifetimes of the references obey strict stack discipline wrt to the lifetime of the target. You can find that sort of structure with coroutines and with map-reduce style parent-child thread relationships - but not in general. However, I don't see any compelling reason to permit it. The stack is nothing more than a compiler managed mark-release heap: it's only real benefit to the programmer is no-brainer deallocation. Anything that might usefully be done using stack sharing can be done almost as easily - and much more safely - using an explicit mark-release heap or stacked heaps (regions, per Tofte and others). >Ivan George