in Operating System retagged by
897 views
0 votes
0 votes
Suppose you have a computer system with a $48-bi$t logical address, page size of $16K$ and $4 bytes$ per page table entry. If we have a $48MB$ program such that the entire program and all necessary page tables are in memory. How much memory is used by program, including its page tables?
in Operating System retagged by
897 views

2 Comments

48 MB + 12 KB = 48. 01172 MB ?
0
0
Please edit page size from 16K to 16KB.
0
0

1 Answer

1 vote
1 vote

Total memory requirements of 48 MB of program = 48 MB (program's usage in physical memory) + Page table entries corresponding to pages for 48 MB


Considering 1 level paging-

p | d = 34 | 14
#Pages required for 48 MB in logical space=48 MB/16K =3145.728 =~3146

Page table entries corresponding to 3KB pages=3146*4=12.28KB

Total=48MB +12.28KB=48.01MB


On the other side, there is a catch in question-- "all necessary page tables are in memory"

This means we should consider multilevel paging here -

Logical address' bits will be paged as- p1 | p2 | p3 | d = 10 | 12 | 12 | 14  [considering outermost page table fits in single page size]

A page table is stored in a page i.e 2^14, but since each entry requires 4 bytes, so effectively #pages in one table=2^14/4=2^12 

We have 3146 pages, so total page tables needed in the third level=3146/2^12=0.76 =~1 page table

To point 1 page table of third level, #page table needed in the second level=1 page table

To point 1 page table of second level, #page table needed in the first or outermost level=1 page table

Total page tables needed=3

Total memory acquired by 3 page tables=3*2^14=48KB

Total memory needed by program=48MB+48KB=48.046MB

edited by

4 Comments

How did you get innermost page table = 48*26*22 B ?

0
0

@Mamta ,here program size = 48 MB = 48*220 B..So we divide it into pages..since page size = 16 KB = 214 B..So , number of pages = (48*220 ) / 214 = 48*26 ...now since page table entry size = 4 B...So, Page Table size = 48*26 * 4 B = 48*26*22 B ..Please correct me where am wrong.

0
0

You are right but since ques asked for "How much memory is used by the program, including its page tables?" , we'll add 48 MB of program execution too, making a total of 48*220 + 48*26*22 B ~= 48.01 MB.

Back to your question-"Size of innermost page table = 48*26*22 B which is less than Page size 16 KB..so it will be fitted in one page.So why we need multilevel page tables ?"

Yes, it is less than a page size and the answer is perfect.On the other hand, I think the question is giving us hint to make it multilevel paging by saying "all necessary page tables are in memory." This is the reason why I have answered in both ways.

1
1