Consider the system which has 4K entries in the page table where Logical Address (LA) is 22 bits and main memory has 256 frames. How many bits are required for Physical Address (PA)?
You should know:
Before seeing the solution please follow Calculation of offset for logical and physical address, Calculation of logical address bit and number of pages, Calculation of physical address bit and number of frames, Calculation of page table size.
Solution:
Given data
Number of pages = 4KB = , Logical Address (LA) = 22 bits and
Number of frames in main memory= 256 = .
The question is asking for the total number of bits for Physical Address (PA).
We can calculate it two different ways and you can use anyone
Process 1:
LA = 22 bits, so LAS = and number of pages =
We know page size and frame size are always the same.
So, page size = frame size = = 1KB
Now, number of frames = 256 = and frame size = .
So,
So, the number of bits is required for Physical Address (PA) = 18 bits
Or,
Process 2:
So, the number of bits required for page number at Logical Address (LA) = 12 bits
Now, total bits for Logical Address (LA) = 22 bits are given.
Now, if we elaborate the address fields of Logical Address (LA):
Then offset = LA - page number = 22 bits – 12 bits = 10 bits
Now, number of frames = 256 = is given.
So, the number of bits required for frame number in Physical Address = 8 bits
Now, we elaborate the address fields of Physical Address (PA):
So, the total number of bits required for Physical Address (PA) = 8 bits +10 bits = 18 bits
Note: Here we can use any of the processes but it is simple and important for exams. For any confusion please follow the previous chapter links.