Memory Management: Chapter 4
اسلاید 1: 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 Segmentation
اسلاید 2: 2Memory ManagementIdeally programmers want memory that islargefastnon volatileMemory hierarchy small amount of fast, expensive memory – cache some medium-speed, medium price main memorygigabytes of slow, cheap disk storageMemory manager handles the memory hierarchy
اسلاید 3: 3Basic Memory Management Monoprogramming without Swapping or PagingThree simple ways of organizing memory- an operating system with one user process
اسلاید 4: 4Multiprogramming with Fixed PartitionsFixed memory partitionsseparate input queues for each partitionsingle input queue
اسلاید 5: 5Modeling MultiprogrammingCPU utilization as a function of number of processes in memoryDegree of multiprogramming
اسلاید 6: 6Analysis of Multiprogramming System PerformanceArrival and work requirements of 4 jobsCPU utilization for 1 – 4 jobs with 80% I/O waitSequence of events as jobs arrive and finishnote numbers show amout of CPU time jobs get in each interval
اسلاید 7: 7Relocation and ProtectionCannot be sure where program will be loaded in memoryaddress locations of variables, code routines cannot be absolutemust keep a program out of other processes’ partitionsUse base and limit valuesaddress locations added to base value to map to physical addraddress locations larger than limit value is an error
اسلاید 8: 8Swapping (1)Memory allocation changes as processes come into memoryleave memoryShaded regions are unused memory
اسلاید 9: 9Swapping (2)Allocating space for growing data segmentAllocating space for growing stack & data segment
اسلاید 10: 10Memory Management with Bit MapsPart of memory with 5 processes, 3 holestick marks show allocation unitsshaded regions are freeCorresponding bit mapSame information as a list
اسلاید 11: 11Memory Management with Linked ListsFour neighbor combinations for the terminating process X
اسلاید 12: 12Virtual Memory Paging (1)The position and function of the MMU
اسلاید 13: 13Paging (2)The relation between virtual addresses and physical memory addres- ses given by page table
اسلاید 14: 14Page Tables (1)Internal operation of MMU with 16 4 KB pages
اسلاید 15: 15Page Tables (2)32 bit address with 2 page table fieldsTwo-level page tablesSecond-level page tablesTop-level page table
اسلاید 16: 16Page Tables (3)Typical page table entry
اسلاید 17: 17TLBs – Translation Lookaside BuffersA TLB to speed up paging
اسلاید 18: 18Inverted Page TablesComparison of a traditional page table with an inverted page table
اسلاید 19: 19Page Replacement AlgorithmsPage fault forces choice which page must be removedmake room for incoming pageModified page must first be savedunmodified just overwrittenBetter not to choose an often used pagewill probably need to be brought back in soon
اسلاید 20: 20Optimal Page Replacement AlgorithmReplace page needed at the farthest point in futureOptimal but unrealizableEstimate by …logging page use on previous runs of processalthough this is impractical
اسلاید 21: 21Not Recently Used Page Replacement AlgorithmEach page has Reference bit, Modified bitbits are set when page is referenced, modifiedPages are classifiednot referenced, not modifiednot referenced, modifiedreferenced, not modifiedreferenced, modifiedNRU removes page at randomfrom lowest numbered non empty class
اسلاید 22: 22FIFO Page Replacement AlgorithmMaintain a linked list of all pages in order they came into memoryPage at beginning of list replacedDisadvantagepage in memory the longest may be often used
اسلاید 23: 23Second Chance Page Replacement AlgorithmOperation of a second chancepages sorted in FIFO orderPage list if fault occurs at time 20, A has R bit set (numbers above pages are loading times)
اسلاید 24: 24The Clock Page Replacement Algorithm
اسلاید 25: 25Least Recently Used (LRU)Assume pages used recently will used again soonthrow out page that has been unused for longest timeMust keep a linked list of pagesmost recently used at front, least at rearupdate this list every memory reference !!Alternatively keep counter in each page table entrychoose page with lowest value counterperiodically zero the counter
اسلاید 26: 26Simulating LRU in Software (1)LRU using a matrix – pages referenced in order 0,1,2,3,2,1,0,3,2,3
اسلاید 27: 27Simulating LRU in Software (2)The aging algorithm simulates LRU in softwareNote 6 pages for 5 clock ticks, (a) – (e)
اسلاید 28: 28The Working Set Page Replacement Algorithm (1)The working set is the set of pages used by the k most recent memory referencesw(k,t) is the size of the working set at time, t
اسلاید 29: 29The Working Set Page Replacement Algorithm (2)The working set algorithm
اسلاید 30: 30The WSClock Page Replacement AlgorithmOperation of the WSClock algorithm
اسلاید 31: 31Review of Page Replacement Algorithms
اسلاید 32: 32Modeling Page Replacement Algorithms Beladys AnomalyFIFO with 3 page framesFIFO with 4 page framesPs show which page references show page faults
اسلاید 33: 33Stack AlgorithmsState of memory array, M, after each item in reference string is processed 7 4 6 5
اسلاید 34: 34The Distance StringProbability density functions for two hypothetical distance strings
اسلاید 35: 35The Distance StringComputation of page fault rate from distance stringthe C vectorthe F vector
اسلاید 36: 36Design Issues for Paging Systems Local versus Global Allocation Policies (1)Original configurationLocal page replacementGlobal page replacement
اسلاید 37: 37Local versus Global Allocation Policies (2)Page fault rate as a function of the number of page frames assigned
اسلاید 38: 38Load ControlDespite good designs, system may still thrashWhen PFF algorithm indicates some processes need more memory but no processes need lessSolution : Reduce number of processes competing for memoryswap one or more to disk, divide up pages they heldreconsider degree of multiprogramming
اسلاید 39: 39Page Size (1)Small page sizeAdvantagesless internal fragmentation better fit for various data structures, code sectionsless unused program in memoryDisadvantagesprograms need many pages, larger page tables
اسلاید 40: 40Page Size (2)Overhead due to page table and internal fragmentationWheres = average process size in bytesp = page size in bytese = page entrypage table spaceinternal fragmentationOptimized when
اسلاید 41: 41Separate Instruction and Data SpacesOne address spaceSeparate I and D spaces
اسلاید 42: 42Shared PagesTwo processes sharing same program sharing its page table
اسلاید 43: 43Cleaning PolicyNeed for a background process, paging daemonperiodically inspects state of memoryWhen too few frames are freeselects pages to evict using a replacement algorithmIt can use same circular list (clock) as regular page replacement algorithmbut with diff ptr
اسلاید 44: 44Implementation Issues Operating System Involvement with PagingFour times when OS involved with pagingProcess creationdetermine program sizecreate page tableProcess executionMMU reset for new processTLB flushedPage fault timedetermine virtual address causing faultswap target page out, needed page inProcess termination timerelease page table, pages
اسلاید 45: 45Page Fault Handling (1)Hardware traps to kernelGeneral registers savedOS determines which virtual page neededOS checks validity of address, seeks page frameIf selected frame is dirty, write it to disk
اسلاید 46: 46Page Fault Handling (2)OS brings schedules new page in from diskPage tables updatedFaulting instruction backed up to when it began Faulting process scheduledRegisters restoredProgram continues
اسلاید 47: 47Instruction BackupAn instruction causing a page fault
اسلاید 48: 48Locking Pages in MemoryVirtual memory and I/O occasionally interactProc issues call for read from device into bufferwhile waiting for I/O, another processes starts uphas a page faultbuffer for the first proc may be chosen to be paged outNeed to specify some pages lockedexempted from being target pages
اسلاید 49: 49Backing Store(a) Paging to static swap area(b) Backing up pages dynamically
اسلاید 50: 50Separation of Policy and MechanismPage fault handling with an external pager
اسلاید 51: 51Segmentation (1)One-dimensional address space with growing tablesOne table may bump into another
اسلاید 52: 52Segmentation (2)Allows each table to grow or shrink, independently
اسلاید 53: 53Segmentation (3)Comparison of paging and segmentation
اسلاید 54: 54Implementation of Pure Segmentation(a)-(d) Development of checkerboarding(e) Removal of the checkerboarding by compaction
اسلاید 55: 55Segmentation with Paging: MULTICS (1)Descriptor segment points to page tablesSegment descriptor – numbers are field lengths
اسلاید 56: 56Segmentation with Paging: MULTICS (2)A 34-bit MULTICS virtual address
اسلاید 57: 57Segmentation with Paging: MULTICS (3)Conversion of a 2-part MULTICS address into a main memory address
اسلاید 58: 58Segmentation with Paging: MULTICS (4)Simplified version of the MULTICS TLBExistence of 2 page sizes makes actual TLB more complicated
اسلاید 59: 59Segmentation with Paging: Pentium (1)A Pentium selector
اسلاید 60: 60Segmentation with Paging: Pentium (2)Pentium code segment descriptorData segments differ slightly
اسلاید 61: 61Segmentation with Paging: Pentium (3)Conversion of a (selector, offset) pair to a linear address
اسلاید 62: 62Segmentation with Paging: Pentium (4)Mapping of a linear address onto a physical address
اسلاید 63: 63Segmentation with Paging: Pentium (5)Protection on the PentiumLevel
نقد و بررسی ها
هیچ نظری برای این پاورپوینت نوشته نشده است.