idall@augean.OZ (Ian Dall) (12/14/89)
How is automatic variable space handled for threads? I can think of two possibilities. One is to give each thread its own copy of the stack marked copy write and the other is to allocate some chunk of memory and set the stack to the top of it. The first means that starting a new thread is like a semi fork. The stack gets copied but the data region (and of course the text region don't). This approach has the effect that threads can never modify each others automatic variables, even through pointers. It has the advantage, however, that the virtual address space is kept simple. Otherwise the virtual address space gets fragmented and this could be a pain if one can't predict how much the various regions will grow. Of course with very large virtual address spaces this is less of a problem. Would someone like to briefly summarize the Mach thread primitives? -- Ian Dall life (n). A sexually transmitted disease which afflicts some people more severely than others. idall@augean.oz
Richard.Draves@CS.CMU.EDU (12/20/89)
Excerpts from netnews.comp.os.mach: 14-Dec-89 Stack space for threads Ian Dall@augean.OZ (1032) How is automatic variable space handled for threads? The Mach kernel doesn't have any policy for allocating stacks. The guy who initializes a thread should allocate a stack and set the thread's stack register appropriately. The C-Threads library gives a new thread a fixed-size region of zero-fill memory for its stack. It doesn't provide a fork primitive for threads. Rich