This was taken from a deja: From: sabolich@my-deja.com (sabolich@my-deja.com) Subject: Re: RAM vs. Swap Partition . . . Newsgroups: alt.os.linux, uk.comp.os.linux Date: 2000/11/15 Technically speaking Linux does paging, not swapping. It keeps track of time expired since each page was last touched/accessed and ejects the oldest pages as memory pressure increases. When a program is loaded the program file is mmaped()ed into memory. Any files which are mmaped() do not need to be written to the page file/partition because if the page is ejected the data is still present in the disk file and can be retrieved on demand. So basically it is the same as VMS where code does not get written to the page file/partition because it can always be retrieved but data/stack is written to the page file/partition. The added bonus here is that you can simply mmap() a file into memory and work on it -- it is more efficient than read(), work on memory, write() because only needed disk i/o is performed and page file/partition space is uneeded. Currently Linux does not have thrashing control while FreeBSD for example does. This comes into play if paging becomes very heavy the system dectects this condition and swaps out an entire process and keeps it suspended for about 20 seconds. As a general rule you must do process switches less often as paging becomes heavy in order to maintain high overall throughput. Currently Linux does not keep track of age for physical pages but it keeps track on a per process basis. This would work fine if no pages were shared but since dynamically linked code is shared among processes Linux page aging skews the results for shared pages. BSDs keep track of age for physical pages so everything is weighed equally. Accurate page aging and thrashing control (among other refinements) make BSDs quite effecient when paging to disk. When people say that BSDs are better servers than Linux because they perform better 'under load' this is the primary reason. There is also 'pre-emtive swapout'. Here very old pages are paged out to make room for disk cache when the OS detects i/o pressure. FreeBSD does this. I'm not sure about Linux. Fran He goes on to say in later posts that when Linux runs out of SWAP it starts killing off the oldest processes to make room.