find the size of the page table.

sir here in the first page table we gave 6 bits for the pointers this means we have 2^6 entries each in 2^3 pages here each page size is fixed and each page is 1024 bytes and hence though we use 64 entries out of the possible 256 entries (2^8) the remaining entries are vacant but we should consider them also in calculation so the first level page table will occupy 8*1024 and then the other two levels occupy 102 each hence total space is 8*1024 + 2*1024 the solution of this image is not considering the entire page size but only the entries that are useful are being considered ..what my doubt is we have to consider the entire page size even when we have decised to use only few of the page capacity and the remaining entries are empty please clarify

3Comments
shivani @shivani1234
17 Aug 2017 09:27 am
  • assuming you understood how pages are divided i.e. howmultilevel paging is done in this question 
  • here, total no. of pages = 232 / 210 = 222
  • first level page table can hold 210/2 = 256 entries[which are pointing to 256 pages next]
  • secovel level page table can hold 210/2 = 256 entries[which are pointing to 256 pages next]
  • similarly, 3rd level page table can hold 210/2 = 256 entries at max , but we need just 64 entries
    [which are pointing to 64 pages next]
  • so , for storing first level page entries we need 1 page
  • for storing second level page entries we need 1page
  • for storing third level page entries we need 1page
  • and we need 1 page for base page table register
  • so, in all we need 4 pages
  • thus , size of memory required here is size of 4 pages i.e. 4 *1KB= 4096 B

 

shivani @shivani1234
17 Aug 2017 09:34 am
  • now, coming to your doubt  "we use 64 entries out of the possible 256 entries (2^8) the remaining entries are vacant "  
  • this is page wastage technically internal fragmentation. whether you use 1 entry or 255 or 256 entry entire page is required to store entries.
  • "so the first level page table will occupy 8*1024 ....." is wrong as page size = no. of entries * size of page table entry, you taken no. of bits to represent pages which is wrong.
venkat @saikumartadi
17 Aug 2017 05:08 pm

when a page size is 1024 bytes and we are just using 64 entries per page instead of 256 then how come u say that my answer is wrong !!! 

there are 2^19/2^10pages in the process and then we need 2^9pointers to it and each pointer occupies 4 bytes of space and hence total size of the first level(inner) page table is 2^11 bytes and hence it will not fit in a page and we can store at max 2^10/4 =2^8 records per page but in the picture i mentioned we should just use 6 bits(check the link) hence we are just using 64 pointers per  page instead of 256  so for 2^9/2^6 we get 8 pages required in this type of split where we give 6 bits to the inner most page table instead if u normally do it we just need 2 pages to have 2^9 pointers if we use all the 2^8 pointers of a page and then as we have two pages we need two pointers from the second level page table for that we have to use a page and we reserved 8 bits for second level page table (in the image) and to point this page we need one page from which we use just one pointer hence we use 1 page from outermost page table 1 from 2nd level which makes 2*1024 bytes and then 8 pages from inner most pagetable which is 8*1024 just check this out i think i am not wrong