[comp.arch] "fork" with no MMU

guy%gorodish@Sun.COM (Guy Harris) (10/17/87)

> So tell me... how did they implement fork() without an MMU? Did they do
> addres fixups on running code, or did they require all code be relocatable
> (not an unreasonable request on the PDP-11, by the way, and one place where
> the 11 has the 68000 beat hollow).

Neither.  They only kept one process in memory at a time, using swapping to do
context switches.
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com

peter@sugar.UUCP (Peter da Silva) (10/22/87)

In article <31162@sun.uucp>, guy%gorodish@Sun.COM (Guy Harris) writes:
> > So tell me... how did they implement fork() without an MMU? Did they do
> > addres fixups on running code, or did they require all code be relocatable
> > (not an unreasonable request on the PDP-11, by the way, and one place where
> > the 11 has the 68000 beat hollow).
> 
> Neither.  They only kept one process in memory at a time, using swapping to do
> context switches.

That still doesn't disprove my claim that UNIX won't run on a system with
512K, two floppies, and no MMU. I don't consider swapping to floppies as
an acceptable method of context switching. Maybe totally hacked 8" drives
would do, but I'd want at least a hard disk.

(Yeh, I know MINIX does in-memory copies for the same purpose. That'd be
barely acceptable. It's not going to hum along as well as OS/9 or AmigaDOS,
though. And UNIX executables tend to be quite a bit larger than Minix' 10K.
Moving 10K of data for a context switch is bad enough. Imagine doing that
with csh(1).)
-- 
-- Peter da Silva  `-_-'  ...!hoptoad!academ!uhnix1!sugar!peter
-- Disclaimer: These U aren't mere opinions... these are *values*.

bruce@stride.UUCP (10/30/87)

The Idris operating system works reasonably well without an MMU,
including the "fork" system call.  It uses a combination of memory and
swap space, implemented as a "swap cache".  The parent process is
logically swapped out, but if it is small enough it is actually
swapped to the swap cache.  I don't remember if Idris does, but you
could probably avoid swapping the text segment with this method.

This scheme works fairly well, AS LONG AS the child does the usual
thing and execs another process quickly.  This other process is loaded
elsewhere in memory, allowing the parent to come back into memory.  It
totally fails for things like "tip" and "cu", as written.  The Idris
version of cu actually has the child process exec another program to
handle the incoming stream of characters.
-- 

	Bruce Robertson
	bruce@stride.Stride.COM
	cbosgd!utah-cs!utah-gr!stride!bruce