Operating System Notes: Paging, Page
Table, Segmentation, Virtual Memory,
Frame Allocation
Paging
Paging is a memory management technique where a process is divided into fixed-size pages
and main memory is divided into frames.
Pages are mapped to frames using a page table.
Logical address = Page number + Offset
Physical address = Frame number + Offset
Advantages: No external fragmentation, efficient memory usage.
Disadvantages: Internal fragmentation, page table overhead.
Page Table Structure
Page table maps page numbers to frame numbers.
Each Page Table Entry (PTE) contains:
- Frame Number
- Valid/Invalid Bit
- Protection Bits
- Reference Bit
- Dirty Bit
Segmentation
Segmentation divides a program into variable-sized logical segments like code, data, and
stack.
Logical address = Segment number + Offset
Segment table contains Base Address and Limit.
Advantages: Logical structure, easy protection.
Disadvantages: External fragmentation.
Segmentation with Paging
Combines segmentation and paging.
Each segment is divided into pages.
Logical address = Segment number + Page number + Offset
Uses both segment table and page tables.
Eliminates external fragmentation.
Virtual Memory
Allows execution of programs larger than physical memory.
Uses disk as extension of RAM.
Demand paging loads pages only when required.
Page fault occurs when required page is not in memory.
Advantages: Supports large programs, multitasking.
Disadvantages: Slower due to disk access.
Allocation of Frames
Process of distributing frames among processes.
Methods:
- Equal Allocation
- Proportional Allocation
- Priority Allocation
Global vs Local allocation strategies.
Poor allocation may cause thrashing.