Hi, On Thursday 28 July 2005 21:44, Greg Wallace wrote:
...
Interesting. On a Windoze machine, when you start a program, it loads two copies of the program into memory, one into cache and one into active memory. If you close the program, the active memory area is freed, but the cached copy stays there until you do a restart or until the memory runs low and Windoze needs to reuse it. If you turn right around and re-start the program, the program is copied from the cache area of RAM over to the active memory area (a memory to memory copy), so that it starts faster the second time. Is this the same thing with swap on Linux? Is everything in "used" also in "cached", along with some copies of programs that are no longer executing (I e., the memory is available for re-use, if necessary, but also available for a fast load of the program)?
For the way most programs are linked, the text (and some of the pre-initialized data) is considered "pure" (read-only) and thus shareable. Furthermore the linker can align the pure code and data within the object file so it's properly aligned to the hardware's paging boundaries. Then the OS need never copy that information to swap space. Demand paging retrieves it directly from the executable program or shared-object file. When a page holding pure code or data is to be replace, it's simply abandoned, never needing to be paged out.
Greg Wallace
Randall Schulz