title: Multilevel Paging Operating System
body: <p>I had this problem in an exam today:</p>
  
  <p>Suppose you have a computer system with a 38-bit logical address, page size of 16K, and 4 bytes per page table entry.</p>
  
  <ol>
  <li><p>How many pages are there in the logical address space? Suppose we use two level paging and each page table can fit completely in a frame.</p></li>
  <li><p>For the above mentioned system, give the breakup of logical address bits clearly indicating number of offset bits, page table index bits and page directory index bits.</p></li>
  <li><p>Suppose we have a 32MB program such that the entire program and all necessary page tables (using two level paging) are in memory. How much memory (in number of frames) is used by the program, including its page tables?</p></li>
  </ol>
  
  <p>How do I go about solving such a problem? Until now I would have thought page size = frame size, but that won't happen in this case.</p>
  
  <hr>
  
  <p>Here is what I think:</p>
  
  <p>Since the page size is 16K, my offset will be 17 bits (<code>2^17 = 16K</code>). Now how do I divide the rest of the bits, and what will be the frame size? Do I divide the rest of the bits in half?</p>