The thorough solution:
The virtual address looks like this:
+-------------+------------+--------+ + table index + page index + offset + +-------------+------------+--------+
where:
- table index is the index length of an entry in the page table directory. I'll call it $i_t$.
- page index is the index length of an entry in the page table. I'll call it $i_p$.
So we have such an equation now: $$ i_t+i_p+o=32 $$ where $o$ represents bits that we need for offset.
So we have such an equation now: $$ i_t+i_p+o=32 $$ where $o$ represents bits that we need for offset.
From the decoded addresses we know that offset cannot be greater than $14$, so: $$ o \leq 14 $$
We know that an entry in both page tables and page tables directories needs $i_t + b_d$ of bits where $b_d$ is the number of bits for accounting information (such as dirty bits, protection bits and so on). So, $b_d$ are accounting bits in the page table directory and $b_t$ are are accounting bits in page table.
So, if $\text{page size} = 2^\text{offset}$ then $\text{page table size} = 2^\text{offset}$ and $\text{page table directory size} = 2^\text{offset}$: $$ \begin{cases} i_t+b_d = o\\ i_s+b_t = o\\ \end{cases} $$
We can say thatSince $\text{page table size} = \text{page table directory size}$ then $i:= i_t = i_s$ and $b :=b_d=b_t$, so we end up with a system of equations like this: $$ \begin{cases} i_t+b_d = o\\ i_s+b_t = o\\ i_t+i_p+o=32 \end{cases} $$ $$ o-b_d+o-b_t+o=32\\ $$ and finally because of $b :=b_d=b_t$: $$ 3o-2b=32\\ $$
Now we will test different values of $o$ (I'll not test odd $o$'s because $o$ must be dividable by $2$):
- when $o=14$: $$ 42-32=2b=10\\ \implies b=5\\ \implies i = 14-5=11\\ \implies i_t+i_s+o=11+11+14=36 \neq 32 $$
- when $o=12$: $$ 36-32=2b=4\\ \implies b=2\\ \implies i = 12-2=10\\ \implies i_t+i_s+o=10+10+12=32 = 32 $$ which seems to be the answer. Let's just make sure there are no other possibilities.
- when $o=10$: $$ 30-32=2b=-2\\ \implies b=-1\\ $$ which cannot be true - you obviously cannot have a negative number of bits.
Therefore, the size of a page is equal $2^o=2^{12}$.