Presentation is loading. Please wait.

Presentation is loading. Please wait.

Windows XP Memory Management Aaron Lanoy and Jason Farnsworth.

Similar presentations


Presentation on theme: "Windows XP Memory Management Aaron Lanoy and Jason Farnsworth."— Presentation transcript:

1 Windows XP Memory Management Aaron Lanoy and Jason Farnsworth

2 Outline Virtual Memory Manager Memory Allocation Page Replacement Paged vs. non-paged pools Virtual Memory Manager Memory Allocation Page Replacement Paged vs. non-paged pools

3 Virtual Memory Manager Seems to let each process “have” 4GB of contiguous memory Page frames (main memory) or page files (disk) Copy-on-write Lazy allocation Disk I/O as little as possible, but fetches large chunks when done Seems to let each process “have” 4GB of contiguous memory Page frames (main memory) or page files (disk) Copy-on-write Lazy allocation Disk I/O as little as possible, but fetches large chunks when done

4 Virtual Memory Manager Allocates a unique 4GB virtual address space to each process A process can only access the first 2GB 4KB fixed-size page frames Pseudo-Exception: Large Pages Large set of contiguous pages treated as a single page Data that is always accessed together Speeds up page access Must be 2MB or greater multiple, must allow read & write, constituent pages must be contiguous in virtual and physical memory Allocates a unique 4GB virtual address space to each process A process can only access the first 2GB 4KB fixed-size page frames Pseudo-Exception: Large Pages Large set of contiguous pages treated as a single page Data that is always accessed together Speeds up page access Must be 2MB or greater multiple, must allow read & write, constituent pages must be contiguous in virtual and physical memory

5 Virtual Memory Manager Processes have one page directory table Loaded into page directory register Page directory entries point to page tables Page table entries point to page frames VMM uses virtual addresses along with the memory map to translate into a physical address Processes have one page directory table Loaded into page directory register Page directory entries point to page tables Page table entries point to page frames VMM uses virtual addresses along with the memory map to translate into a physical address

6 Address Translation Address Translation Animation

7 Virtual Memory Manager Address translation: Translation is algorithm very quick Delay caused by the time required to read PDE’s and PTE’s out of main memory Can be sped up through use of Translational Look-aside Buffer (TLB) Address translation: Translation is algorithm very quick Delay caused by the time required to read PDE’s and PTE’s out of main memory Can be sped up through use of Translational Look-aside Buffer (TLB)

8 Virtual Memory Manager PTE’s are 32 bits long, 5 of which are used for protection / state indication Read, write, execute, copy-on-write, exception flag, valid, modified, transition, etc… Copy-on-write Utilizes prototype page tables – instead of pointing directly to the frame, points to a PPTE that points to the frame File mapping, common area of memory for inter-process communication Better utilization of memory but longer address translations PTE’s are 32 bits long, 5 of which are used for protection / state indication Read, write, execute, copy-on-write, exception flag, valid, modified, transition, etc… Copy-on-write Utilizes prototype page tables – instead of pointing directly to the frame, points to a PPTE that points to the frame File mapping, common area of memory for inter-process communication Better utilization of memory but longer address translations

9 Memory Allocation 3-step memory allocation: Reservation Commitment Access Windows XP denies all “must-succeed requests” Shifts burden onto components to deal with the denial 3-step memory allocation: Reservation Commitment Access Windows XP denies all “must-succeed requests” Shifts burden onto components to deal with the denial

10 Memory Allocation Problem: Low memory situation Solution: I/O Throttling Switches from fetching large numbers of pages at each disk I/O access to fetching a single page at a time Slows down the system, but prevents crashes Problem: Low memory situation Solution: I/O Throttling Switches from fetching large numbers of pages at each disk I/O access to fetching a single page at a time Slows down the system, but prevents crashes

11 Memory Allocation Page frame database Tracks the state of all frames with a singly linked list for each possible state 8 States: Page frame database Tracks the state of all frames with a singly linked list for each possible state 8 States: Valid Modified No-write TransitionFree StandbyZeroed ModifiedBad

12 Page Replacement Scenario Page replacement demonstration Page replacement demonstration Page replacement demonstration Page replacement demonstration

13 Page Replacement The working set of a process is all of its pages that are in main memory Balance set manager moves some of a process’s working set to page files when memory becomes scarce Localized least-recently used policy to determine which pages to move to disk Working set max (can be dynamic) Working set min (dynamic only if system memory is low) The working set of a process is all of its pages that are in main memory Balance set manager moves some of a process’s working set to page files when memory becomes scarce Localized least-recently used policy to determine which pages to move to disk Working set max (can be dynamic) Working set min (dynamic only if system memory is low)

14 Memory Allocation Virtual Address Descriptors, the virtual address space allocated to a process Windows XP attempts to anticipate needed pages Demand paging: loads the requested page and nearby pages (spatial locality) Pages in the same cluster are likely to be part of the same file Loads the pages from an entire cluster at a time Results in higher memory usage, lowered disk hits Virtual Address Descriptors, the virtual address space allocated to a process Windows XP attempts to anticipate needed pages Demand paging: loads the requested page and nearby pages (spatial locality) Pages in the same cluster are likely to be part of the same file Loads the pages from an entire cluster at a time Results in higher memory usage, lowered disk hits

15 Memory Allocation Windows XP and prefetching Tracks the last 8 applications loaded, for the 9 th application, loads all the pages from those applications On boot, prefetches pages while devices are initialized Logical Prefetcher – records memory accesses in a scenario file Requires extra time to write this file Results in a less disk I/O (faster load times) Used for ALL applications and Windows XP itself Windows XP and prefetching Tracks the last 8 applications loaded, for the 9 th application, loads all the pages from those applications On boot, prefetches pages while devices are initialized Logical Prefetcher – records memory accesses in a scenario file Requires extra time to write this file Results in a less disk I/O (faster load times) Used for ALL applications and Windows XP itself

16 Paged vs. Non-paged Non-paged pool Cannot be written to disk Data always remains in memory Examples: Code for interrupt handling, unencrypted passwords, portions of device drivers and the VMM Cons: Limited space, no access paged pool or disk Non-paged pool Cannot be written to disk Data always remains in memory Examples: Code for interrupt handling, unencrypted passwords, portions of device drivers and the VMM Cons: Limited space, no access paged pool or disk

17 The Near-Future DEP (Data Execution Prevention): Security bit with all 64-bit processors and more recent Pentiums 32 vs. 64 bit systems DEP (Data Execution Prevention): Security bit with all 64-bit processors and more recent Pentiums 32 vs. 64 bit systems

18 Summary Virtual Memory Manager Memory Allocation Page Replacement Paged vs. non-paged pools Virtual Memory Manager Memory Allocation Page Replacement Paged vs. non-paged pools


Download ppt "Windows XP Memory Management Aaron Lanoy and Jason Farnsworth."

Similar presentations


Ads by Google