MANAGEMENT (Outline)
1. 💭 What is Memory Management?
● “Programs expand to fill the memory available to hold them” – a play on Parkinson’s
Law.
● Memory is a limited resource. Even though modern computers have much more
memory than earlier ones (e.g., IBM 7094 from 1960s), we still need to manage it
wisely.
2. ❌ No Memory Abstraction
Early computers did not have memory abstraction. "No memory abstraction" is the
simplest type of abstraction, meaning the operating system doesn’t try to hide or organize
memory in a way that simplifies or protects it for the user. In this setup, memory is
physically divided, no flexibility, protection, or multitasking capabilities.
● Without abstraction, memory is divided between:
○ Operating system (OS)
○ One user program
● Fig 3-1 shows three ways to organize memory:
○ Whole memory used by OS and one user process.
○ Variable-sized partitions for multiple jobs: more dynamic but has external
fragmentation (need paging/compaction to fix).
○ Fixed-size partitions: rigid and has internal fragmentation (need
paging/segmentation to fix)
● Shared Issue:
○ Rigid: can’t adapt to different program sizes
○ Inefficient: Wastes memory due to unused space (fragmentation).
○ No Protection: A buggy program could overwrite OS memory
, ○ No Multitasking: only one process runs at a time.
What Is Memory Abstraction Then?
Abstraction hides complexity from programs and users:
● Each program thinks it has its own private memory.
● The OS manages memory using techniques like paging, segmentation, or virtual
memory.
❗
3. Running Multiple Programs Without a Memory
Abstraction The Relocation Problem
● The relocation problem occurs when a program is designed to run starting at
memory address 0, but in reality, the OS loads it somewhere else in memory —
and now all its memory addresses are wrong.
● Fig 3-2:
○ (a) 16 KB program.
○ (b) Another 16 KB program.
○ (c) When loaded together, addresses clash unless relocated.
● This means the OS needs a way to relocate memory references.
🛡️ How Do We Solve It?
The OS uses relocation techniques like:
● Base and limit registers: Adjust the address at runtime (e.g., add base address to
all memory accesses).
● Relocation during linking/loading: Rewrite addresses in the program when it’s
loaded into memory.
● Virtual memory + MMU: Use address translation to automatically map virtual
addresses to correct physical addresses.
, 4. 🔒 Base and Limit Registers
● Protect memory with base and limit registers:
○ Base = starting address.
○ Limit = length of allowed memory.
● Fig 3-3: Ensures each process stays in its lane (no illegal memory access).
5. 🔁 Swapping (Freeing and Reusing Memory)
● OS swaps processes in and out of memory to make room for others.
● Fig 3-4:
○ Shows how memory changes as processes come and go.
○ Shaded areas = unused (free) memory.
● Fig 3-5:
○ (a) Allocating space for a growing data segment.
○ (b) Allocating for both a growing stack and data segment.
○ Issue: Segments may grow into each other if not planned carefully.
6. 🧮 Allocation with Bitmaps and Linked Lists
✅ Bitmaps (Fig 3-6)
● Memory divided into small units.
● Bitmap tracks if each unit is free (0) or used (1).
● Easy to find space, but slow when memory is large.
🔗 Linked Lists (Fig 3-7)