title: Calculating size of the page table
body: <p>Consider a machine with 64 MB physical memory and a 32-bit virtual address space. If the page size is 4 KB, what is the approximate size of the page table ?</p>
  
  <p>My Solution:</p>
  
  <pre><code>Number of pages in physical memory = (size of physical memory)/(size of page)
                                     = 64 * 2^10 / 4
                                     = 2^14
  Number of pages in virtual memory = (size of virtual memory)/(size of page)
             size of virtual memory = 2^32 bits
                                    = 2^29 bytes
                                    = 2^19 kBytes
  Number of pages in virtual memory = 2^19/4 = 2^17
  =&gt; Number of entries in page table = 2^17
  Size of each entry = 17+14 =31 bits
  Size of page table = 31 * 2^17 bits 
                     = 31 * 2^14 bytes
                     = 31 * 2^4 KB
                     = 31*16
                     = 496 KB
  </code></pre>
  
  <p>But the answer is 8 MB. Why?</p>