Linked by Can Sar on Wed 30th Jun 2004 07:01 UTC
Features, Office Virtual memory is one of the most important subsystems of any modern operating system. Virtual memory is deeply intertwined with user processes, protection between processes and protection of the kernel from user processes, efficient shared memory, communication with IO (DMA, etc.), paging, swapping, and countless other systems. Understanding the VM subsystem greatly helps understanding how all other parts of the kernel work and interact. Because of this "Understanding the Linux Virtual Memory Manager" is a great guide in better understanding and working with the entire kernel.
E-mail Print r 0   · Read More · 10 Comment(s)
Order by: Score:
Nice review
by Adam on Wed 30th Jun 2004 07:52 UTC

... if not for too many commas.

Can, you're only a sophomore? I'm impressed :-)

Other VM's
by Anonymous on Wed 30th Jun 2004 08:25 UTC

As a note for people interresting in VM, the NetBSD paper
about UVM is great reading.
Design and Implementation of UVM:
http://www.ccrc.wustl.edu/pub/chuck/psgz/diss.ps.gz

Darn... :P
by Devon on Wed 30th Jun 2004 09:07 UTC

I was hopping for an "Understanding the Linux Virtual Memory Manager" article. Guess I should have read the title more closely eh? ;)

Still, excellent review.

Virtual Memory, Virtual Shemomry
by James G on Wed 30th Jun 2004 11:03 UTC

Let me see if I've got this Virtual Memory thing straight...

It used to be that the computer copied data from disk to memory, then worked on it, then copied it back to disk again.

Then the data got really big and wouldn't all fit in memory anymore. But the computer still wanted to think it was working in memory.

So now the computer copies data from disk via memory to somewhere else on disk (which it pretends is memory), then copys the bits it needs to works on from the somewhere else on disk to memory, then works on them, then copies those bits back from memory to the somewhere else on disk, then finally copies them back from the somewhere else on disk via memory to the place on disk they were originally.

Sounds like a game of musical bit-buckets.

Anyway, 640KiB ought to be enough for anyone.

--
James G.

re: Virtual Memory, Virtual Shemomry
by Anonymous on Wed 30th Jun 2004 11:17 UTC

Well, virtual memory allows you to do what you've said. But VM is much more. It's about presenting virtual memory to appliations. That means applications sees its own address space, and is not to buther with the code/data of other processes or the kernel. i.e. it offers protection. All this is usualy done by an mmu, which must be presented with registers and tables for mapping a memory address on to physical memory,
and that's the hard part, maintaining all these mappings/tables in an efficient way, for all diffent kinds
of usage.
Read the
http://www.ccrc.wustl.edu/pub/chuck/psgz/diss.ps.gz as mentioned above, it offers insight.
it offer

VMS
by PdC on Wed 30th Jun 2004 12:29 UTC

"of any modern operating system"

*cough*
appearantly the writer never heard of DEC's uh Digital uh Compaq uhm HP's Virtual Memory System operating system.
as if virtual memory is some kind of new idea.

the great thing about linux is that it is always in a testing/experimental phase ;)

RE: VMS
by Chris Parker on Wed 30th Jun 2004 14:48 UTC

VMS is a modern operating system. It has only been around since 1979.

@James G
by Rayiner Hashem on Wed 30th Jun 2004 15:33 UTC

So now the computer copies data from disk via memory to somewhere else on disk (which it pretends is memory), then copys the bits it needs to works on from the somewhere else on disk to memory, then works on them, then copies those bits back from memory to the somewhere else on disk, then finally copies them back from the somewhere else on disk via memory to the place on disk they were originally.

No, in modern VMs, that's not how it works. When you mmap() a file, nothing is loaded into memory. When you touch a page in that mapping, the appropriate data is brought in from disk and put into memory (into the unified VM cache). When memory runs tight, pages from the file that haven't been used in awhile are flushed back to the *same* file. So there is only one location in memory and one location on disk. These days, most VMs do this for *all* file I/O, not just for mmap()'ed regions. When you read 10 bytes from the middle of the file, the whole page is brought in and put into the buffer cache, just as if you'd mmap()'ed it. When you access that region again, the kernel just memcpy()'s the data into the buffer cache. As memory needs to be reused (or the file is closed) those pages are flushed back to the file.

DDR RAM
by Cheapskate on Wed 30th Jun 2004 17:26 UTC

since i inserted LOTS of RAM in this compoooooter 768 (3 256 sticks of DDR) now swap is allways on 0 and never used, it is still there just to keep my computer happy...

RE: VMS
by Can Sar on Sun 4th Jul 2004 15:36 UTC

I have heard of VMS, and read the original paper describing the VMS VM architecture. Most of the common practices in VM systems actually originated there (e.g. not mapping anything to the first page, and segfaulting when somebody dereferences a null-pointer). What I meant was that in any "modern" operating system, VM is sure to play an important role, sorry about the confusion.
Thanks for all the feedback on the article everyone!