Calculation of the number of bits required for Physical Address:
Let Physical Address Space (PAS) = P bytes
Example:
PAS = 256 KB = Byte then,
So, number of bits requirement for physical address = 18 bits
Physical address contains two parts: frame number and Offset
Calculation of the number of frames in Physical Address space:
PAS (Main memory size) = P bytes = bytes (Take it as a power of 2)
Frame size = F bytes = bytes (Take it as a power of 2)
And the number of bits for frame number in PAS = x-y
Example:
PAS = 64 MB = bytes and page size = frame size = 16KB = bytes
Number of bits required for frame number in PAS = 12
What we know from above
And
So, the number of bits required for frame number in PAS = x - y bits = k bits.
We can also calculate page offset directly because we consider Frame size P bytes = bytes
So, frame offset = y bits
So, here m - k bits = y bits