Slashdot Mirror


Linux 2.4 VM Documentation

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.

9 of 115 comments (clear)

  1. Where I work by oliverthered · · Score: 5, Funny

    We design aned document things first, work out the bugs in the high level design and then code.

    Well maybe not all the time and with serveral itterations, but I only manage your credit raiting, not you kernel VM.

    --
    thank God the internet isn't a human right.
  2. every developer worth his salt knows... by syle · · Score: 5, Funny

    ...that virtual memory works because of small, magical faeries and gnomes.

    --

    /syle

  3. Re:This should be helpful by sporadek · · Score: 5, Funny
    As a tip for best results I suggeest using the Extreme Documentation method when writing your docs, it's saved time on the order of Olog(n) for me and a proven time saving technique.

    Define your function "Olog", please. Surely Mr. "Wagner LLC Consulting Co. - Getting it right the first time" couldn't have meant O(log n)... :)

  4. Re:Here's a tip for the author. by thodi · · Score: 5, Insightful

    People who don't know what it stands for would not want to read the document anyway, don't you think?

  5. Re:VM: Does it really matter? by GGardner · · Score: 5, Informative
    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.

  6. Re:VM: Does it really matter? by GGardner · · Score: 5, Interesting
    Um. Don't you mean it enforces memory separation between processes?

    Good point -- this is such a given on Unix systems that I didn't word it very well. What I should have said is that it enforces memory separation and protection between most memory segments and most processes, and allows for sharing of segments when explicitly setup. This is perhaps the most important thing the VM system does.

  7. Re:JVM by axxackall · · Score: 5, Funny

    yeah, right. let's also integrate to the kernel Perl, Python, Tcl, Lua, Emacs (for Elisp), Guile, Hugs, OCAML, Bash, Apache (for PHP) and Gecko (I want my Mozilla to work faster too!). I wonder, why is X server still not there? And don't forget about at least two CORBA brokers: Gnorba (everyone would love faster Gnome) and OmniOrb (just for a case). Hey, let's put everything into the kernel! Ooops... It's not kernel anymore and it doesn't want to run either. What was the mistake?

    --

    Less is more !
  8. Re:JVM by PetiePooo · · Score: 5, Funny

    I suspect it would be a waste of your time. Lets look at a bit of history.

    There used to be a kernel-space HTTP server. It was integrated into the kernel for a specific reason: zero-copy access to the network interface memory. It was fast and relatively feature-poor. If it crashed (fortunately, a rare occurance), you got a kernel panic.
    Along came a user-space, zero-copy HTTP server. It was faster and had a few more features to boot. Being a user-space program, if it crashed, you got a core-dump. It could also be run in a chroot jail, a gigantic step more secure than running in ring-0.

    Two lessons can be read from this:
    1. Don't integrate something with the kernel unless there is a specific advantage you hope to gain from it. Will making a JVM part of the kernel really speed it up? Are you sure?
    2. Don't under-estimate the speed of a properly designed user-space Linux program. The kernel developers have done a magnificant job tuning the kernel and providing APIs for performance-critical apps.

  9. Re:VM: Does it really matter? by Pseudonym · · Score: 5, Informative
    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.

    --
    sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});