如何计算16位地址指针中的页帧

Con*_*ury 2 paging operating-system

我正在查看一些操作系统的试卷,我遇到了一个我根本想不通的问题.内存管理方案是分页 这是一个问题:

An operating system that runs on a CPU with a 16 bit address pointer employs a paging memory management scheme with a page size of 1024 bytes.
a)  At most how many frames can physical memory contain?
b)  Indicate which bits in an address pointer are used for page and offset. 
c)  A process image of size 3.5K resides in memory. You are given the page table of this process in Figure 1 below. What physical address will the hexadecimal logical address 0x0FCE result in? Show your calculations.
d)  How much internal fragmentation does this process produce?

Page    Frame
0             4
1             8
2             9
3             6
Figure 1 Process Page Table
Run Code Online (Sandbox Code Playgroud)

任何人都可以帮我吗?

Ben*_*oit 6

  1. 16位地址总线允许访问2^16 = 64kB物理内存.由于在这个系统上你有大小的页面1024B = 2^10,你的内存属于2^16 / 2^10 = 2^6物理帧.

  2. 鉴于以前的结果,对于页面1024 = 2^10 bytes,您需要10位来访问页面的任何字节.因此,6个高位用于从页表中获取页面索引(基本上是作业中的图1),并且10个低位用于在该页面中进行偏移.

  3. 逻辑地址0xfce位于第四页,因为六个高位是000011b = 3 = 4th page = 0x0c00-0x0fff.给定页表并假设物理内存是顺序的,第四页映射到第六个物理帧,从第一个开始1024 * 6 = 0x1800 = 0001100000000000b.页面的六个高位是000110b,我们在其中添加了前一个答案产生的10位偏移:000110b << 10 | 0x3ce = 0x1bce.

  4. 由于帧分配不是顺序的(4,6,8,9),因此第4页和第6页之间的空洞(即1024B)以及第6页和第8页之间的空洞(即再次为1024B)会导致物理内存碎片.

希望这有帮助.