0
votes

consider the following page table for an executing program

Virtual page #: 0 1 2 3 4 5
Page Frame #: 8 3 9 x 0 1

The program generates 32 bit virtual addresses and consists of pages of 512 words each. The program generates the following virtual address 1749. What physical address is it mapped to

1

1 Answers

2
votes

You first work out what virtual page that address belongs to, the offset from that virtual page, and then use your page table to look up the equivalent physical address.

Assuming the virtual address space is linear with no holes, the conversion from address to page can be done by dividing by the page size (512 in your case). The offset within the page is the difference between the virtual address and the virtual page start address.

In the example above, the virtual page would be page 3, with an offset of 213.

You then look up the physical page that corresponds to virtual page 3 in your page table. Here, it is x. So the physical address would be (physical address of the start of page x + offset into the page), i.e. (start of page X)+213.

The start of page X, again assuming linear mapping with no holes would be (pages size * x).

So the physical address would be:

(page_size * x) + offset

Here:

(512 * x) + 213