[comp.os.minix] Moving memory around.

tih@uunet.uu.net (01/29/89)

Before I start trying to implement the code:  I'd like to change the memory
manager a little, so that when a fork or exec asks for memory, and there isn't
a large enough hole available, MM will attempt to make such a hole by closing
up existing blocks.  This would be accomplished by moving blocks of allocated
memory, and updating the segment registers in process data structures.  Now,
will this cause problems elsewhere?  Might, for instance, other kernel programs
have segment information in local variables at the time, which would become
invalidated by such moves?

This would, of course, be a preliminary to implementing swapping -- if we can
move memory around like this, there's nothing to keep us from moving it onto
a swap partition on disk (RAM disk, if available) and moving it back into RAM
before scheduling the process to be run.

-tih

----------------------------------------------------------------------------
Tom Ivar Helbekkmo                                ..!mcvax!ndosl!melkart!tih
Fredrik Meltzers gt 11      Standard                 thelbekk@norunit.bitnet
N-5007 Bergen                   disclaimers            helbekkmo@nhh.uninett
NORWAY                        apply...
Phone: +47-5-960561                             MS-DOS & OS/2?  Just say NO!
----------------------------------------------------------------------------

Leisner.Henr@xerox.com (marty) (01/29/89)

Nothing stops a program from knowing segment information, although with the
current memory models there seems to be no reason.  On real mode Minix
system, you can even implement some sorta shared memory by knowing where
cooperating processes are located and writing into certain locations
(ughhhh!!).  

marty
ARPA:	leisner.henr@xerox.com
GV:  leisner.henr
NS:  martin leisner:wbst139:xerox
UUCP:  hplabs!arisia!leisner

muller@munnari.oz (Paul Muller) (01/30/89)

With the unfortunate existance of the 1 Meg codesize limit placed on the 8088
the discussion of swapping idle or sleeping proceudres to disk and freeing the
memory until the program is again required. I thought about this concept from
the moment I learned of Minix and the ability to patch the OS to suit the way
in which one wishes it to work.

My idea was to use the EMS type of solution. This would provide no conflicts
with existing PC memory layout as the EMS boards are mapped to provide 'plug-in
and-go' capability. The EMS can accessed in as little as 16K pages, nice size
for small,tight process' and large enough to make large code segments quick
to copy. EMS simulators have also been written for the PC which would mean
that one could run a multi-level cache, with main RAM being used for running
code, EMS RAM for process' that are likely to run very soon and the hard disk
(no one would use floppy in the right minds!) being for long term suspension.
The unfortunate part of this idea is that it would require a hetfy memory
management routine, going against the Minix ideals. Therefore I assume some
sort of subset of those ideas would have to be arrived at.

Other uses for the memory (EMS solid state RAM) would be the transfer of the
disk cache to EMS memory, freeing up more real (<640K) memory. Similarly, 
/tmp could be moved there for much the same reason.

DESQview, by Quaterdeck, does actually do swapping and implements a cache
under MS-DOS, maybe their technieque (spel?) could be used under Minix, by
that I mean the idea, not the actual binaries!

I think that the sort of approach I described would work with only one small
hitch getting in the road, it may be a non-existant problem that I have seen
from the wrong angle, but what would happen if instead of making a call through
the mem managment functions I called a page in memory direct, could the OS
be brought to its knees? Would it be possible to crash what I will call 
'Swapping Minix' by making writing to memory without the knowledge of Minix?
Is asld the problem here? Is there a problem at all?

Has anyone even begun work on this idea/line? I am seriously thinking about
learning more of thEMS hardware design, ripping apart mm and playing
some tricks with the code. Is there a need to go to this sort of extent?
Someone (Bruce?) is working on the '386 protected version, is it better to
wait for this and just buy an Inboard 386 card from Intel?
I cannot see how far this will go. I don't have the intimate knowledge of the
source for Minix that some do. I can see that it will be an interesting exer-
cise for the students who study Minix, will it clutter what is for now a very
tidy and tight OS?


Feedback apreciated,
Paul