Operating system chapter 8
اسلاید 1: 1Virtual MemoryChapter 8
اسلاید 2: 2Hardware and Control StructuresMemory references are dynamically translated into physical addresses at run timeA process may be swapped in and out of main memory such that it occupies different regionsA process may be broken up into pieces that do not need to located contiguously in main memoryAll pieces of a process do not need to be loaded in main memory during execution
اسلاید 3: 3Execution of a ProgramOperating system brings into main memory a few pieces of the programResident set - portion of process that is in main memoryAn interrupt is generated when an address is needed that is not in main memoryOperating system places the process in a blocking state
اسلاید 4: 4Execution of a ProgramPiece of process that contains the logical address is brought into main memoryOperating system issues a disk I/O Read requestAnother process is dispatched to run while the disk I/O takes placeAn interrupt is issued when disk I/O complete which causes the operating system to place the affected process in the Ready state
اسلاید 5: 5Advantages of Breaking up a ProcessMore processes may be maintained in main memoryOnly load in some of the pieces of each processWith so many processes in main memory, it is very likely a process will be in the Ready state at any particular timeA process may be larger than all of main memory
اسلاید 6: 6Types of MemoryReal memoryMain memoryVirtual memoryMemory on diskAllows for effective multiprogramming and relieves the user of tight constraints of main memory
اسلاید 7: 7ThrashingSwapping out a piece of a process just before that piece is neededThe processor spends most of its time swapping pieces rather than executing user instructions
اسلاید 8: 8Principle of LocalityProgram and data references within a process tend to clusterOnly a few pieces of a process will be needed over a short period of timePossible to make intelligent guesses about which pieces will be needed in the futureThis suggests that virtual memory may work efficiently
اسلاید 9: 9Support Needed for Virtual MemoryHardware must support paging and segmentation Operating system must be able to management the movement of pages and/or segments between secondary memory and main memory
اسلاید 10: 10PagingEach process has its own page tableEach page table entry contains the frame number of the corresponding page in main memoryA bit is needed to indicate whether the page is in main memory or not
اسلاید 11: 11Paging
اسلاید 12: 12Modify Bit in Page TableModify bit is needed to indicate if the page has been altered since it was last loaded into main memoryIf no change has been made, the page does not have to be written to the disk when it needs to be swapped out
اسلاید 13: 13
اسلاید 14: 14Two-Level Scheme for 32-bit Address
اسلاید 15: 15Page TablesThe entire page table may take up too much main memoryPage tables are also stored in virtual memoryWhen a process is running, part of its page table is in main memory
اسلاید 16: 16Inverted Page TableUsed on PowerPC, UltraSPARC, and IA-64 architecturePage number portion of a virtual address is mapped into a hash valueHash value points to inverted page tableFixed proportion of real memory is required for the tables regardless of the number of processes
اسلاید 17: 17Inverted Page TablePage numberProcess identifierControl bitsChain pointer
اسلاید 18: 18
اسلاید 19: 19Translation Lookaside BufferEach virtual memory reference can cause two physical memory accessesOne to fetch the page tableOne to fetch the dataTo overcome this problem a high-speed cache is set up for page table entriesCalled a Translation Lookaside Buffer (TLB)
اسلاید 20: 20Translation Lookaside BufferContains page table entries that have been most recently used
اسلاید 21: 21Translation Lookaside BufferGiven a virtual address, processor examines the TLBIf page table entry is present (TLB hit), the frame number is retrieved and the real address is formedIf page table entry is not found in the TLB (TLB miss), the page number is used to index the process page table
اسلاید 22: 22Translation Lookaside BufferFirst checks if page is already in main memory If not in main memory a page fault is issuedThe TLB is updated to include the new page entry
اسلاید 23: 23
اسلاید 24: 24
اسلاید 25: 25
اسلاید 26: 26
اسلاید 27: 27Page SizeSmaller page size, less amount of internal fragmentationSmaller page size, more pages required per processMore pages per process means larger page tablesLarger page tables means large portion of page tables in virtual memorySecondary memory is designed to efficiently transfer large blocks of data so a large page size is better
اسلاید 28: 28Page SizeSmall page size, large number of pages will be found in main memoryAs time goes on during execution, the pages in memory will all contain portions of the process near recent references. Page faults low.Increased page size causes pages to contain locations further from any recent reference. Page faults rise.
اسلاید 29: 29
اسلاید 30: 30Example Page Sizes
اسلاید 31: 31SegmentationMay be unequal, dynamic sizeSimplifies handling of growing data structuresAllows programs to be altered and recompiled independentlyLends itself to sharing data among processesLends itself to protection
اسلاید 32: 32Segment TablesCorresponding segment in main memoryEach entry contains the length of the segmentA bit is needed to determine if segment is already in main memoryAnother bit is needed to determine if the segment has been modified since it was loaded in main memory
اسلاید 33: 33Segment Table Entries
اسلاید 34: 34
اسلاید 35: 35Combined Paging and SegmentationPaging is transparent to the programmerSegmentation is visible to the programmerEach segment is broken into fixed-size pages
اسلاید 36: 36Combined Segmentation and Paging
اسلاید 37: 37
اسلاید 38: 38
اسلاید 39: 39Fetch PolicyFetch PolicyDetermines when a page should be brought into memoryDemand paging only brings pages into main memory when a reference is made to a location on the pageMany page faults when process first startedPrepaging brings in more pages than neededMore efficient to bring in pages that reside contiguously on the disk
اسلاید 40: 40Placement PolicyDetermines where in real memory a process piece is to resideImportant in a segmentation systemPaging or combined paging with segmentation hardware performs address translation
اسلاید 41: 41Replacement PolicyPlacement PolicyWhich page is replaced?Page removed should be the page least likely to be referenced in the near futureMost policies predict the future behavior on the basis of past behavior
اسلاید 42: 42Replacement PolicyFrame LockingIf frame is locked, it may not be replacedKernel of the operating systemControl structuresI/O buffersAssociate a lock bit with each frame
اسلاید 43: 43Basic Replacement AlgorithmsOptimal policySelects for replacement that page for which the time to the next reference is the longestImpossible to have perfect knowledge of future events
اسلاید 44: 44Basic Replacement AlgorithmsLeast Recently Used (LRU)Replaces the page that has not been referenced for the longest timeBy the principle of locality, this should be the page least likely to be referenced in the near futureEach page could be tagged with the time of last reference. This would require a great deal of overhead.
اسلاید 45: 45Basic Replacement AlgorithmsFirst-in, first-out (FIFO)Treats page frames allocated to a process as a circular bufferPages are removed in round-robin styleSimplest replacement policy to implementPage that has been in memory the longest is replacedThese pages may be needed again very soon
اسلاید 46: 46Basic Replacement AlgorithmsClock PolicyAdditional bit called a use bitWhen a page is first loaded in memory, the use bit is set to 1When the page is referenced, the use bit is set to 1When it is time to replace a page, the first frame encountered with the use bit set to 0 is replaced.During the search for replacement, each use bit set to 1 is changed to 0
اسلاید 47: 47
اسلاید 48: 48
اسلاید 49: 49
اسلاید 50: 50Comparison of Placement Algorithms
اسلاید 51: 51
اسلاید 52: 52Basic Replacement AlgorithmsPage BufferingReplaced page is added to one of two listsFree page list if page has not been modifiedModified page list
اسلاید 53: 53Resident Set SizeFixed-allocationGives a process a fixed number of pages within which to executeWhen a page fault occurs, one of the pages of that process must be replacedVariable-allocationNumber of pages allocated to a process varies over the lifetime of the process
اسلاید 54: 54Fixed Allocation, Local ScopeDecide ahead of time the amount of allocation to give a processIf allocation is too small, there will be a high page fault rateIf allocation is too large there will be too few programs in main memory
اسلاید 55: 55Variable Allocation, Global ScopeEasiest to implementAdopted by many operating systemsOperating system keeps list of free framesFree frame is added to resident set of process when a page fault occursIf no free frame, replaces one from another process
اسلاید 56: 56Variable Allocation, Local ScopeWhen new process added, allocate number of page frames based on application type, program request, or other criteriaWhen page fault occurs, select page from among the resident set of the process that suffers the faultReevaluate allocation from time to time
اسلاید 57: 57Cleaning PolicyDemand cleaningA page is written out only when it has been selected for replacementPrecleaningPages are written out in batches
اسلاید 58: 58Cleaning PolicyBest approach uses page bufferingReplaced pages are placed in two listsModified and unmodifiedPages in the modified list are periodically written out in batchesPages in the unmodified list are either reclaimed if referenced again or lost when its frame is assigned to another page
اسلاید 59: 59Load ControlDetermines the number of processes that will be resident in main memoryToo few processes, many occasions when all processes will be blocked and much time will be spent in swappingToo many processes will lead to thrashing
اسلاید 60: 60Multiprogramming
اسلاید 61: 61Process SuspensionLowest priority processFaulting processThis process does not have its working set in main memory so it will be blocked anywayLast process activatedThis process is least likely to have its working set resident
اسلاید 62: 62Process SuspensionProcess with smallest resident setThis process requires the least future effort to reloadLargest processObtains the most free frames Process with the largest remaining execution window
اسلاید 63: 63UNIX and Solaris Memory ManagementPaging SystemPage tableDisk block descriptorPage frame data tableSwap-use table
اسلاید 64: 64
اسلاید 65: 65
اسلاید 66: 66
اسلاید 67: 67UNIX and Solaris Memory ManagementPage ReplacementRefinement of the clock policy
اسلاید 68: 68Kernel Memory AllocatorLazy buddy system
اسلاید 69: 69Linux Memory ManagementPage directoryPage middle directoryPage table
اسلاید 70: 70
اسلاید 71: 71
اسلاید 72: 72Windows Memory ManagementPagingAvailableReservedCommitted
نقد و بررسی ها
هیچ نظری برای این پاورپوینت نوشته نشده است.