Lecture6-MemoryManagement

上传人:飞*** 文档编号:2662777 上传时间:2017-07-26 格式:PPT 页数:69 大小:1.05MB
返回 下载 相关 举报
Lecture6-MemoryManagement_第1页
第1页 / 共69页
Lecture6-MemoryManagement_第2页
第2页 / 共69页
Lecture6-MemoryManagement_第3页
第3页 / 共69页
Lecture6-MemoryManagement_第4页
第4页 / 共69页
Lecture6-MemoryManagement_第5页
第5页 / 共69页
点击查看更多>>
资源描述

《Lecture6-MemoryManagement》由会员分享,可在线阅读,更多相关《Lecture6-MemoryManagement(69页珍藏版)》请在金锄头文库上搜索。

1、1,Memory Management,BTT205 Operating System,Lecture - 6,Outline,Memory ManagementRequirements of Memory ManagementMemory PartitioningBasic blocks of memory management,Memory management,The task of subdivision is carried out dynamically by the OS and this is known as Memory Management.,Memory Managem

2、ent Requirements,RelocationProtectionSharingLogical organisationPhysical organisation,Memory Management Requirements,RelocationThe programmer does not know where the program will be placed in memory when it is executed, Memory references must be translated to the actual physical memory addressWhen p

3、rogram loaded into memory the actual (absolute) memory locations are determinedA process may occupy different partitions which means different absolute memory locations during execution,6,ProtectionProtect each process against unwanted memory interference (accidental or deliberate)Implement by OS pe

4、rforming range check on each memory access for a processSharingMay want to share code and data between processesOS (and only OS) can provide this by overlapping memory space for 2 or more processes.,Memory Management Requirements,Memory Management Requirements,Memory Management Requirements,Addressi

5、ngOS will need to know the location of Process Control Information and of the execution stack, as well as the entry point. Branch Instruction:Data Reference Instruction:,Memory Management Requirements,ProtectionProcesses should not be able to reference memory locations in another process without per

6、mission.Impossible to check absolute addresses at compile timeMust be checked at run timeSharingAllow several processes to access the same portion of memoryBetter to allow each process access to the same copy of the program rather than have their own separate copy,Memory management Requirements,Logi

7、cal OrganizationMemory is organized linearlyPrograms are written in modulesDifferent degrees of protection given to modules (read-only, execute-only)Share modules among processesSegmentation helps herePhysical OrganizationCannot leave the programmer with the responsibility to manage memoryMemory ava

8、ilable for a program plus its data may be insufficientProgrammer does not know how much space will be available,11,Partition,Division of physical memory into fixed sized regions. (Allows addresses spaces to be distinct = one user cant muck with another user, or the system.)The number of partitions d

9、etermines level of multiprogramming. Partition is given to a process when its scheduled.Protection around each partition determined by bounds ( upper, lower ) base / limit.These limits are applied in hardware.,Partitioning,Early method of managing memoryWill clarify the later discussion of virtual m

10、emory if we look first at partitioningTypes of PartitioningFixed PartitioningDynamic Partitioning,Fixed Partitioning,Equal-size partitionsOperating system can swap a process out of a partition,Fixed Partitioning Problems,A program may not fit in a partition. The programmer must design the program wi

11、th overlaysMain memory use is inefficient. Any program, no matter how small, occupies an entire partition.This is results in internal fragmentation.,15,Fragmentation Problem,Internal fragmentationUnused memory within a unit of allocationExternal fragmentationUnused memory between units of allocation

12、,0,MAX,ProgramRs PAS,Program,Qs,PAS,Fragmentation Problem,Fixed-sized partitions (either equal or un-equal sized) we have the problem of fragmentation. Internal fragmentation A process has free memory within its allocation but cannot use it.Stack segment of a program needs to grow. There is free mem

13、ory in the data segment but it cannot be used to grow the stack. The general problem is that you have free memory but cant use it. You also have the problem that a process can only as large as the largest partition. In particular, jobs cant be larger than the size of physical memory.,16,Fragmentatio

14、n Problem,External fragmentation Cant use a partition even though its empty. For example, P needs a partition with 5 memory units. Q is using the only partition of that size. However, if partition 2 could be combined with Rs fragment, then wed have a 5 unit partition.(Assume partitions must start at

15、 addresses that are multiples of some constant and hence they cannot just start anywhere.),17,Solution Unequal Size Partitions,Lessens both problems but doesnt solve completelyPrograms up to 16M can be accommodated without overlaySmaller programs can be placed in smaller partitions, reducing interna

16、l fragmentation,Placement Algorithm,Equal-sizePlacement is trivial (no options)Unequal-sizeCan assign each process to the smallest partition within which it will fitQueue for each partitionProcesses are assigned in such a way as to minimize wasted memory within a partition,Remaining Problems with Fixed Partitions,The number of active processes is limited by the system I.E limited by the pre-determined number of partitionsA large number of very small process will not use the space efficientlyIn either fixed or variable length partition methods,

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > IT计算机/网络 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号