Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!ub!dsinc!bagate!cbmvax!jesup From: jesup@cbmvax.commodore.com (Randell Jesup) Newsgroups: comp.sys.amiga.tech Subject: Re: forks Message-ID: <15900@cbmvax.commodore.com> Date: 16 Nov 90 01:37:17 GMT References: <2478@trlluna.trl.oz> Reply-To: jesup@cbmvax.commodore.com (Randell Jesup) Organization: Commodore, West Chester, PA Lines: 35 In article <2478@trlluna.trl.oz> aduncan@rhea.trl.oz (Allan Duncan) writes: >From article <6874@sugar.hackercorp.com>, by peter@sugar.hackercorp.com (Peter da Silva): >... >> written so that it runs tasks in a protected mode when available so that >> forks would be cheap (otherwise you'd want to defer the forking task until >> the child exits or execs... with some reasonably long timeout: forks on >> a 68000 without MMU are ugly... look at how MINIX does it). > >I have seen discussion on forking and how hard it is on the Amiga, but >since I don't dwell on O/S theory (I just use the things) I do not >follow the nitty gritty of why it is hard. fork() ala Unix is hard, since it assumes an MMU, as well as assuming that all processes share the same set of logical addresses. Without an MMU, since the data and stack have absolute references, to implement fork(0 you must: a) clone the data and stack into two save areas, b) every time one of the two processes gets to run, you must copy it's saved data area into the original area, and the other's back to its save area (assuming the other was the last to run). This is quite expensive (especially if both processes remain around and active for a while without exec()ing. If one goes to sleep, or execs, then you stop paying most of the penalty from then on.) Even this won't work unless you have a single-tasked kernal (for example, if the I/O driver might wait for a seek, and you let another task run, the memory area to be read/written might now be occupied by the other process.) Therefore you can't use this method to fork() on the Amiga under AmigaDos, though AmigaMinix can (and does) use it. -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com BIX: rjesup Common phrase heard at Amiga Devcon '89: "It's in there!"