Memory Management

Memory management gives each process a virtual address space mapped to physical frames through page tables; the TLB caches recent translations, and demand paging with a replacement policy lets the working set exceed physical memory.

Key formulas & points

Skim these first — then read the full notes below.

  • Demand paging loads a page only on a page fault
  • Replacement policies: FIFO, LRU, optimal
  • Segmentation plus paging: segment table then page table

Topic details

Introduction

This Galvin topic covers virtual memory. You translate virtual to physical addresses through page tables, compute effective access time with a TLB, analyse page-replacement algorithms (FIFO, LRU, optimal) and page-fault behaviour, and compare paging with segmentation.

Key relations & formulas

Formulas (Indian textbook notation)

  • virtualaddresspagetableframenumber+offsetvirtual address → page table → frame number + offset
EATh×tTLB+(1h)×(tTLB+tmem)EAT \approx h\times t_{TLB} + (1 - h)\times (t_{TLB} + t_{mem})
(with TLB hit ratio h)

Formulas (Indian textbook notation)

  • pagingcausesinternalfragmentationinthelastpagepaging causes internal fragmentation in the last page

Notation and sign conventions

Relation 1 —
virtualaddresspagetableframenumber+offsetvirtual address → page table → frame number + offset

Formulas (Indian textbook notation)

  • virtualaddresspagetableframenumber+offsetvirtual address → page table → frame number + offset
Write this relation with symbols exactly as in Operating System Concepts — Silberschatz, Galvin & Gagne before substituting numbers. Examiners award partial marks for a correct setup even when arithmetic slips.
Relation 2 —
EATh×tTLB+EAT \approx h\times t_{TLB} +
EATh×tTLB+(1h)×(tTLB+tmem)EAT \approx h\times t_{TLB} + (1 - h)\times (t_{TLB} + t_{mem})
(with TLB hit ratio h)
Write this relation with symbols exactly as in Operating System Concepts — Silberschatz, Galvin & Gagne before substituting numbers. Examiners award partial marks for a correct setup even when arithmetic slips.
Relation 3 —
pagingcausesinternalfragmentationinthelastpagepaging causes internal fragmentation in the last page

Formulas (Indian textbook notation)

  • pagingcausesinternalfragmentationinthelastpagepaging causes internal fragmentation in the last page
Write this relation with symbols exactly as in Operating System Concepts — Silberschatz, Galvin & Gagne before substituting numbers. Examiners award partial marks for a correct setup even when arithmetic slips.

Concept in depth

Virtual memory decouples a program’s address space from physical RAM, so each process sees a large contiguous space while the OS maps its pages to scattered frames on demand. Because a page-table lookup for every access would be slow, the TLB caches recent translations; a high hit ratio keeps effective access time near raw memory speed. Demand paging loads pages only when referenced, and when memory is full a replacement policy evicts a page — LRU approximates the optimal (evict the page used furthest in the future) using recency, while FIFO can suffer Belady’s anomaly where more frames cause more faults. Paging’s only waste is internal fragmentation in the final partial page.

Assumptions and validity limits

State assumptions explicitly before using any relation for memory management — steady state, uniform properties, linear elastic material, ideal gas, incompressible flow, etc., as applicable.
Wrong assumptions invalidate the entire solution even when the formula is correct. In Operating Systems viva and GATE descriptive questions, listing valid assumptions often earns separate marks.

Step-by-step problem approach

1. Read the question and list given data with SI units (common in Operating Systems papers).
2. Draw a neat labelled diagram where applicable — examiners in Indian universities award diagram marks even when arithmetic slips.
3. Identify which relation from this topic applies to memory management.
4. Use equation 1:
virtualaddresspagetableframenumber+offsetvirtual address → page table → frame number + offset
.
5. Use equation 2:
EATh×tTLB+EAT \approx h\times t_{TLB} +
.
6. Substitute values, compute, and verify units and sign (direction).
7. State conclusion in one line — e.g. safe/unsafe, stable/unstable, feasible/infeasible.

Applications & exam relevance

Memory Management appears in systems software and backend. In Indian it software curricula this topic is tested because it connects theory to process, memory, and file management.
GATE and semester exams often combine memory management with earlier units — revise prerequisites before attempting mixed problems.
Industry interview panels sometimes ask: "Where did you use memory management?" — answer with a lab, mini-project, or plant visit example if possible.

Common mistakes in exams

Students confuse internal fragmentation (paging) with external fragmentation (segmentation), forget the TLB term in effective-access-time calculations, and mishandle page-replacement traces (especially LRU recency). Overlooking Belady’s anomaly for FIFO is a subtle exam point.

Quick revision checklist

Before attempting memory management problems, confirm you can:
1. Demand paging loads a page only on a page fault
2. Replacement policies: FIFO, LRU, optimal
3. Segmentation plus paging: segment table then page table
Revise the solved examples in Operating System Concepts — Silberschatz, Galvin & Gagne and one previous-year GATE or university paper for this unit.

Worked examples

Try the problem first — open the solution when you are ready to check.

Effective access time

Problem

TLB hit ratio h = 0.9, TLB lookup = 10 ns, memory access = 100 ns. Compute EAT using h·t + (1−h)(t + memory).

Solution

EAT = 0.9×10 + 0.1×(10 + 100) = 9 + 11 = 20 ns. The high hit ratio keeps EAT close to a single memory access despite the extra lookup on misses.

Conceptual check — Memory Management

Problem

In a Operating Systems semester or GATE paper you are asked: "State the main assumption, the governing relation, and one practical consequence of memory management." What should a complete answer include?

📖 Standard books (India)

  • Operating System ConceptsSilberschatz, Galvin & Gagne

    Read: Syllabus unit

    Processes, memory, and file systems