operatingsystem《操作系统》ch08-mainmemory.ppt
《operatingsystem《操作系统》ch08-mainmemory.ppt》由会员分享,可在线阅读,更多相关《operatingsystem《操作系统》ch08-mainmemory.ppt(57页珍藏版)》请在三一办公上搜索。
1、Chapter 8:Main Memory,Chapter Objectives,To provide a detailed description of various ways of organizing memory hardwareTo discuss various memory-management techniques,including paging and segmentationTo provide a detailed description of the Intel Pentium,which supports both pure segmentation and se
2、gmentation with paging,Content Overview,BackgroundSwapping Contiguous Memory AllocationPagingStructure of the Page TableSegmentation*Example:The Intel Pentium,8.1 Background,Program must be brought(from disk)into memory and placed within a process for it to be runMain memory and registers are only s
3、torage CPU can access directlyRegister access in one CPU clock(or less)Main memory can take many cyclesCache sits between main memory and CPU registersProtection of memory required to ensure correct operation,Base and Limit Registers,A pair of base and limit registers define the logical address spac
4、e,HW address protection with base and limit registers,Binding of Instructions and Data to Memory,Address binding of instructions and data to memory addresses can happen at three different stagesCompile time:If memory location known a priori,absolute code can be generated;must recompile code if start
5、ing location changesLoad time:Must generate relocatable code if memory location is not known at compile timeExecution time:Binding delayed until run time if the process can be moved during its execution from one memory segment to another.Need hardware support for address maps(e.g.,base and limit reg
6、isters),Multistep Processing of a User Program,Logical vs.Physical Address Space,The concept of a logical address space that is bound to a separate physical address space is central to proper memory managementLogical address generated by the CPU;also referred to as virtual addressPhysical address ad
7、dress seen by the memory unitLogical and physical addresses are the same in compile-time and load-time address-binding schemes;Logical(virtual)and physical addresses differ in execution-time address-binding scheme,Memory-Management Unit(MMU),Hardware device that maps virtual to physical addressIn MM
8、U scheme,the value in the relocation register is added to every address generated by a user process at the time it is sent to memoryThe user program deals with logical addresses;it never sees the real physical addresses,Dynamic relocation using a relocation register,Dynamic Loading,Routine is not lo
9、aded until it is calledBetter memory-space utilization;unused routine is never loadedUseful when large amounts of code are needed to handle infrequently occurring casesNo special support from the operating system is required implemented through program design,Dynamic Linking,Linking postponed until
10、execution timeSmall piece of code,stub,used to locate the appropriate memory-resident library routineStub replaces itself with the address of the routine,and executes the routineOperating system needed to check if routine is in processes memory addressDynamic linking is particularly useful for libra
11、riesSystem also known as shared libraries,8.2 Swapping,A process can be swapped temporarily out of memory to a backing store,and then brought back into memory for continued executionBacking store fast disk large enough to accommodate copies of all memory images for all users;must provide direct acce
12、ss to these memory imagesRoll out,roll in swapping variant used for priority-based scheduling algorithms;lower-priority process is swapped out so higher-priority process can be loaded and executedMajor part of swap time is transfer time;total transfer time is directly proportional to the amount of m
13、emory swappedModified versions of swapping are found on many systems(i.e.,UNIX,Linux,and Windows)System maintains a ready queue of ready-to-run processes which have memory images on disk,Schematic View of Swapping,8.3 Contiguous Allocation,Main memory usually into two partitions:Resident operating s
14、ystem,usually held in low memory with interrupt vectorUser processes then held in high memoryRelocation registers used to protect user processes from each other,and from changing operating-system code and dataBase register contains value of smallest physical addressLimit register contains range of l
15、ogical addresses each logical address must be less than the limit register MMU maps logical address dynamically,Contiguous Allocation(Cont.),Multiple-partition allocationHole block of available memory;holes of various size are scattered throughout memoryWhen a process arrives,it is allocated memory
16、from a hole large enough to accommodate itOperating system maintains information about:a)allocated partitions b)free partitions(hole),OS,process 5,process 8,process 2,OS,process 5,process 2,OS,process 5,process 2,OS,process 5,process 9,process 2,process 9,process 10,Dynamic Storage-Allocation Proble
17、m,First-fit:Allocate the first hole that is big enoughBest-fit:Allocate the smallest hole that is big enough;must search entire list,unless ordered by size Produces the smallest leftover holeWorst-fit:Allocate the largest hole;must also search entire list Produces the largest leftover hole,How to sa
18、tisfy a request of size n from a list of free holes,First-fit and best-fit better than worst-fit in terms of speed and storage utilization,Fragmentation,External Fragmentation total memory space exists to satisfy a request,but it is not contiguousInternal Fragmentation allocated memory may be slight
19、ly larger than requested memory;this size difference is memory internal to a partition,but not being usedReduce external fragmentation by compactionShuffle memory contents to place all free memory together in one large blockCompaction is possible only if relocation is dynamic,and is done at executio
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 操作系统 operatingsystem ch08 mainmemory

链接地址:https://www.31ppt.com/p-6513285.html