150 likes | 232 Views
Memory Management. Basic Memory Management. Monoprogramming Protection Swapping Overlaying. User space. OS space. Multiprogramming with Fixed Partitions. Placement External Fragmentation Protection Relocation. Variable Partition Allocation. Protection Relocation Compaction
E N D
Basic Memory Management • Monoprogramming • Protection • Swapping • Overlaying User space OS space
Multiprogramming with Fixed Partitions • Placement • External Fragmentation • Protection • Relocation
Variable Partition Allocation • Protection • Relocation • Compaction • Placement Strategies • First fit • Next fit • Best fit • Worst fit • Quick fit Free Allocated Free Allocated Allocated
Variable Partition Allocation • Memory Management with Bitmaps • Memory Management with Linked Lists 1 1 0 0 0 1 1 1 0 0 0 0 1 1 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 1 1 1 P/H Starts Length Ptr
Virtual Memory • Memory Hierarchy • Address Space • Run-time Memory • Logical Blocks - Segments • Physical Blocks - Pages Primary memory Secondary memory
Virtual Memory SM • Paging • Fixed size blocks • 2-dim address • Mapping and address translation • Virtual to Physical • (v.page no., byte no.) (p.page no., byte no.) PM Page no. Byte no.
Virtual Memory • Page Tables • Logically one per process • No. of rows equal no. of pages • No. of columns determined by no. of entries (data fields per page) • L/NL, M/NM, Page no., SSA, etc. • Address translation • Active PT, MMU, PTAR
Virtual Memory • Address translation • Active PT, MMU, PTAR 4000 PTAR VA: (2, 596) PT 4000 + 2 PA: (128, 596)
Virtual Memory • Protection • Demand Paging • Page Faults • Expensive overhead • Prepaging • TLB – Translation LookasideBuffer • Cache of high-demand pages
Page Replacement Algorithms • The Optimal Page Replacement Algorithm • Least Recently Used • Least Frequently Used • First In First Out – FIFO
Page Replacement Algorithms • Second Chance • Check “referenced” bit • Clock • Circular list with “referenced” bit • Not Recently Used • Check “referenced” and “modified” bits • 4 classes of pages • The Working Set • The WSClock
Design and Implementation Issues • Page size • Separate Instruction and Data Spaces • Shared Pages • Local versus Global Allocation • Page Fault Handling • Locking Pages in Memory
Segmentation • Process divided into logical blocks – segments • 2 dim addressing (s.no., byte no) – virtual address • Segment Map Table (SMT) is required • Variable partition allocation • Address Translation • VA: (s.no., byte) PA: (partition begin addr., byte) • SMTAR Active SMT
Segmentation with Paging • Process divided into segments • Segments divided into pages • Memory allocated as pages • VA: (s.no., page no., byte) PA: (page frame no., byte)