Consider virtual addressing of 32 bits Assume that the page

Consider virtual addressing of 32 bits. Assume that the page size is 4 KB. You have 4 GB of RAM. How many entries do you need in the page table? How many bits are needed to index the page table? Assume that Table 1 lists all the virtual pages of process A that are currently in physical memory. If a virtual page is not listed in Table 1, it implies that any address in that range will result a page fault and will be a miss. Translate the virtual addresses below to the physical address using Table 1 and mention which will be hit and which will cause a miss: Translate the following virtual addresses to physical address using Table 1 (if possible): 1536, 20816, 85050

Solution

How many entries do you need in the page table:

Answer 1:

Virtual addressing has 32 bit which is equivalent to 4GB Logical space (Table is shown at the end)
page size is given as 4KB

Out of 32 bits of virtual address, 12 bits will be giving physical address in the page, as 12bits is 4KB

20 bits are used to identify the page referred. Page table requires 2^20 addresses which is 1MB

You require 1MB entries in the page table.

Answer 2: Indexing page table

Indexing of a page table can be 10 bits and hence this is 2 level. Index size of 2^10 = 1KB, and then each entry 10bits or 1KB

Mapping to the physical address:

Last 12 bits provide the physical address and earlier bits provide the page number

When the page is loaded in the memory, the physical address will be as below

1536 in decimal.

in page 10 as virtual page 0 is loaded there.

336 in decimal.

however, logical page no. 101 binary or 9 decimal is not loaded as it is not seen in the table.

3130 in decimal.

The page number is 20 (binary 10100), which is physical page no. 14 as seen in the table

No. of bits

Virtual address Binary equivalent Physical address indicated by last 12 bits is as velow
1536 11000000000 11000000000

1536 in decimal.

in page 10 as virtual page 0 is loaded there.

20816 101000101010000 101010000

336 in decimal.

however, logical page no. 101 binary or 9 decimal is not loaded as it is not seen in the table.

85050 \'
10100110000111010
110000111010

3130 in decimal.

The page number is 20 (binary 10100), which is physical page no. 14 as seen in the table

 Consider virtual addressing of 32 bits. Assume that the page size is 4 KB. You have 4 GB of RAM. How many entries do you need in the page table? How many bits

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site