991 views
2 votes
2 votes

Consider a byte addressable virtual memory system with 34-bit addresses where the first 23 bits are used as a page number, and the last 11 bits is the offset. Suppose the system using two-level paging, with first n bits (n>11) of the address used as an index into the first-level page table. Assume that a typical program uses 16MB memory. An expression in terms of n that gives the number of second level page-tables used by the typical program is given by

(I'm confused with the language used by this question) Thanks in advance

Options

  1.  224 / 2(34-n)  
  2.  2(34-n-11) x 211
  3.  224 /2(34-n-11)
  4.  2(n-11) x 211

2 Answers

Best answer
2 votes
2 votes
16 MB is program size and 2KB is frame/page size

Number of frames in Physical memory will be $\frac{2^{24}}{2^{11}}=2^{13}$

so we require $2^{13}$ entries in last level of page table

Possible breakup

12|11|11

13|10|11

14|9|11 and so on

let us take 12|11|11 so if we have only 11 bits for second level then we require $\frac{2^{13}}{2^{11}}=2^{2}$ 2nd level page table

let us take 13|10|11 so if we have only 10 bits for second level then we require $\frac{2^{13}}{2^{10}}=2^{3}$ 2nd level page table

let us take 14|9|11 so if we have only 9 bits for second level then we require $\frac{2^{13}}{2^{9}}=2^{4}$ 2nd level page table

 

so consider option 1

for 12|11|11 n=12 $\frac{2^{24}}{2^{34-12}}=2^{2}$ matches with our result

for 13|10|11 n=13 $\frac{2^{24}}{2^{34-13}}=2^{3}$ matches with our result

for 14|9|11 n=14 $\frac{2^{24}}{2^{34-14}}=2^{4}$ matches with our result

option 1 is correct
selected by
1 votes
1 votes
Consider the division |n|23-n|11|(Keep this in mind.)

The number of bits that have been used in second level page table for indexing pages of the program = 23-n

The size of the program covered by one frame of second level page table = 2^(23-n) * 2^11Bytes

The number of frames required to cover 16 MB of the program = 16MB / 2^(23-n)*2^11

=2^24/2^(34-n).

Related questions

0 votes
0 votes
1 answer
1
Markzuck asked Dec 22, 2018
1,328 views
for memory overhead in Multi level paging, for innermost table only 1 page size shall be counted na? and NOT the complete page table size?please explain the concept, than...
1 votes
1 votes
2 answers
2
royal shubham asked Dec 6, 2017
6,865 views
Paging increases context switch time how and why ???
1 votes
1 votes
0 answers
3
rahul sharma 5 asked Dec 6, 2017
584 views
Does inverted page table takes less memory to store a processes as compared to single/multilevel paging?Please explain reason also