110 likes | 137 Views
The VAX/VMS Virtual Memory System. Sung Gon Kim ( skim@dcslab.snu.ac.kr ) Yeong Ouk Kim ( kim331@snu.ac.kr ) Hwa Jung Kim ( hkim@dcslab.snu.ac.kr ) School of Computer Science and Engineering Seoul National University. Table of Contents. Background Memory Management Hardware
E N D
The VAX/VMS Virtual Memory System Sung Gon Kim (skim@dcslab.snu.ac.kr) Yeong Ouk Kim (kim331@snu.ac.kr) Hwa Jung Kim (hkim@dcslab.snu.ac.kr) School of Computer Science and Engineering Seoul National University
Table of Contents Background Memory Management Hardware A Real Address Space Page Replacement Other Neat VM Tricks Summary
Background VAX-11/750 VAX-11/780 • VAX-11 minicomputer architecture • Late 1970’s • By Digital Equipment Corporation(DEC) • Targeted a broad range of machines • Machines with both high and low performance • The OS provides mechanisms and policies which work across all platforms
Memory Management Hardware VPN offset 0 User Code User Heap User (P0) 21-bits 23-bits 9-bits 2-bits Unique to each process 230 Seg User (P1) User Stack 231 Protected OS code and data System (S) Shared across processes Unused 4 • Virtual address • 32-bit address space per process • 512-byte pages 232
Memory Management Hardware 0 User Code Protected OS code and data User Heap User (P0) Kernel Heap User Page Table Base Register for P0 Bound Register for P0 230 Page table for User P0 User (P1) Unused Not Mapped Base Register for P1 User Stack Bound Register for P1 231 • Base and bound registers for virtual memory • Commonly used in physical memory for dynamic reallocation • Virtual memory in VAX is also dynamically reallocated Page table for User P1 • Major concern of the VMS designer • VMS should not overwhelm memory with page tables
A Real Address Space Page 0 : INVALID Trap Tables Kernel Data User Code Kernel Code User Heap Kernel Heap Unused User Stack • Page 0 • An invalid page which is used to detect null-pointer accesses • Identical kernel mapping for each user address space • On context switch, only p0 and p1 registers get changed • Providing consistent kernel accesses • Hardware-supported protection • Protection bit in the page table • Accesses with invalid protection level • Trap into the OS
Page Replacement 31 30 27 26 25 21 20 0 • Motivation • Small page size results innumerous short disk I/O • Memory hogs: Certain programs hog most of memory • No reference bit in the VAX’s page table entry • Page Clustering • VMS groups large batches of pages for swapping, lowering I/O cost
Page Replacement Clean page P1’s FIFO P2’s FIFO P3’s FIFO Dirty page New page Page Fault Memory hogsare prevented Reference bitis not needed Clean-page free list Dirty-page list end start • Segmented FIFO • Resident set size(RSS) • Each process has a maximum number of pages which reside in memory • VAX uses second-chance lists • Emulating reference bits • Make the pages inaccessible (store protection bits using OS reserved bits) • When referenced, restore the protection bits to indicate recent activity
Other Neat VM Tricks (Lazy optimization) Rare case Common case Physical memory Process A’s page table Zero it Candidate Unnecessary workavoided! Ready to use! Not used OS TRAP! Read or write The page is ademand-zero page Restoreprotection bits Swap outordeallocation Swap inorallocation Process A’s page table Disk Swap outordeallocation • Demand Zeroing • Motivation: pages allocated may not be used at all • Commoncase: mark the page as inaccessible • Rarecase: when the page gets read or written, performs zeroing
Other Neat VM Tricks (Lazy optimization) Rare case Common case Process A Physical memory Process B Mark itread-only Map it insteadof copying it OS TRAP! Make a copy Ready to use! Write operationactually happens The pageis a COW page Only readsthe pagebefore terminating Or exec()overwritesaddress space Process Aneeds a copyof this page No unnecessarycopies made! • Copy on Write • Motivation: page copies are usually not modified • Common case: map it into the target address and mark the page as read-only • Rare case: when a write operation occurs, performs the copy operation
Summary • Virtual Memory in VAX system • Memory Management Hardware • A Real Address Space • Page 0: null-pointer • Identical kernel mapping across each address space • Protection bit • Page Replacement • Limiting memory for each process: resident set size(RSS) • Page clustering for faster swapping • Other Neat VM Tricks • Demand zeroing • Copy-on-write