Memory Management
Operating Systems└── Memory Management └── Virtual Memory ├── Paging ├── Demand Paging ├── Page Replacement ├── Thrashing └── Working Set ModelWorking Set Model
Section titled “Working Set Model”1. Principle of Locality
Section titled “1. Principle of Locality”Programs do not access all memory randomly.
They usually access:
- the same data repeatedly (Temporal Locality) ⭐
- nearby memory locations (Spatial Locality) ⭐
This behavior is called the Principle of Locality.
2. Working Set
Section titled “2. Working Set”The working set is: The set of pages currently being actively used by a process during a time interval.
Notation:
Where:
- = current time
- = working set window
It contains all pages referenced in the last time units.
3. Purpose of Working Set Model
Section titled “3. Purpose of Working Set Model”The OS keeps the working set pages in memory to:
- reduce page faults
- improve performance
- prevent thrashing
4. Thrashing
Section titled “4. Thrashing”Thrashing occurs when:
- too many page faults happen
- CPU spends more time swapping pages than executing processes
Cause:
- insufficient frames allocated to processes
5. Relation Between Working Set and Thrashing
Section titled “5. Relation Between Working Set and Thrashing”- If all working set pages fit in RAM → system works efficiently
- If working sets do not fit → thrashing occurs
Thus:
Working Set Model is used to control/prevent thrashing.
6. Important Exam Point
Section titled “6. Important Exam Point”| Concept | Related To |
|---|---|
| Working Set Model | Principle of Locality |
| Thrashing | Excessive Paging |
| Paging | Virtual Memory |
| Segmentation | Memory division by logical units |
Important One-Liners
Section titled “Important One-Liners”- Working set model is based on locality of reference.
- Working set helps prevent thrashing.
- Thrashing increases page faults and reduces CPU utilization.
- Working set is used in virtual memory management.