retagged ago by
3,171 views
6 votes
6 votes
Consider a $32$-bit system with $4 \mathrm{~KB}$ page size and page table entries of size $4$ bytes each. Assume $1 \mathrm{~KB}=2^{10}$ bytes. The OS uses a $2$-level page table for memory management, with the page table containing an outer page directory and an inner page table. The $\text{OS}$ allocates a page for the outer page directory upon process creation. The $\text{OS}$ uses demand paging when allocating memory for the inner page table, i.e., a page of the inner page table is allocated only if it contains at least one valid page table entry.

An active process in this system accesses $2000$ unique pages during its execution, and none of the pages are swapped out to disk. After it completes the page accesses, let $\text{X}$ denote the minimum and $\text{Y}$ denote the maximum number of pages across the two levels of the page table of the process.

The value of $\text{X+Y}$ is ___________.
retagged ago by

2 Answers

3 votes
3 votes

Given:

  • System address space $(VA)=32\:bits$
  • Page size $(PS)=4KB$
  • Total pages used by a process $(N)=2000\: pages$
  • Page table entry size $(PTE)=4B$

It is given in the question that OS allocates a page(means single page) for the outer page directory upon process creation. 

So, total number of bits needed to represent entries in outer page table $= log(PS/PTE) = log(2^{12}/2^2) = 10\:bits$

And total number of bits needed to represent entries in inner page table $=32-10-12 = 10\: bits$

For $X:$

In each inner page table we can store $2^{10}$ entries. So, minimum number of page tables$(PT)$ needed to store $2000$ pages will be $\lceil 2000/2^{10}\rceil = 2\: PT$

$\therefore X=2 + 1(for \:outer\: PT) = 3$

For $Y$:

For occupying maximum pages in 2-level page table, we need to place atleast one $PTE$ from $2000$ pages in every page of the inner page table equating to $2^{10}\: PT$.

$\therefore Y=2^{10} + 1(for \:outer\: PT) = 1025$

The value of $X+Y= 1028$

Answer:

Related questions

2 votes
2 votes
2 answers
3