How can I calculate a physical address from a reference number and a 2-level page table?
A system with a 2-level page table, and the contents of page table No. 1 of level 2 (p1, p2, offset) are: {(32, v), (45, i), (12, v), (5, v), (34, i)}. Suppose the frame size is 4KB; the address register is 32 bits, and the number of bits for level 2 (p2) of the address register is 10. Given a reference = 4225332, its physical address is...?
- 170292
- 215348
- 80180
- 162100
I'm not sure whether this is correct:
The frame size is 4KB so the number of bits for the offset is 2^12
. Therefore, number of bits for p1 should be 10
.
The reference number in 32-bit binary representation is: 0000 0000 0100 0000 0111 1001 0011 0100
The offset should be: 1001 0011 0100
= 2356
.
The first 10 bits of the 32-bit reference is 0000 0000 01
= 1
so p1 = 1
.
The next 10 bits are 00 0000 0111
which is 7
. But the page table above only goes up to 4 so there should be no correct answer.
Am I correct?