We try to find the optimum page size due to two factors.
- Overhead due to page table entries.
- Overhead due to internal fragmentation.
Now if we go for,
- Small page size:
- Unused space due to internal fragmentation can be reduced.
- But this leads to process wanting more pages resulting in a larger page table.
- Larger page size:
- Efficient for IO
- Smaller page table.
- But increases the space wasted due to internal fragmentation.
To find an optimum page size we need to minimize the overhead due to page table entries and internal fragmentation.
- If the process segment size is, S
- Page table entry size is, E bytes
- And page size is, P
- The average amount of internal fragmentation = P/2
- Average number of pages per process segment = S/P
- Each page required E bytes of the page table.
- So page table size this process segment requires = ES/P
- Total overhead due to internal fragmentation and page table size = ES/P + P/2
- Now we need to minimize this.Differentiate this w.r.t page size P and equate to 0
- => -SE/P2 + 1/2 = 0
- => P = sqrt( 2*S*E )
Applying this here,
S = 32MB => 225
E = 4 B
Now, P = sqrt ( 2* 225 * 22) = 214 = 16KB