Windows 2000 Memory Management

...uous; they can be placed in any free page frame. When the number of free page frames begins to run low selected pages (See Replacement Policy) are copied to disk. This process of moving pages is called paging and is transparent to programmers. Windows 2000’s memory architecture is a demand-paged, virtual memory system. Demand paging refers to the fetch policy, which brings a page of memory into main memory when a process references that page. The virtual memory manager can transfer pages to multiple page files. If the page files are located on separate physical disks then multiple pages can be transferred to separate files simultaneously. This technique is used to increase swapping speed and improve system performance. To translate virtual memory addresses to physical memory addresses a page table is used. Intel processors implement a page table format in hardware. The Virtual Memory Manager can also mimic this format used by Intel. The page table consists of a two level table look-up operation. The first level table (called a page directory), which contains 1024 entries, points to pages in the second table. The second level table points to the page frames in physical memory . To facilitate fast page table look-ups a cache is used to store page table entries (called a transaction lookaside buffer (TLB)). This cache stores the most recently used entries and hardware is used to read the entries simultaneously and compare them with the target address. If the entry does not exist in the cache then software is used to access to page table in memory. Page Frame Database The Virtual Memory Manager also needs to track the state of physical memory (i.e. whether a page frame is free and who is using the page frame). The Page Frame Database is an array, which contains entries for each page frame. Page table entries point to entries in Page Frame Database and similarly entries in Page Frame Database point to entries in the Page table, which are using the page frame. Page frame can be in one of the following states: • Valid Page • Zeroed - The page is not used and has been initialized with zeros. • Free - Free but not initialized. • Standby - This page frame was in use and the page table entry is invalid and has been marked with a transition flag. • Modified - Same as standby except changes have not yet been written to disk. • Bad - Cannot be used due to parity or other hardware error. The database will also link together those pages, which are of the same state. When the number of zeroed, free and standby entries falls below a given threshold a thread called the modified page writer is initiated and writes the modified page frames to disk and changes their state to standby. If the number of modified entries falls below a given threshold the Virtual Memory Manager begins automatic working set trimming (See Replacement Policy). The trimmed entries then have there status changed to modified or standby. Replacement Policy When the number of free page frames begins to run low selected pages are copied to disk. The rules that determine which pages are to be copied to disk is called a replacement policy. The replacement policy, which Windows 2000 uses, is first- in, first-out (FIFO). This means that those pages, which have been in memory the longest, will be copied to disk (regardless of how often they are used). To enable the Virtual Memory Manager to determine the oldest page it must keep track of the pages currently in memory for each process (called process’s working set). When a process is created it is assigned a minimum working set size. This represents the minimum number of pages that the process will have in physical memory while it is executing. If there are sufficient free page frames available then the process may be assigned more pages. However, if there are insufficient free page frames available then when a page fault occurs the Virtual Memory Manager will copy the oldest page to disk. Note that pages that are copied to disk still remain in physical memory for some time. This means that it may be possible to transfer a page from disk without performing any reads. If a process incurs no page faults for a given period of time (i.e. the code the process’s threads are executing fit within the minimum working set size or none of the process’s threads are executing) then the Virtual Memory Manager will reduce the process’s working set until a page fault occurs. When physical memory becomes low the Virtual Memory Manager begins comparing each process’s minimum working set size with its current working set size. If a process’s current working set size is greater than its minimum working set size, pages are removed from its working set (called automatic working set trimming). Some processes, for performance reasons, may require a page of memory to stay in physical memory. The process may lock the appropriate page, which will prevent it from being removed from memory while any thread in the process is executing. For example, if an index to a data structure were kept in memory, it would significantly reduce the number of page faults. User/Kernel Modes Windows 2000 separates applications from the operating system by running applications in a non-privileged processor mode (called user mode) and operating system code in a privileged processor mode (called kernel mode). When in kernel mode, access to system data and hardware is permitted. However, in user mode access to system data and hardware is limited. When an application (in user mode) calls a system service the processor switches the calling thread to kernel mode. On completion of the system service the processor changes the thread back to us...

Essay Information


Words: 1826
Pages: 7.3
Rating: None

All Papers Are For Research And Reference Purposes Only. You must cite our web site as your source.