Download Study: Memory Management, Swapping, Virtual Memory, and Page Replacement and more Slides Computer Science in PDF only on Docsity!
Memory Management
Chapter 4
4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms 4.6 Design issues for paging systems 4.7 Implementation issues 4.8 Segmentation
Memory Management
- Ideally programmers want memory that is
- Memory hierarchy
- small amount of fast, expensive memory – cache
- some medium-speed, medium price main memory
- gigabytes of slow, cheap disk storage
- Memory manager handles the memory hierarchy
Multiprogramming with Fixed Partitions
- Fixed memory partitions
- separate input queues for each partition
- single input queue
Modeling Multiprogramming
CPU utilization as a function of number of processes in memory
Degree of multiprogramming
Relocation and Protection
- Cannot be sure where program will be loaded in memory
- address locations of variables, code routines cannot be absolute
- must keep a program out of other processes’ partitions
- Use base and limit values
- address locations added to base value to map to physical addr
- address locations larger than limit value is an error
Swapping (1)
Memory allocation changes as
- processes come into memory
- leave memory Shaded regions are unused memory
Memory Management with Bit Maps
- Part of memory with 5 processes, 3 holes
- tick marks show allocation units
- shaded regions are free
- Corresponding bit map
- Same information as a list
Memory Management with Linked Lists
Four neighbor combinations for the terminating process X
Paging (2)
The relation between virtual addresses and physical memory addres- ses given by page table
Page Replacement Algorithms
- Page fault forces choice
- which page must be removed
- make room for incoming page
- Modified page must first be saved
- unmodified just overwritten
- Better not to choose an often used page
- will probably need to be brought back in soon
Not Recently Used Page Replacement Algorithm
- Each page has Reference bit, Modified bit
- bits are set when page is referenced, modified
- Pages are classified
- not referenced, not modified
- not referenced, modified
- referenced, not modified
- referenced, modified
- NRU removes page at random
- from lowest numbered non empty class
FIFO Page Replacement Algorithm
- Maintain a linked list of all pages
- in order they came into memory
- Page at beginning of list replaced
- Disadvantage
- page in memory the longest may be often used
The Working Set Page Replacement Algorithm (1)
- • The working set is the set of pages used by thew(k,t) is the size of the working set at time, t k most recent memory references
Modeling Page Replacement Algorithms
Belady's Anomaly
- FIFO with 3 page frames
- FIFO with 4 page frames
- P 's show which page references show page faults Docsity.com