manish
manish

Reputation: 311

Calculating size of the page table

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 ?

My Solution:

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
=> 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

But the answer is 8 MB. Why?

Upvotes: 1

Views: 22454

Answers (3)

abc
abc

Reputation: 1

there is error in question virtual address if of 34 bits for this question answer is 8 MB and for given question answer will be 2 MB

Upvotes: -1

Siddharth Thevaril
Siddharth Thevaril

Reputation: 3788

8MB cannot be the answer,
Physical Address Space = 64MB = 2^26B
Virtual Address = 32-bits, ∴ Virtual Address Space = 2^32B
Page Size = 4KB = 2^12B
Number of pages = 2^32/2^12 = 2^20 pages.

Number of frames = 2^26/2^12 = 2^14 frames.

Page Table Size = 2^20×14-bits ≈ 2^20×16-bits ≈ 2^20×2B = 2MB.

Upvotes: 3

user3344003
user3344003

Reputation: 21607

The question has been asked before. However, there is not sufficient information in the question to determine the size of the page table.

  1. It does not specify the size of the page table entries.
  2. It does not specify the number of pages mapped to the process address space.
  3. It does not specify the division between the process and system address pace. How much of the 32 bits is part of the process address space.
  4. It does not specify whether this is a process or system table.

Upvotes: 0

Related Questions