Re: [PATCH] move SWAP option in menu

Gabriel Paubert (paubert@iram.es)
Fri, 7 Mar 2003 11:03:31 +0100


On Thu, Mar 06, 2003 at 09:06:49PM +0000, Alan Cox wrote:
> On Thu, 2003-03-06 at 19:33, Gabriel Paubert wrote:
> > I'd be very surprised if it were possible to have swap on a MMU-less
> > machine (no virtual memory, page faults, etc.). Except for this nitpick,
> > the patch looks fine, but my knowledge of MM is close to zero (and
> > also of the new config language, but I'll have to learn it soon).
>
> You can, and people have had swapping long before virtual memory.

Indeed, I was unclear. A long time ago some OS I used distinguished between
swapping (getting rid of a whole process' address space) and paging. The
former one you can implement on any machine (with restrictions), the second
one needs an MMU and that's what CONFIG_SWAP means AFAICT.

> Most ucLinux platforms can't swap because they can't dynamically relocate code.

I believe that dynamically relocating code is fairly easy (PIC may help too),
but data is not: how do you relocate pointers of a swapped out process when
you swap it in at a different address?

I have fuzzy memories of a system in which you had a pair of
privileged registers (base and limit) which allowed you to implement
swapping and moving programs around in physical memories: all addresses
were checked against the limit and the base was added to perform
physical accesses. I might be wrong: it was about 20 years ago and I've
used so many different systems since then. But there is no such
mechanism on a 68000 for example (you could add it externally) and
it has its own problems (no easy way of sharing library code).

(Yes we're drifting way off-topic.)

> Linux 8086 can swap because it can use CS/DS updates to relocate code/data.

Unless I miss a subtle trick, that's using the segment registers as a
poor man's MMU. You can share library code with far calls but you can't
use "far" data pointers, can you?

> The way it worked on older systems is that you never run a program which
> isnt entirely in memory. With that constraint you know it won't suddenely
> want data you don't have.

Oh yes, I've used such systems a loooong time ago. But I can't remember
the details well enough.

Gabriel.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/