• edited by
59,168 views
159 159 votes

A computer uses $46\text{-bit}$ virtual address, $32\text{-bit}$ physical address, and a three–level paged page table organization. The page table base register stores the base address of the first-level table $\text{(T1)}$, which occupies exactly one page. Each entry of $\text{T1}$ stores the base address of a page of the second-level table $\text{(T2)}$. Each entry of $\text{T2}$ stores the base address of a page of the third-level table $\text{(T3)}.$ Each entry of $\text{T3}$ stores a page table entry $\text{(PTE)}.$ The $\text{PTE}$ is $32$ bits in size. The processor used in the computer has a $1\;\textsf{MB}\; 16$ way set associative virtually indexed physically tagged cache. The cache block size is $64$ bytes.

What is the size of a page in $\textsf{KB}$ in this computer?

  1. $2$
  2. $4$
  3. $8$
  4. $16$

7 Answers

Best answer
241 241 votes
Let the page size be $x$.

Since virtual address is $46$ bits, we have total number of pages $ = \frac{2^{46}}{x}$

We should have an entry for each page in last level page table which here is $T3$. So,
Number of entries in $T3$ (sum of entries across all possible $T3$ tables) $ = \frac{2^{46}}{x}$

Each entry takes $32$ bits $= 4$ bytes. So, total size of $T3$ tables $= \frac{2^{46}}{x} \times 4 = \frac{2^{48}}{x}$ bytes

Now, no. of $T3$ tables will be Total size of $T3$ tables/page table size and for each of these page tables, we must have a $T2$ entry. Taking $T3$ size as page size, no. of entries across all $T2$ tables $= \frac{\frac{2^{48}}{x}}{x} = \frac{2^{48}}{x^2} $

Now, no. of $T2$ tables (assuming $T2$ size as page size) = $\frac{2^{48}}{x^2}  \times 4$ bytes = $\frac{\frac{2^{50}}{x^2}} {x}  = \frac{2^{50}}{x^3}$.

Now, for each of these page table, we must have an entry in $T1$.
So, number of entries in $T1$ $=\frac{2^{50}}{x^3}$

And size of $T1$ $=\frac{2^{50}}{x^3} \times 4  =\frac{2^{52}}{x^3} $

Given in question, size of $T1$ is page size which we took as $x$. So,
$x = \frac{2^{52}}{x^3}$
$\implies x^4 =2^{52}$
$\implies x = 2^{13}$
$\implies x = 8\;\textsf{KB}$

Correct Answer: $C$
• edited by
319 319 votes

I have already mentioned this in a comment, in case anyone missed it.

Alternate method to find page size:

It is known that all levels of the page table must be completely full, except for the outermost level. The outermost page table may occupy a full page or less. However, in this question, it is explicitly mentioned that the outermost page table occupies a full page.

Let the page size be \( 2^p \) Bytes.

Given:
Page Table Entry (PTE) size = 32 bits = 4 Bytes = \( 2^2 \) Bytes.

Number of entries in any page of any page table is:

\[ \frac{\text{Page size}}{\text{PTE size}} = \frac{2^p}{2^2} = 2^{p - 2} \]

Hence, the logical address is split as:

\( p - 2 \)\( p - 2 \)\( p - 2 \)\( p \)

Given that the logical address space is 46 bits, we get:

\[ (p - 2) + (p - 2) + (p - 2) + p = 46 \] \[ \Rightarrow 4p - 6 = 46 \Rightarrow p = 13 \]

Therefore, the page size is:

\[ 2^{13} \text{ Bytes} = \boxed{8\ \text{KB}} \]
• edited by
26 26 votes

I feel this is simpler approach,

(C)

Let size of the page be x.

Total number of entries in T1 = x/4.

Total number of entries in T2 = x/4 * x/4

Total number of entries in T3 = x/4 * x/4 * x/4 which is also total number of pages

Total virtual address space = (x/4 * x/4 * x/4) * x = 2^46

∴ x4/2^6 = 2^46

∴ x = 2^13 bytes = 8Kb

 
• edited by
6 6 votes

let page size is P bytes. Page table entry size  = 4byte.

PA = 32 bits   VA = 46 bits

it is given that outermost page table is completly full.

∴ no. of entries in outer page table = (P/4).

∴ total no. of entries in 2nd level page table = (P/4)*(P/4)

∴ total no. of entries in  3rd level page table = (P/4)*(P/4)*(P/4)

virtual address space = total pages * size of each pge

                                    = (P/4)*(P/4)*(P/4) * P 

                                     = P4 /64

    246 = P4 /64

  P  = 213 B

      = 8KB

3 3 votes

Let page size  = 2p   bytes (p is page offset )

now, number of page entries in 1st level = 2p / 4 = 2p-2 bytes (as it uses 32 bit = 4 byte Physical address) 

Similarly in 2nd level -> 22(p-2) and considering 3rd level it would be 23(p-2) 

so, 23(p-2) * 2p = 46, p=13 

so page size = 213 byte = 8KB (c)

Number of pages in cache = 1MB/8KB = 128 pages 

Number of set in cache = 128/16 = 8 

For any two synonym to map with same set they should be colored with

same color of that respective set. So minimum we need 8 colors for this mapping. (C)

1 flag:
✌ Edit necessary (js__)
3 3 votes

We know from the question that a page table can retain in a single page.

Assume size of page is 2x .

No. of entries that can be cotained in a page is 2x/4 that is 2x-2. So at a particular level no. of entries can be addressable in x-2 bits.

So,

We can consider bit distribution of virutal address as bit required for 1st level + 2nd level + 3rd level + page 

That is                       x-2 + x-2 + x-2 + x = 46

Solving this we get x = 13

That is       213 byte size of a page.

Answer:
Position:
Show:

Related questions

93 93 votes
9 answers 9 answers
44.7k
44.7k views
go_editor asked Apr 21, 2016
44,676 views
A computer uses $46\text{-bit}$ virtual address, $32\text{-bit}$ physical address, and a three–level paged page table organization. The page table base register stores th...
190 190 votes
11 answers 11 answers
49.2k
49.2k views
Arjun asked Sep 24, 2014
49,184 views
A certain computation generates two arrays a and b such that $a[i] = f(i)$ for $0 \leq i < n$ and $b[i] = g(a[i])$ for $0 \leq i < n$. Suppose this computation is decompo...
99 99 votes
10 answers 10 answers
39.4k
39.4k views
Arjun asked Sep 24, 2014
39,446 views
A shared variable $x$, initialized to zero, is operated on by four concurrent processes $W, X, Y, Z$ as follows. Each of the processes $W$ and $X$ reads $x$ from memory, ...
117 117 votes
12 answers 12 answers
50.7k
50.7k views
Arjun asked Sep 24, 2014
50,732 views
Consider a hard disk with $16$ recording surfaces $(0-15)$ having $16384$ cylinders $(0-16383)$ and each cylinder contains $64$ sectors $(0-63)$. Data storage capacity in...