From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tommy McCabe Subject: Swapping Date: Wed, 26 May 2004 15:45:28 -0700 (PDT) Sender: linux-8086-owner@vger.kernel.org Message-ID: <20040526224528.4700.qmail@web51301.mail.yahoo.com> Mime-Version: 1.0 Return-path: List-Id: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-8086@vger.kernel.org Swapping, in theory, is actually quite simple. The memory is borken up into fixed-size pages, or segments, or whatever you want to call them. Instead of each program accessing the memory directly, as in DOS, each program interfaces with a virtual kernel memory. When a page enters the virtual kernel memory, the kernel puts it somewhere in the hardware memory. Because of this interface layer, pages can be wherever they want in the hardware, but all the program sees is the virtual address. Also, the virtual memory can be a lot larger than the hardware memory. So, if the hardware memory is almost all used, and a program enters a page in virtual memory, the kernel can put that page on the hard disk instead of in RAM, and when the program uses that virtual address, the kernel fetches the data from the hard drive, and the program never sees it because the kernel does all the switching and fetching. An opposite, but harder idea, is caching- when a file is loaded from the hard disk, its allocated space in virtual memory, which is allocated space in real memory, so that the data can be accessed faster. __________________________________ Do you Yahoo!? Friends. Fun. Try the all-new Yahoo! Messenger. http://messenger.yahoo.com/