From mboxrd@z Thu Jan 1 00:00:00 1970 Message-Id: <6.1.1.1.0.20040604170542.02253db0@pop.free.fr> Date: Fri, 4 Jun 2004 17:20:08 +0200 To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu> From: Philippe Anel Subject: Re: [9fans] stack reclamation on Unix using clone, rfork_thread, etc. In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Topicbox-Message-UUID: 950972aa-eacd-11e9-9e20-41e7f4b1d025 At 04:39 PM 6/4/2004, you wrote: >Anyone have any idea how one is supposed to arrange >to free the stack on which a shared-memory proc is >running? > >In my current implementation, I have a routine called >stackalloc() that keeps a list of all stacks ever allocated >along with the pids they were allocated for, and every Nth >time it gets called, it scans the list freeing the stacks that >correspond to processes that no longer exist. > >Damn TLB-friendly operating systems. > >Russ Hello, I would associate each stack segment to an 'address space' structure shared by each shared-memory process. When the reference counter of this structure goes to zero, I would free all the segment 'associated' to this structure (and free the structure :) ). I thought plan9 doesn't share process stack segment, am i wrong ? If it doesn't share these segments you only have to free the stack when the process is ending. Philippe,