版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、第七章节存储器管理第七章节存储器管理内容提要内容提要v存储器的层次结构v程序执行的基础知识、程序的装入和链接v连续分配存储管理方式v分页存储管理方式v分段存储管理v段页式存储管理存储器的层次结构存储器的层次结构v存储器是计算机系统的重要组成部分容量、价格和速度之间的矛盾内存、外存;易失性和永久性内存,是稀缺资源v在现代计算机系统中,存储通常采用层次结构来组织多级存储器结构主存与寄存器高速缓存和磁盘缓存多级存储器结构多级存储器结构vStorage systems in a computer system can be organized in a hierarchySpeed, access t
2、imeCost 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 intolerablevRemedyCache高级缓冲技术高级缓冲技术cachingvCachingCop
3、ying 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 & data cacheMain memory can be vi
4、ewed 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 data closely 内容提要内容提要v存储器的层次结构v程序执行的基础
5、知识、程序的装入和链接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 place the programlseveral steps(图)地址的
6、类型地址的类型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 binding 地址绑定地址绑定, the binding of inst
7、ructions 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.v Execution time Binding delayed until
8、 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 generated by a programv Physical address spa
9、ce 物理地址空间 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 Unit (MMU)v Hardware device, 逻辑地址 物理地
10、址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.Logical addressPhysical address14346Relocation register14000+MemoryCPUMMU346Dy
11、namic relocation using a relocation register是否需要将进程的所有代码和数据一次性装入?是否需要将进程的所有代码和数据一次性装入?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可重定
12、位装入方式v动态运行时装入方式绝对装入方式绝对装入方式v编译时,产生absolute code,即使用绝对地址的代码v装入时,必须装入到指定的地址v无需对程序和数据的地址进行修改v适用于单道系统可重定位装入方式可重定位装入方式v大多数情况下,不能预知装入地址,只能在装入时确定v编译时,产生可重定位代码,即使用相对地址的代码v装入时,必须重定位通常把在装入时对目标程序中指令和数据的修改过程称为重定位。v由于地址变换是在装入时一次性完成的,以后不再改变,故称为静态重定位v可用于多道系统动态运行时重定位动态运行时重定位v有时候,程序会在内存中移动位置例如对换v需要能支持在运行过程中动态改变程序在内存
13、中的位置v方法:推迟重定位时机即从相对地址到绝对地址的转换推迟到程序真正执行时才进行v因此,装入内存中的代码和数据的地址仍然是相对地址v需要重定位寄存器的支持动态运行时装入方式动态运行时装入方式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 s
14、upport from OS is required implemented through program designDue to the users Overlays 覆盖技术覆盖技术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静态链接
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 职业健康与员工职业发展:医疗组织健康文化构建
- 菏泽2025年山东菏泽曹县教育系统引进高层次人才31人笔试历年参考题库附带答案详解
- 湘西2025年湖南湘西州龙山县事业单位招聘45人笔试历年参考题库附带答案详解
- 海口2025年海南海口市龙华区招聘幼儿园教师30人笔试历年参考题库附带答案详解
- 广州广东广州越秀区东山街道招聘辅助人员笔试历年参考题库附带答案详解
- 宿迁2025年江苏宿迁市卫生健康委员会所属事业单位招聘16人笔试历年参考题库附带答案详解
- 威海山东威海荣成市农业农村局招募特聘农技员5人笔试历年参考题库附带答案详解
- 台州浙江台州玉环市社会科学界联合会招聘编外用工人员笔试历年参考题库附带答案详解
- 南昌2025年江西南昌市东湖区廉政教育中心选调笔试历年参考题库附带答案详解
- 生产安全技术培训内容课件
- 防性侵家长会课件教学
- 北师大版《数学》七年级上册知识点总结
- 呼吸和排痰能力训练
- 低空经济赋能智慧交通新生态
- 物资管理实施细则
- 安全健康与自我管理学习通超星期末考试答案章节答案2024年
- 高贝利特低热硅酸盐水泥熟料煅烧及技术探讨
- 2024年初级经济师考试经济基础知识真题及答案
- 人教版2019高中英语选择性必修二(课文语法填空)
- GM-T 0130-2023 基于SM2算法的无证书及隐式证书公钥机制
- 2025届高考专题复习:“哲理类”诗词解题策略
评论
0/150
提交评论