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

Re: Modern Memory Configurations - was :: Re: Java GOOD -- Fire BAD

>     I wonder if we have enough RAM today that we could dispense with
> virtual memory as a global system wide default and only enable it for
> applications that really need the extra space.
>     I hate hearing OS X constantly paging to disk despite my capacious
> RAM or having the disk wake up from sleep mode just so I can open some
> little 145K utility app. (I guess Steve Jobs infected me with the bug
> that computers should be silent!)

This wouldn't be the ll1 list if we weren't picky about terms.
Virtual memory and swap are related concepts but they are not the
same thing.  Virtual memory is what gives each application the
illusion that it is the only thing in memory and allows memory
protection and the like.  It has everything to do with mapping
virtual addresses (the ones an app sees) to physical addresses (that
the machine understands) and the translation process offers a
convenient way to swap pages in and out of memory as needed.

I turned off the swap on my Windows laptop with no ill effects for
some of the same reasons you cited.  For an interactive desktop
where I mostly use a web browser and ssh connections to Unix
machines, this makes sense (and I'm annoyed when the hard drive
wakes up to respond to a mouse movement).  In other environments, it
makes more sense to give all the RAM available to the OS to use as
disk buffer cache.  Disks and data keep getting bigger so for many
applications its best to leave those resource allocation decisions
to the OS.

>     Moreover, from a Security perspective, I'd really like to be able to
> annotate a variable with an "in RAM" declaration to insure that it never
> gets paged out to disk where someone could theoretically scrape it out
> of a VM swap file.

The OS support is already there.  You can request that pages of
memory remain pinned in RAM and never be swapped out to disk.  This
is used mainly for security reasons to prevent passwords and the
like from being swapped out.  It requires language support in
languages that are prone to moving your data around, however, so
it's actually easier to use in C (or through a linked in C
extension--probably the simplest way) than in a higher level
environment that doesn't offer specific support for it.

- Russ