retagged by
6,664 views
9 votes
9 votes
Q.

Suppose you have a computer system with a 48-bit logical address, page size of 16KB 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. Assume that each page table at diff level fits in a single page.How much memory is used by program, including its page tables?
retagged by

4 Answers

Best answer
14 votes
14 votes

48 bit LA will be divided as  |  10 bits  |  12 bits  |  12 bits  |  14 bits  | 

program size  = 48 MB =  $ 3 \times 2^{24}$
no. of pages req. by the program = $ \frac{3 \times 2^{24}}{2^{14}} =3 \times 2^{10}$
third level page can have $ 2^{12}$ entries which are enough for program

therefore we req. 1 third level page + 1 second level page + 1 first level page
Total table size $ = 1 \times 2^{10} \times 4 + 1 \times 2^{12} \times 4 + 1 \times 2^{12} \times 4$ = 36 KB

Total memory used by program = 36 KB + 48 MB = 49188 KB

ref: Ques 3 of problem 2
http://www.cs.utexas.edu/~lorenzo/corsi/cs372h/07S/hw/3sol.html

selected by
10 votes
10 votes

the logical address is divided as

48MB process === 3 * 2^24

Number of pages in process is === 3 * 2^10

on third level each page table provide 2^12 enteries so 

3 * 2^10 entries is fit in one page

and in 2 nd level we need  1 page table

and on 1st level we need one page so ans is

 3 pages + size of process

3*16KB +48 MB

1 votes
1 votes

Since Virtual address is 48 bit and page size is 16KB i.e. 2^14 bytes we get

(2^48)/(2^14)=2^34 pages.

And each page table entry will be 4 bytes

so total (2^34) * (4) bytes will be the total size of page table in bytes.

Progam having size 48MB i.e. 48*2^20 bytes.

so size of page table needed for that process is (2^36)/(48*2^20)=1.33 KB of page table is required

So I approximately 1.33KB+48MB=49153.33 KB or 48.0013 MB

Please tell me if there is any error!

And you please refer to GATE 2016 set 1 question 57

Here is the link: http://quiz.geeksforgeeks.org/gate-cs-2016-set-1/

edited by
0 votes
0 votes
formula for such can be derived from the concepts

indexing bits for page table which are completely filled is =page size/PTE size

for last table which may or may not fit (usually less) is =page table size/PTE size

so for first two levels bits will be=page size/PTE size=2^14/2^2=12

for last level=page table size/PTE size or remainng bits is=10 hence (10,12,12) will denote  no  of pages of a process
Answer:

Related questions

2 votes
2 votes
1 answer
1
3lurryface asked Jan 9, 2019
1,047 views
If there is 2 or more level paging for processes, is it possible to have more than 1 page fault while accessing any single addressable unit(byte or word) ?
0 votes
0 votes
0 answers
3
SSR17 asked Feb 8
185 views
we have 8 pages (each side 32B) to store in physical memory of 2^32 bits how many bits are required to identify each page , according to me 3 bits are required but that i...