Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Linux Software

Linux 2.4 VM Documentation 115

popoutman writes "Mel Gorman has announced the availability of a guide to the 2.4 kernel VM including a walkthrough of the VM code. Anyone interested in obtaining a solid understanding of the Linux 2.4 VM will certainly want to take a look at this documentation. Mel says that the effort is at least several weeks from being finished, but that he's releasing it now with the hopes of getting feedback to be sure he's on the right track. He also notes that the 2.5 VM is still too much of a moving target for him to document it just yet." See also a Kerneltrap story.
This discussion has been archived. No new comments can be posted.

Linux 2.4 VM Documentation

Comments Filter:
  • by tomhartung ( 71654 ) on Wednesday January 15, 2003 @02:06PM (#5088843) Homepage
    Down a ways on the page we see the title of one of the documents: "Understanding the Linux Virtual Memory Manager."

    As a (an ex-)Java guy I immediately thought it stood for "Virtual Machine."
  • by iggymanz ( 596061 ) on Wednesday January 15, 2003 @02:07PM (#5088856)
    heh, it can stand for a few things in the realm of computers:
    1. virtual memory (using secondary storage to allow the program to address more memory locations than there is in physical RAM)
    2. virtual machine (a machine implemented in software on a real machine, which *could* have different opcodes, or the same ones as the real machine)
    3. VM - the operating system by IBM which allows one of their mainframes to act like many (stands for virtual machine)

    ( Also, there's the VM in VMS, the DEC Vax and Alpha operating system, which stands for VIrtual Memory as in #1)
  • by GGardner ( 97375 ) on Wednesday January 15, 2003 @03:02PM (#5089216)
    I've always wondered why, in today's world of gigabytes of memory in personal computers, why such a big deal is made about virtual memory..

    This is a good question -- there are several features the VM system allows for in addition to overcommitting physical memory. If your system has enough memory to run with no swap/paging space set up, the VM system still provides these features without ever paging or swapping out memory.

    The first is demand paging. That is, only those pages of an executable that are needed are brought into memory, and on-demand. Yes, this saves memory, but more importantly, it makes program startup much faster. Without demand paging, the whole program would need to be brought into memory at startup. Nowadays, when disks are much slower relative to CPUs, than they used to be, this makes a big difference, especially in the Unix shell-pipeline style of programming, where you run many different short-lived programs.

    Secondly, the VM system allows for shared memory segments between processes. This allows for shared memory, threads and shared libraries.

    Finally, the VM system implements caching of the file system, which we all know and love as a good use for all the memory we stuff into our machines now.

  • by Jack Greenbaum ( 7020 ) on Wednesday January 15, 2003 @03:24PM (#5089371) Homepage Journal
    Secondly, the VM system allows for shared memory segments between processes. This allows for shared memory, threads and shared libraries. Um. Don't you mean it enforces memory separation between processes?

    -- Jack

  • by FeatureBug ( 158235 ) on Wednesday January 15, 2003 @03:25PM (#5089387)
    Documenting the VM is a good idea. I hope it is accepted into the /Documentation directory in 2.4.x kernel tarballs but I'm not sure whether you'd get a reply from the maintainer, Marcelo Tosatti. I sent him a carefully written email in August 2002 documenting an invalid config in 2.4.19 which causes the build process to fail. [paraset.com] It was disappointing he never responded and apparently did not fix the bug which is still present in 2.4.20 and more recent patches.
  • by heh2k ( 84254 ) on Wednesday January 15, 2003 @03:50PM (#5089519) Homepage
    VM does NOT mean just paging/swapping. that is a small part of it. mac os and windows users constantly misuse the term. the vm does demand paging, copy-on-write, file/page cache, buffer cache, shared mem, mmapped files, and more. the most important of which is protection.
  • by cgh4be ( 182894 ) on Wednesday January 15, 2003 @04:14PM (#5089713)
    You're looking for NetBSD [netbsd.org]

    Platforms supported:
    acorn26 acorn32 algor alpha amiga amigappc arc arm32 atari bebox cats cesfic cobalt dreamcast evbarm evbmips evbppc evbsh3 evbsh5 hp300 hp700 hpcarm hpcmips hpcsh i386 luna68k mac68k macppc mipsco mmeye mvme68k mvmeppc netwinder news68k newsmips next68k ofppc pc532 playstation2 pmax pmppc prep sandpoint sbmips sgimips shark sparc sparc64 sun2 sun3 vax x68k x86_64
  • by tstoneman ( 589372 ) on Wednesday January 15, 2003 @06:58PM (#5090733)
    If you are asking this question, it really means you have not worked on systems that do not have virtual memory, like DOS.

    Virtual Memory means virtualizing a process's access to memory such that the memory addresses it accesses isn't necessarily the same physical memory address. It allows for complete memory separation between processes, which offers a vast amount of protection so that processes can't crash other processes.

    The only alternative to Virtual Memory is to use actual physical memory addresses. This was exactly the case with DOS. In DOS you would have to manage memory and make sure your process (it's single-threaded... remember?!?) didn't overwrite memory that it didn't own. Everything in memory could be accessed from every single process.

    With virtual memory, two processes could access memory location 0x1000000 and it would map to different physical memory addresses. In fact, the OS will give each process a full memory address range that is completely usuable by the process without any fear of stepping over someone else's memory. This effectively separates processes and prevents a hell of a lot of corruption because of memory bugs in programs.

    This really simplifies programming because whenever we get a memory address from malloc, we don't have to do anything about making sure we don't step over someone else's memory information.

    What you are in fact talking about is paging, the act of having a backing store of information on hard drive. This allows you to keep track of more memory than you physically have, by swapping memory back and forth from physical memory to a hard drive. Any unused memory would be paged to disk.

    Yes, today you can have gigabytes of memory, and when running Mozilla, boy you really don't need virtual memory.

    But what about 10 years from now, when Microsoft Office takes up 50 GB of hard drive space, and 16 GB of memory?

    Virtual memory is a way of abstracting memory use on a per process basis, and it's inclusion in most modern operating systems is one of the reasons why things are relatively stable these days, compared to the old DOS days, anyway.
  • by Pseudonym ( 62607 ) on Wednesday January 15, 2003 @08:02PM (#5091145)
    I've always wondered why, in today's world of gigabytes of memory in personal computers, why such a big deal is made about virtual memory.

    Because it's important. :-)

    Some people think that virtual memory means paging to secondary memory, such as disk. It doesn't. Virtual memory systems can support this, but many OSes (e.g. QNX) support virtual memory with no disk paging. (OK, QNX does support disk paging, but only as an afterthought, so that QNX can be self-compiled. GCC takes a lot of memory.)

    Virtual memory provides a virtual address space for each process. The benefits include:

    • The system can avoid memory fragmentation because contiguous virtual pages do not need to be contiguous in physical memory.
    • Processes don't step on each others' address spaces.
    • Separate instances of the same program can share program text space and shared libraries.
    • Different processes can use the same addresses for different purposes.
    • Processes can share memory between each other in a controlled manner (for example, one process may have read-only access to some region, or memory can be shared between a parent and child process via a read-only or copy-on-write mechanism).
    • Processes on different physical machines can share memory. (This can be done using the standard Unix interface. No extra kernel support is required.)
    • Processes can view files as memory (e.g. using mmap), reading in only as much of the file as is necessary.
    • Processes can allocate large regions of memory and only have the amount of those regions which they actually use backed up by physical memory (whether that is primary or secondary memory).
    • The OS has a lot more freedom in how to lay out a process in physical memory to optimise cache usage.

    This is just off the top of my head.

  • by sjames ( 1099 ) on Wednesday January 15, 2003 @11:09PM (#5091919) Homepage Journal

    Another benefit is sparse allocation. When memory is allocated, it's all mapped to a zero filled page and marked copy on write. That allows programs to allocate massive arrays that are expected to be primarily filled with zeros without actually requiring that much memory. When a value is writen, a new page is allocated and mapped into the virtual space.

    If desired, a file can be mmaped into the array instead to provide a simple persistant storage.

    IIRC, suspend to disk is (or at least can be) also accomplished through VM.

    The VM also allows an x86 system to have more than 4GB of ram. No single process can have more than a total of 4G (counting the kernel space) but using PAE, more than a total of 4GB can be allocated to multiple processes through the VM.

    Although Linux doesn't do this, some OSes completely replace the filesystem with a VM. All files and directories are objects and are demand paged.

Anyone can make an omelet with eggs. The trick is to make one with none.

Working...