[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Non-blocking fork (Was: Re: Virtual Memory)



The hole discussion about virtual memory seems to be dominated by two
questions: VM lets us run bigger processes (which is a definite plus)
and the question how can we get a non-blocking fork into MiNT. The
latter has actually nothing to do with virtual memory, so I just fork
off a new thread here.

A non-blocking fork has absolutely nothing to do with virtual memory,
we could implement it on a plain 68000 without (principal) problems.
Just look at what the Minix guys (I really mean Minix not the Minix
filesystem) have done for their 68000 port. The technique used is
called shadowing and is as old as Unix is (I've read somewhere that the
very first Unix versions did use shadowing instead of paging; however
I'm not sure about it :-).

The concept is just to copy the memory regions of the process which is
not actually running into some safe region (this might be memory as
well as disk), as MiNT already does when a new process is forked. On a
context switch the contents of both regions are simply exchanged, so
that now the active process occupies its real memory, again.  In real
life the situation would be a little bit more tricky; we have to
account for e.g. shared memory regions or for the existence of
threads. However I don't think that is impossible to implement such a
thing for MiNT. The key idea is just to add an additional region to
each memory region at the time of a fork and to swap the contents of
the regions on a context switch. (I've already done some work on this
at the end of last year, however currently I have no time to continue
this work :-(, so if anybody else would volunteer :-)

Regards
Wolfgang

----
Wolfgang Lux				#include <Standard Disclaimer>
WZH Heidelberg, IBM Germany             Internet: lux@heidelbg.ibm.com
+49-6221-59-4546                        VNET:     LUX at HEIDELBG
+49-6221-59-3200 (fax)	                EARN:     LUX at DHDIBMIP