[Gllug] Linux 2.4.10 is out with better VM

Bruce Richardson itsbruce at uklinux.net
Tue Oct 9 06:07:40 UTC 2001


On Mon, Oct 08, 2001 at 08:56:50PM +0100, Stig Brautaset wrote:
> *raises hand* 
> 
> Since there is a lot of talk these days about VM, I would like to know a
> bit more. In the meantime, I'll be content with knowing what it *is*:

Virtual Memory management/manager.  Virtual memory is what makes your
computer's physical memory space and your swap file appear like one big
chunk of physical memory.  The programs running on your machine don't
address physical memory directly: they use virtual addresses.  Sometimes
the chunk of memory represented by a virtual address is in physical
memory, sometimes it's been swapped out to free up space.  It's up to
the Virtual Memory manager to make sure that the block is in memory (or
loaded in) when you ask for it.

On a modern PC this is a job done partly by hardware (from the 386 on
up, Intel CPUs have memory management and protection features built into
them) and partly by OS routines called by the hardware.  So if a program
requests a block which is not in physical memory, the hardware generates
an error and the VM routines are called to deal with it.

It is possible to emulate virtual memory on less sophisticated hardware
- Windows 3.0 was designed to be able to run in Real mode, where the 386
memory management and protection features were unavailable.  So you
requested memory not with malloc but with an api call and were given a
handle to an allocated block of memory.  You locked the block (stopping
it from being swapped out) when you wanted to work with it, unlocked it
when you were finished.  All later versions only ran in protected mode,
where locking/unlocking is irrelevant - but I saw plenty of programming
books (and programs) written by people who didn't understand this.

Anyway, the VM manages virtual memory, moving blocks of data out of
physical memory to free up space when there is a shortage, loading it
back into physical memory when it is requested.  The Linux VM is quite
capable of doing that basic job, it's just that other VMs do it more
efficiently.  There are all kinds of ways to optimise the task, starting
with using smart algorithms do decide which memory blocks should be
swapped out to free space.  You want to choose a block that won't be
requested again for a while or you just end up thrashing the disk (which
is what happens when your machine is too low on resources to cope with
the load - everything wants memory space and the VM churns blocks in and
out of swap.)

Obviously the VM is a core component and changing it is a big job.  For
one thing a whole set of core functions are optimised to work with the
VM and have to be retuned to work with the new one.

-- 
Bruce

Bitterly it mathinketh me, that I spent mine wholle lyf in the lists
against the ignorant.  -- Roger Bacon, "Doctor Mirabilis"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 261 bytes
Desc: not available
URL: <http://mailman.lug.org.uk/pipermail/gllug/attachments/20011009/9e16397b/attachment.pgp>


More information about the GLLUG mailing list