Unformatted text preview:

Memory ManagementMemory ManagementBasic Memory Management Monoprogramming without Swapping or PagingMultiprogramming with Fixed PartitionsModeling MultiprogrammingAnalysis of Multiprogramming System PerformanceRelocation and ProtectionSwapping (1)Swapping (2)Memory Management with Bit MapsMemory Management with Linked ListsVirtual Memory Paging (1)Paging (2)Page Tables (1)Page Tables (2)Page Tables (3)TLBs – Translation Lookaside BuffersInverted Page TablesPage Replacement AlgorithmsOptimal Page Replacement AlgorithmNot Recently Used Page Replacement AlgorithmFIFO Page Replacement AlgorithmSecond Chance Page Replacement AlgorithmThe Clock Page Replacement AlgorithmLeast Recently Used (LRU)Simulating LRU in Software (1)Simulating LRU in Software (2)The Working Set Page Replacement Algorithm (1)The Working Set Page Replacement Algorithm (2)The WSClock Page Replacement AlgorithmReview of Page Replacement AlgorithmsModeling Page Replacement Algorithms Belady's AnomalyStack AlgorithmsThe Distance StringSlide 35Design Issues for Paging Systems Local versus Global Allocation Policies (1)Local versus Global Allocation Policies (2)Load ControlPage Size (1)Page Size (2)Separate Instruction and Data SpacesShared PagesCleaning PolicyImplementation Issues Operating System Involvement with PagingPage Fault Handling (1)Page Fault Handling (2)Instruction BackupLocking Pages in MemoryBacking StoreSeparation of Policy and MechanismSegmentation (1)Segmentation (2)Segmentation (3)Implementation of Pure SegmentationSegmentation with Paging: MULTICS (1)Segmentation with Paging: MULTICS (2)Segmentation with Paging: MULTICS (3)Segmentation with Paging: MULTICS (4)Segmentation with Paging: Pentium (1)Segmentation with Paging: Pentium (2)Segmentation with Paging: Pentium (3)Segmentation with Paging: Pentium (4)Segmentation with Paging: Pentium (5)1Memory ManagementChapter 44.1 Basic memory management4.2 Swapping4.3 Virtual memory4.4 Page replacement algorithms4.5 Modeling page replacement algorithms4.6 Design issues for paging systems4.7 Implementation issues4.8 Segmentation2Memory Management•Ideally programmers want memory that is–large–fast–non volatile•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 hierarchy3Basic Memory ManagementMonoprogramming without Swapping or PagingThree simple ways of organizing memory- an operating system with one user process4Multiprogramming with Fixed Partitions•Fixed memory partitions–separate input queues for each partition–single input queue5Modeling MultiprogrammingCPU utilization as a function of number of processes in memoryDegree of multiprogramming6Analysis of Multiprogramming System Performance•Arrival and work requirements of 4 jobs•CPU utilization for 1 – 4 jobs with 80% I/O wait•Sequence of events as jobs arrive and finish–note numbers show amout of CPU time jobs get in each interval7Relocation 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 error8Swapping (1)Memory allocation changes as –processes come into memory–leave memoryShaded regions are unused memory9Swapping (2)•Allocating space for growing data segment•Allocating space for growing stack & data segment10Memory 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 list11Memory Management with Linked ListsFour neighbor combinations for the terminating process X12Virtual MemoryPaging (1)The position and function of the MMU13Paging (2)The relation betweenvirtual addressesand physical memory addres-ses given bypage table14Page Tables (1)Internal operation of MMU with 16 4 KB pages15Page Tables (2)•32 bit address with 2 page table fields•Two-level page tablesSecond-level page tablesTop-level page table16Page Tables (3)Typical page table entry17TLBs – Translation Lookaside BuffersA TLB to speed up paging18Inverted Page TablesComparison of a traditional page table with an inverted page table19Page 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 soon20Optimal Page Replacement Algorithm•Replace page needed at the farthest point in future–Optimal but unrealizable•Estimate by …–logging page use on previous runs of process–although this is impractical21Not Recently Used Page Replacement Algorithm•Each page has Reference bit, Modified bit–bits are set when page is referenced, modified•Pages are classified1. not referenced, not modified2. not referenced, modified3. referenced, not modified4. referenced, modified•NRU removes page at random–from lowest numbered non empty class22FIFO 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 used23Second Chance Page Replacement Algorithm•Operation of a second chance–pages sorted in FIFO order–Page list if fault occurs at time 20, A has R bit set(numbers above pages are loading times)24The Clock Page Replacement Algorithm25Least Recently Used (LRU)•Assume pages used recently will used again soon–throw out page that has been unused for longest time•Must keep a linked list of pages–most recently used at front, least at rear–update this list every memory reference !!•Alternatively keep counter in each page table entry–choose page with lowest value counter–periodically zero the counter26Simulating LRU in Software (1)LRU using a matrix – pages referenced in order 0,1,2,3,2,1,0,3,2,327Simulating LRU in Software (2)•The aging algorithm simulates LRU in software•Note 6 pages for 5 clock ticks, (a) – (e)28The Working Set Page Replacement Algorithm (1)•The working set is the set of pages used by the k most recent memory references•w(k,t) is the size of the working set at time, t29The Working


View Full Document

UCSC CMPS 111 - Memory Management

Download Memory Management
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Memory Management and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Memory Management 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?