# Size of address spaces (logical and physical)

Suppose a system in which addresses (physical and logical) occupy 32 bits, page size is 1024 bytes (210), and physical memory is of size 32MB. How many frames are in physical memory? Is the logical address space larger than physical memory? Explain.

The solution given is:

232 byte logical address space (assuming byte-addressable machine)

225 byte physical memory

210 byte pages

At one page per frame, there are 225/210 = 215 pages in physical memory. The logical memory address space is larger than physical memory.

Can someone explain how to arrive at this solution?

## 2 Answers

The size of a frame is the same as that of a page, so the size of a frame is 1024 bytes (210 bytes).

If the physical memory is 32MB (225 bytes), the number of frames is 225 / 210 = 215 and this is also the maximum number of pages that can be present in memory at the same time.

The logical address space is larger than the physical address space, a process can address 232 memory locations that is 232 / 210 = 222 pages.

Since the page size is 2^10 , in the virtual address, 10 bits are allocated as offset bits. Since it has 32 bits total, the remaining 22 bits represents the Frame number. So there are 2^22 logical address frames.

The physical memory is 2^25 bytes and the frame size is 2^10 bytes. So the number of frames in the physical address space is (2^25)/(2^10) = 2^15.

Each process has its own logical address space. That may be smaller than the physical address space. But at a given time there are more than one process running. So altogether the logical address space exceeds the physical address space.