Unit 3 · Module 3

Paging

Non-contiguous allocation: logical memory is cut into fixed-size pages, physical memory into equal-size frames, and a page table maps one to the other. External fragmentation disappears.

Pages, frames and the page table
Page — A fixed-size block of the process's logical address space (e.g. 1 KB, 4 KB).
Frame — A block of physical memory exactly the same size as a page. Any page can go into any free frame.
Page table — Per-process table that maps page number → frame number, with a valid/invalid bit for protection.
Page number — High-order bits of the logical address = logical address ÷ page size. Used as the index into the page table.
Offset (displacement) — Low-order bits = logical address mod page size. Copied unchanged into the physical address.
Physical address — frame number × page size + offset.
Logical Address
      |
+------+--------+
| Page | Offset |
+------+--------+
      |
   Page Table
      |
 Frame Number
      |
+-------+--------+
| Frame | Offset |
+-------+--------+
      |
Physical Address

Real-world analogy: Book chapters in a shared shelf

Your book's chapters (pages) are stored in whatever shelf slots (frames) happen to be free. The index card at the front (page table) says "chapter 2 → slot 5". You still read chapter 2 line 40 (offset) exactly the same way.
Experiment: Paging address-translation simulator

Number of pages

8

Number of frames

16

Page number

3

Offset

428

Ready — press Next step

Logical address

3500

Page #

3

Offset

428

Page table entry

invalid ✗

Physical address

Addressing error / page not in memory

Live page table (editable)

Page No.Frame No.Valid
0✓
1✓
2✓
3✗
4✓
5✓
6✓
7✓
  1. Step 1 · CPU emits the logical address

    The process refers to a byte inside its own address space. The hardware treats this number as two parts.

  2. Step 2 · Split into page number and offset

    Page number = logical address ÷ page size, offset = logical address mod page size. The offset never changes during translation.

  3. Step 3 · Look up the page table

    The page number indexes the page table. If the valid bit is 0 the access traps (page fault / protection violation); otherwise we read the frame number.

  4. Step 4 · Build the physical address

    Physical address = frame number × page size + offset. The byte is fetched from that location in RAM.

Practice problem

Page size = 1 KB (1024 bytes). Logical address = 3500. The page table says page 3 → frame 7. Find the page number, offset and physical address.

Quick quiz

1. What kind of fragmentation does paging still suffer from?

2. The offset part of a logical address is…

3. With page size 2 KB, how many pages does a 9 KB process need?

Next: variable-size logical units with base and limit — segmentation.

Unit 3
Segmentation