[comp.os.minix] Use of extended memory

kjh@pollux.usc.edu (Kenneth J. Hendrickson) (07/10/90)

If you have a '286 or better, and you also have extended memory, and
Minix boots in "protected" mode, and you don't use all of the extended
memory for a ramdisk,

	can Minix run processes in this extended memory?

A previous posting to this newsgroup indicated that to use extended
memory, a ramdisk should be created which was exactly the same size as
the extended memory.  However, when booting Minix, with the above
conditions holding,  Minix reported much more than 640k of available
memory.

Ken Hendrickson N8DGN/6      kjh@usc.edu      ...!uunet!usc!pollux!kjh

paula@bcsaic.UUCP (Paul Allen) (07/11/90)

In article <25777@usc.edu> kjh@pollux.usc.edu (Kenneth J. Hendrickson) writes:
>If you have a '286 or better, and you also have extended memory, and
>Minix boots in "protected" mode, and you don't use all of the extended
>memory for a ramdisk,
>
>	can Minix run processes in this extended memory?

Yes.

Paul Allen

-- 
------------------------------------------------------------------------
Paul L. Allen                       | pallen@atc.boeing.com
Boeing Advanced Technology Center   | ...!uw-beaver!bcsaic!pallen

ching@brahms.amd.com (Mike Ching) (07/28/90)

Has anyone tested how extended memory is best used? Should it be used
to make a large RAM disk, increase cache buffer size, something else?
I assume that programs limited to 64K I&D can multi-task without
exhausting a whole lot of the 2M or more that resides in many of
today's PCs. I rarely run more than one thing in the background since
everything I want to do simultaneously seems to get disk bound.
Suggestions welcome.

Mike Ching

waltje@minixug.hobby.nl (Fred van Kempen) (07/31/90)

From article <1990Jul27.183356.996@amd.com>, by ching@brahms.amd.com (Mike Ching):
> Has anyone tested how extended memory is best used? Should it be used
> to make a large RAM disk, increase cache buffer size, something else?
> I assume that programs limited to 64K I&D can multi-task without
> exhausting a whole lot of the 2M or more that resides in many of
> today's PCs. I rarely run more than one thing in the background since
> everything I want to do simultaneously seems to get disk bound.
> Suggestions welcome.

1.  Extended memory (as found in 286-based systems, above 1M) can be
    used as both user memory (in Protected Mode) and as RAM-disk(s).

2.  Expanded memory (in PC's, the Lotus-Intel EMS spec) can be used
    only for RAM-disk(s).

I run an AT with 4 to 8 Mbyte of main RAM (depending on what it needs..)
and it also has an EMS-board with an additional 4Mb of RAM.  My other
machine, a 10MHz XT (V-20), has 640Kbyte main RAM, with an EMS-board
equipped with 4Mbyte RAM.

I added a driver to the kernel ("EMS"), which handles the EMS cards I
keep mentioning here.  It was once written by Terrence Holm, and it
has been hacked by Peter van Epp for the Zucker EMS board.

So, this little piece of code allow one to use those additional Mb's
for things like RAM-disks and the like.

The problem I faced was: how large a RAM disk do I need?

Since I run NLMUG MINIX, which does not use the RAM disk for the root
device, I always put /tmp on the RAM disk.  However, it would be silly
to make a /tmp of 4Mbyte...

So, I added some more code to the kernel, which created a separate
major device for all RAM-related disks:

9/0	/dev/ram	- all of the RAM disk in main memory
9/1	/dev/ram1	- RAM disk, partition 1
9/2	/dev/ram2	- RAM disk, partition 2
9/3	/dev/ram3	- RAM disk, partition 3
9/4	/dev/ram4	- RAM disk, partition 4
9/5	/dev/eram	- all of the RAM disk in extended (AT) memory
9/6	/dev/eram1	- AT_RAM disk, partition 1
9/7	/dev/eram2	- AT_RAM disk, partition 2
9/8	/dev/eram3	- AT_RAM disk, partition 3
9/9	/dev/eram4	- AT_RAM disk, partition 4
9/10	/dev/aram	- all of the RAM disk in expanded (EMS) memory
9/11	/dev/aram1	- EMS_RAM disk, partition 1
9/12	/dev/aram2	- EMS_RAM disk, partition 2
9/13	/dev/aram3	- EMS_RAM disk, partition 3
9/14	/dev/aram4	- EMS_RAM disk, partition 4

Since NLMUG MINIX allows all RAM disk total sizes to be set at boot time,
I could say:

	Main-memory RAM disk = 0K
	EMS-memory RAM disk = 4096K
	   partition 1	= 2048K	---->	/usr/bin (all binaries!)
	   partition 2	= 1024K ---->	/tmp
	   partition 3	= 1024K	---->	/usr/tmp

Even on an XT, this works really comfortable, since no precious main
memory is lost!

On an AT, one can also use the "emem" disks to address extended memory
while working in real mode, but since you would always want to work in
PM on a 286, this is really not of any use.  I will remove them from
the driver as soon as I have the time...

Now, for the interesting part of this message:

Last week someone called me with some quesions regarding MINIX.  While
talking the hours away, he mentioned that he wrote a swapper for MINIX,
which used a raw block-device as a swap device (a link to /dev/swap).

Well, swapping to /dev/fd0 doesn't look good, and even with my 28ms HD
it would be painfully slow.  However, it works (so he tells me..), and
it would certainly be a plus for machines with little physical memory.

Last night I suddenly thought of another possibility: why not swap to
one of the "RAM disk" deviced in EMS ?
Since we can already divide the total available chunk of memory into
several more usable pieces, it would be very possible to have the EMS
card to function as both RAM disk _and_ swapper device:

	Main-memory RAM disk = 0K
	EMS-memory RAM disk = 4096K
	   partition 1	= 1536K	---->	/usr/bin (all binaries!)
	   partition 2	=  512K ---->	/tmp
	   partition 3	=  512K	---->	/usr/tmp
	   partition 4  = 1536K	---->	/dev/swap

Swapping will always be slow, but I think that swapping to expanded or
extended memory will be fast enough to be usable.

Any comments anyone?

(no, don't ask me the name of the guy I talked to.  He will stand up
 and do his saying as soon as he is ready for it...)

Fred.

So, I can choose to put /tmp (

> 
> Mike Ching

brucee@runxtsa.runx.oz.au (Bruce Evans) (07/31/90)

In article <1990Jul27.183356.996@amd.com> ching@brahms.amd.com (Mike Ching) writes:
>Has anyone tested how extended memory is best used? Should it be used
>to make a large RAM disk, increase cache buffer size, something else?

It would be best to use a lot of it for the buffer cache, except that is not
implemented - the cache is limited to 64K on 286's. So you might as well
have a 1200K RAM disk out of a full 2M.

With `sticky' shared text, the RAM disk should be deleted and a small buffer
cache works better.

>today's PCs. I rarely run more than one thing in the background since
>everything I want to do simultaneously seems to get disk bound.

This problem is greatly reduced by good caching.
-- 
Bruce Evans
Internet: brucee@runxtsa.runx.oz.au    UUCP: uunet!runxtsa.runx.oz.au!brucee
(My other address (evans@ditsyda.oz.au) no longer works)