本文共 4051 字,大约阅读时间需要 13 分钟。
Program must be brought into memory and placed within a process for it to be run
A pair of base and limit registers define the logical address space
Address binding of instructions and data to memory addresses can happen at three different stages
Compile time: If memory location known a priori, absolute code can be generated; must recompile code if starting location changes.
Load time: Must generate relocatable code if memory location is not known at compile time.
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
Logical address–generated by the CPU; also referred to as virtual address.
Physical address–address seen by the memory unit.
Logical and physical addresses are the same in compile-time and load-time address-binding schemes
logical and physical addresses differ in execution time address-binding scheme
In this case, logical address is also referred to as virtual address. (Logical = Virtual in this course) MMU内存管理单元来决定虚拟地址到物理地址的转换 Memory-Management Unit
The user program deals with logical addresses; it never sees the real physical addresses.
Better memory-space utilization; unused routine is never loaded
Useful when large amounts of code are needed to handle infrequently occurring cases
比动态load更进一步 Both Linking and loading postponed until execution time.
节省内存,灵活性
When a routine is called, its stub is executed. The routine is loaded, the address of that routine replaces the stub, and executes the routine
Operating system needed to check if routine is in another process’ memory address
Dynamic linking is particularly useful for libraries
如何分配给不同的进程使用 如何找到进程要访问的内存地址(寻址)
Monoprogramming systems :
Multiprogramming systems:
Fixed partitions:
Memory is divided into n partitions. Partitioning can be done at the startup time and altered later on. Each partition may have a job queue. Or, all partitions share the same job queue
Variable Partitions :
Hole–block of available memory–>How to satisfy a request of size n from a list of free holes
Free memory holes between allocated ones are called external fragmentation外部碎片
memory that is allocated to a partition, but is not used, are called internal fragmentation内部碎片
外部碎片不可避免
Compaction is possible only if relocation is dynamic, and is done at execution time
compaction scheme can be expensive
AC 连续分配容易通过base和limit寄存器实现内存保护
不连续分配的一种方法
Divide physical memory into fixed-sized blocks called frames(帧)
Divide logical memory into blocks of same size called pages(页)
平均Internal fragmentation的大小是半个frame/page
Address generated by CPU is divided into:
logical–> pages
physical–>frames
TLB 快表: Hit ratio = α
Effective Access Time (EAT)
EAT = (1 + ε) α+ (2 + ε)(1 –α) = 2 + ε- α
Memory protection implemented by associating protection bit with each frame
Valid-invalid bit:
we can use a page table length register (PTLR) that stores the length of a process’s page table.–>a process cannot access the memory beyond its region
Hierarchical Page Tables 分级页表:
Break up the logical address space into multiple page tables
Answer: 8 7 9
Hashed Page Tables
Inverted Page Table
转载地址:http://zmgwi.baihongyu.com/