Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!uwm.edu!rutgers!mcnc!rti!xyzzy!meissner From: meissner@dg-rtp.dg.com (Michael Meissner) Newsgroups: comp.unix.questions Subject: Re: Implementing `fork' in a single address space Message-ID: Date: 11 Dec 89 17:33:51 GMT References: <10131@june.cs.washington.edu> Sender: usenet@xyzzy.UUCP Organization: Data General (Languages @ Research Triangle Park, NC.) Lines: 34 In-reply-to: pardo@cs.washington.edu's message of 9 Dec 89 19:30:19 GMT In article <10131@june.cs.washington.edu> pardo@cs.washington.edu (David Keppel) writes: | I'd like to write a micro-unix to run in a single Un*x address space. | I'm having problems figuring out how to implement `fork' correctly in | one address space. Perhaps it's impossible. I'm willing to have | stack frames point at the other guy's data, but the only ways that I | can think of to get stacks to return right are: | | * To walk back the stack and patch up the retunr addresses -- scary! | | * Have all stacks live at one place in the address space. That | requries swapping stacks at every context switch. | | Perhaps a related question: | | * Are there any pd (public-domain, or freeware) micro-unicies that I | can look at? I remember that you used to be able to get a 3-ring | binder with the version 6 source, but I don't know if you had to | have a source liscence and all that. | | Thoughts? Thanks! Another way to do it is with a consenting compiler, and no hostile assembly language programs. Basically you teach the compiler to ignore one or two of the {address} registers, and then every reference to data and text is based off of these registers. To do a context switch, the kernel merely saves the registers, and loads up the new registers. To do a fork, the OS then allocates a new area somewhere, sets up the one or two registers as appropriate, and fires off the child. -- -- Michael Meissner, Data General. Until 12/15: meissner@dg-rtp.DG.COM After 12/15: meissner@osf.org