




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、第七讲第七讲 存储器管理存储器管理中国科学技术大学计算机系中国科学技术大学计算机系 陈香兰陈香兰2013fall内容提要内容提要v存储器的层次结构v程序执行的基础知识、程序的装入和链接v连续分配存储管理方式v分页存储管理方式v分段存储管理v段页式存储管理存储器的层次结构存储器的层次结构v存储器是计算机系统的重要组成部分容量、价格和速度之间的矛盾内存、外存;易失性和永久性内存,是稀缺资源v在现代计算机系统中,存储通常采用层次结构来组织多级存储器结构主存与寄存器高速缓存和磁盘缓存多级存储器结构多级存储器结构vstorage systems in a computer system can be o
2、rganized in a hierarchyspeed, access timecost per bitvolatility主存主存 vs. 寄存器寄存器vsame: access directly for cpuregister namememory addressvdifferent: access speedregister, one cycle of the cpu clockmemory, many cycles (2 or more)vdisadvantage: cpu needs to stall frequently & this is intolerablevrem
3、edycache高级缓冲技术高级缓冲技术cachingvcachingcopying information into faster storage systemwhen accessing, first check in the cache, iflin: use it directlylnot in: get from upper storage system, and leave a copy in the cachevusing of cachingregisters provide a high-speed cache for main memoryinstruction cache
4、 & data cachemain memory can be viewed as a fast cache for secondary storagemagnetic disks 磁盘磁盘v transfer time 传输时间tt data size * transfer ratetransfer rate (n m/s)-1 ( n byte/us )-1 1/n us/bytev positioning time 定位时间seek time 寻道ltsrotational latency 旋转延迟ltrtp ts +tr m msv tt vs. tpplease store
5、data closely 内容提要内容提要v存储器的层次结构v程序执行的基础知识、程序的装入和链接v连续分配存储管理方式v分页存储管理方式v分段存储管理v段页式存储管理程序执行的基础知识程序执行的基础知识vvon neumann architecture 冯诺依曼体系结构(图)program must be brought into memorymain memory is usually too smallvprocessprogram must be placed within a process for it to be executed作业池user programslwhere to
6、 place the programlseveral steps(图)地址的类型地址的类型vabsolute address 绝对地址address seen by the memory unitphysical address 物理地址vrelative address 相对地址linear address 线性地址vlogical address 逻辑地址generated by the cpuvirtual address 虚拟地址vwhen can the absolute address can be decided?address binding 地址的绑定地址的绑定address
7、 binding 地址绑定地址绑定, the binding of instructions and data to memory, 可以在三种三种时刻进行v compile time if memory location known a priori, absolute code can be generated; must recompile code if starting location changes.v load time must generate relocatable code if memory location is not known at compile time.
8、v execution 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 registers)逻辑地址空间和物理地址空间逻辑地址空间和物理地址空间v logical address space 逻辑地址空间 the set of all logical addresses genera
9、ted by a programv physical address space 物理地址空间 the set of all physical addresses corresponding to theses logical addresses v logical = physical compile-time & load-time address-bindingv logical (virtual) != physical addresses execution-time address-binding mmu (hardware device)memory-management
10、 unit (mmu)v hardware device, 逻辑地址 物理地址v relocation register 重定位寄存器 added to every address generated by a user process at the time it is sent to memory e.g. ms-dos on 80 x86v user program deals with logical addresses, it never sees the real physical addresses.是否需要将进程的所有代码和数据一次性装入?是否需要将进程的所有代码和数据一次性装
11、入?vshall we put the entire program & data of a process in physical memory before the process can be executed?vfor better memory space utilizationdynamic loadingdynamic linkingoverlaysswapping程序的装入程序的装入v绝对装入方式v可重定位装入方式v动态运行时装入方式绝对装入方式绝对装入方式v编译时,产生absolute code,即使用绝对地址的代码v装入时,必须装入到指定的地址v无需对程序和数据的地
12、址进行修改v适用于单道系统可重定位装入方式可重定位装入方式v大多数情况下,不能预知装入地址,只能在装入时确定v编译时,产生可重定位代码,即使用相对地址的代码v装入时,必须重定位通常把在装入时对目标程序中指令和数据的修改过程称为重定位。v由于地址变换是在装入时一次性完成的,以后不再改变,故称为静态重定位v可用于多道系统动态运行时重定位动态运行时重定位v有时候,程序会在内存中移动位置例如对换v需要能支持在运行过程中动态改变程序在内存中的位置v方法:推迟重定位时机即从相对地址到绝对地址的转换推迟到程序真正执行时才进行v因此,装入内存中的代码和数据的地址仍然是相对地址v需要重定位寄存器的支持动态运行时
13、装入方式动态运行时装入方式v根据程序运行的局部性,让程序及其数据在需要时才被装入vbetter memory-space utilization; unused routine is never loaded.vuseful when large amounts of code are needed to handle infrequently occurring caseserror routine vno special support from os is required implemented through program designdue to the users overla
14、ys 覆盖技术覆盖技术vkeep in memory only those are needed at any given time.vneeded when process is larger than amount of memory allocated to it.vimplemented by user, no special support needed from os, programming design of overlay structure is complex程序的链接程序的链接v多个源程序编译多个目标模块;库。需要链接成可装入模块v根据链接时间的不同静态链接方式:装入前很早就链接装入时动态链接:边装入,边链接运行时动态链接:运行时才链接静态链接方式静态链接方式v静态链接方式:在程序运行之前,先将各目标模块以及它们所需要的库函数,链接成一个完整的装配模块,以后不再拆开。各目标模块内:相对地址存在目标模块之间的调用关系外部调用符号v要解决的问题:修改相对地址:多个相对地址空间一个统一的相对地址空间变换外部调用符号装入时动态链接装入时动态链接v在装入时,根据外部模块调
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 第一次全国高考数学试卷
- 肛肠护理课件
- 肉类罐头加工技术
- 2025至2030船用交流发电机和电动机行业市场深度研究与战略咨询分析报告
- 2025至2030畜产品产业市场深度调研及发展趋势与发展趋势分析与未来投资战略咨询研究报告
- 江西赣南科技学院招聘考试真题2024
- 2024年四川机电职业技术学院辅导员考试真题
- 福清高考学生数学试卷
- 东莞市二模数学试卷
- 阜阳一中强基数学试卷
- 医用耗材管控中的难点及对策研究
- 2024届杭州市滨江区小升初考试数学试卷含解析
- 羽毛球教案18课时完整版
- JT-T-1240-2019城市公共汽电车车辆专用安全设施技术要求
- 国外激励研究现状分析报告
- GB/T 4074.4-2024绕组线试验方法第4部分:化学性能
- MH-T 6107-2014民用机场飞行区集水口顶盖和地井顶盖
- CJJT226-2014 城镇供水管网抢修技术规程
- 施工成品保护方案及措施
- 无人机飞行控制系统若干关键技术研究的开题报告
- 年产5万吨1,4-丁二醇的工艺流程设计
评论
0/150
提交评论