------------------------------------------------------------------------------ Windows NT: - reserve memory and committ memory; - clustering; - local replacement with FIFO; - free list; ------------------------------------------------------------------------------- Example systems: - Linux; ( Unlike some other UNIX implementations, Linux does not maintain a mapping from a given physical page to all the users of that page, in particular to all the processes that may be sharing that page. As a result, {\em swap\_out} cannot be implemented by traversing the putative reverse mapping structure: in order to free a page, {\em swap\_out} would need to clear the ``valid'' bit on each page table entry mapping that page---but {\em swap\_out} does not have that list of page table entries available. Instead, {\em swap\_out} works by iterating over each process's page table, freeing pages that are deemed to be sufficiently old. Shared pages are freed by being removed one at a time from each sharer's address space. In more detail, {\em swap\_out} iterates over the list of processes; for each process, {\em swap\_out} calculates a maximum number of pages to free in the current iteration: 32 pages per megabyte of resident memory per process. {\em swap\_out} then traverses the process' page table, applying a linear aging algorithm to each page. If a page's age reaches 0, the page is written to backing store (if necessary) and returned to the free pool. The page aging process has the following algorithm. (Note that the numeric constants in the pseudocode below are the default values, which I left unchanged; these values may be tuned at run-time, but I ignored this capability.) age\_page(page $P$): \\ \> if ($P$'s reference bit is set) \\ \> \> if ($P.age < 20 - 3$) \\ \> \> \> $P.age = P.age + 3$ \\ \> \> else \\ \> \> \> $P.age = 20$ \\ \> \> return \> \> \> {\em don't free this page} \\ \> else \> \> \> {\em page not referenced} \\ \> \> if ($P.age > 1$) \\ \> \> \> $P.age = P.age - 1$ \\ \> \> else \\ \> \> \> $P.age = 0$ \\ \> if ($P.age = 0$) \\ \> \> replace $P$ \\ When a page is first added to an address space, its age is set to 3. ) ------------------------------------------------------------------------------ Sharing in VM: Example: - Solaris 2.5 Memory Regions: ------------------------------------------------------------------------------ Example: - Windows 95 i386: Segmentation with Paging: . segments: i386: 16K segments, half for private use, half for common use; each segment is 32 bits; local descriptor table, global descriptor table: table entry: 8 bytes, including base location, and length; every virtual address is a pair: <13-bit s, 1-bit g, 2-bit p> + 32-bit offset; six segment registers; segment tables ---> segment descriptor --> another virtual address; . two-level page tables; Figure in page 283 of the dinasour book; Windows 95: three memory models: . Win 3.1 protected mode segmented memory model; (16-bit windows program) . use selector + offset to reference a physical page; . no paging; . segments up to 64KB each; . WinNT flat memory model; (32-bit windows program) . paging; . two-level page table; . Virtual-86 model; . only 20-bit addresses; . 1MB of addressable space; . segment + offset used to generate the 20-bit address; ============================================================================== Multiprogramming and Paging: (section 9.6) (minimum number of page frames;) - global replacement versus local replacement; In local replacement: - equal allocation; - proportional allocation; - thrashing: one process thrashing; multiple process thrashing; - working set model; - page fault frequency; ==============================================================================