18
Windows XP Memory Management Aaron Lanoy and Jason Farnsworth

Windows XP Memory Management

  • Upload
    faunus

  • View
    36

  • Download
    0

Embed Size (px)

DESCRIPTION

Windows XP Memory Management. Aaron Lanoy and Jason Farnsworth. Outline. Virtual Memory Manager Memory Allocation Page Replacement Paged vs. non-paged pools. Virtual Memory Manager. Seems to let each process “have” 4GB of contiguous memory Page frames (main memory) or page files (disk) - PowerPoint PPT Presentation

Citation preview

Page 1: Windows XP Memory Management

Windows XP Memory ManagementWindows XP Memory ManagementAaron Lanoy and Jason FarnsworthAaron Lanoy and Jason Farnsworth

Page 2: Windows XP Memory Management

OutlineOutline

Virtual Memory ManagerMemory AllocationPage ReplacementPaged vs. non-paged pools

Virtual Memory ManagerMemory AllocationPage ReplacementPaged vs. non-paged pools

Page 3: Windows XP Memory Management

Virtual Memory ManagerVirtual Memory Manager

Seems to let each process “have” 4GB of contiguous memory

Page frames (main memory) or page files (disk)

Copy-on-writeLazy allocationDisk 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-writeLazy allocationDisk I/O as little as possible, but

fetches large chunks when done

Page 4: Windows XP Memory Management

Virtual Memory ManagerVirtual 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

Page 5: Windows XP Memory Management

Virtual Memory ManagerVirtual Memory Manager

Processes have one page directory table

Loaded into page directory registerPage directory entries point to page

tablesPage table entries point to page

framesVMM uses virtual addresses along

with the memory map to translate into a physical address

Processes have one page directory table

Loaded into page directory registerPage directory entries point to page

tablesPage table entries point to page

framesVMM uses virtual addresses along

with the memory map to translate into a physical address

Page 6: Windows XP Memory Management

Address TranslationAddress Translation

Address Translation AnimationAddress Translation Animation

Page 7: Windows XP Memory Management

Virtual Memory ManagerVirtual Memory Manager

Address translation:Translation is algorithm very quickDelay 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 quickDelay 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)

Page 8: Windows XP Memory Management

Virtual Memory ManagerVirtual 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

Page 9: Windows XP Memory Management

Memory AllocationMemory Allocation

3-step memory allocation:ReservationCommitmentAccess

Windows XP denies all “must-succeed requests”Shifts burden onto components to

deal with the denial

3-step memory allocation:ReservationCommitmentAccess

Windows XP denies all “must-succeed requests”Shifts burden onto components to

deal with the denial

Page 10: Windows XP Memory Management

Memory AllocationMemory Allocation

Problem: Low memory situation Solution: I/O ThrottlingSwitches 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 ThrottlingSwitches 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

Page 11: Windows XP Memory Management

Memory AllocationMemory Allocation

Page frame databaseTracks the state of all frames with a

singly linked list for each possible state

8 States:

Page frame databaseTracks the state of all frames with a

singly linked list for each possible state

8 States:ValidValid Modified No-Modified No-

writewrite

TransitionTransition FreeFree

StandbyStandby ZeroedZeroed

ModifiedModified BadBad

Page 12: Windows XP Memory Management

Page Replacement Scenario

Page Replacement Scenario

Page replacement demonstrationPage replacement demonstration

Page 13: Windows XP Memory Management

Page ReplacementPage 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)

Page 14: Windows XP Memory Management

Memory AllocationMemory 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

Page 15: Windows XP Memory Management

Memory AllocationMemory Allocation

Windows XP and prefetching Tracks the last 8 applications loaded, for

the 9th 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 9th 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

Page 16: Windows XP Memory Management

Paged vs. Non-pagedPaged vs. Non-paged

Non-paged poolCannot be written to diskData always remains in memoryExamples: Code for interrupt

handling, unencrypted passwords, portions of device drivers and the VMM

Cons: Limited space, no access paged pool or disk

Non-paged poolCannot be written to diskData always remains in memoryExamples: Code for interrupt

handling, unencrypted passwords, portions of device drivers and the VMM

Cons: Limited space, no access paged pool or disk

Page 17: Windows XP Memory Management

The Near-FutureThe 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

Page 18: Windows XP Memory Management

SummarySummary

Virtual Memory ManagerMemory AllocationPage ReplacementPaged vs. non-paged pools

Virtual Memory ManagerMemory AllocationPage ReplacementPaged vs. non-paged pools