1. Evolution of CPU Utilization
| Early Computers | Modern Computers |
| One user at a time | Many users simultaneously |
| One program at a time | Many programs running together |
| CPU idle most of the time | CPU utilization maximized |
| No multitasking | Multitasking + Multiprocessing |
Modern operating systems maximize CPU utilization through multitasking and multiprocessing.
2. What is Multitasking?
Multitasking is the ability of an OS to execute multiple tasks apparently at the same time by rapidly switching the CPU among them.
📌 On a single-core processor, only one task actually executes at any instant. The illusion of simultaneous execution is created through context switching.
| Characteristic | Detail |
| Multiple applications | Run concurrently |
| CPU time | Shared among tasks |
| Mechanism | Process scheduling + context switching |
| User experience | All tasks appear to run together |
| Advantages | Disadvantages |
| Better CPU utilization | Context switching overhead |
| Increased productivity | Higher memory requirements |
| Improved responsiveness | Poor scheduling degrades performance |
3. Types of Multitasking
A. Cooperative Multitasking
Each running process voluntarily releases the CPU. The OS cannot forcibly interrupt the process.
| Aspect | Detail |
| CPU Release | Process decides when to yield |
| Advantage | Simple implementation, low overhead |
| Disadvantage | One faulty program can block the entire system |
| Historical Examples | Windows 3.x, Classic Mac OS |
B. Preemptive Multitasking
The OS can interrupt a running process whenever necessary (e.g., when the time quantum expires).
| Aspect | Detail |
| CPU Release | OS forces the switch |
| Advantage | Better responsiveness; fair CPU allocation; faulty process isolated |
| Disadvantage | More context switching; slightly higher overhead |
| Examples | Modern Windows, Linux, macOS |
Cooperative vs Preemptive
| Feature | Cooperative | Preemptive |
| CPU control | Released voluntarily by process | Taken by OS |
| Complexity | Simpler | More complex |
| Responsiveness | Less responsive | More responsive |
| Faulty process | Can freeze entire system | Isolated; OS can evict it |
| Usage | Legacy systems | All modern OS |
4. Time-Sharing System
A Time-Sharing System divides CPU time into small slices (time quanta) and shares them among users or processes to enable interactive computing.
| Advantage | Example |
| Interactive computing for many users | UNIX servers, cloud terminals |
| Fair CPU allocation | Each user gets a time slice |
| Multiple users simultaneously | University mainframe systems |
5. What is Multiprocessing?
Multiprocessing means a computer uses two or more CPUs or processor cores to execute processes simultaneously. Unlike multitasking, tasks truly execute in parallel.
| Characteristic | Detail |
| Processors | Multiple physical or logical CPUs |
| Execution | True parallel execution |
| Throughput | Higher than single-CPU system |
| Reliability | If one CPU fails, others continue |
| Advantages | Disadvantages |
| Faster execution & better performance | Higher hardware cost |
| Increased reliability | More complex OS required |
| Supports parallel computing | Inter-processor communication overhead |
6. Types of Multiprocessing
A. Symmetric Multiprocessing (SMP)
All processors are equal — each can perform any task and all share the same memory.
| Aspect | Detail |
| Processor roles | All equal; any processor can run any process |
| Memory | Shared among all processors |
| Advantage | Load shared equally; high performance; better fault tolerance |
| Examples | Modern desktop computers, servers, smartphones |
B. Asymmetric Multiprocessing (AMP)
One processor acts as the master; remaining processors work as slaves under its control.
| Aspect | Detail |
| Master CPU | Controls scheduling and I/O |
| Slave CPUs | Execute assigned tasks only |
| Advantage | Simpler control structure |
| Disadvantage | Less flexible; master can become a bottleneck |
| Examples | Some embedded systems, older mainframes |
SMP vs AMP
| Feature | SMP | AMP |
| CPU roles | All equal | Master-slave architecture |
| Performance | Better (load balanced) | Simpler but less flexible |
| Fault tolerance | High | Lower (master failure = system failure) |
| Usage today | Widely used in modern systems | Less common |
7. Multicore Processors
A multicore processor contains multiple processing cores within a single physical CPU chip.
| Example | Detail |
| Dual-Core | 2 cores in one chip |
| Quad-Core | 4 cores in one chip |
| Octa-Core | 8 cores in one chip |
| Feature | CPU (Physical Package) | Core |
| Definition | Physical processor chip | Processing unit inside the CPU |
| Contains | One or more cores | ALU, registers, cache |
| Example | Intel Core i7 | Each of the 8 cores inside |
Benefits: Lower power consumption per task, higher overall performance, better multitasking without needing separate physical CPUs.
8. Processor Affinity
Processor Affinity means keeping a process on the same CPU whenever possible to take advantage of warm cache data.
| Without Affinity | With Affinity |
| Process may move to a different CPU | Process stays on same CPU |
| Cache data becomes cold (wasted) | Cache still holds useful data |
| More cache misses | Fewer cache misses |
| Slightly lower performance | Better performance |
9. Load Balancing
Load balancing distributes processes evenly among all processors to prevent any single CPU from being overloaded while others sit idle.
| Scenario | CPU 1 | CPU 2 | Result |
| Without load balancing | 10 processes | 1 process | CPU 1 overloaded; CPU 2 idle |
| With load balancing | 5-6 processes | 5-6 processes | Even utilization; better performance |
10. Parallel Computing
Parallel computing uses multiple processors simultaneously to solve one large problem faster.
| Example | How Parallel |
| Weather Forecasting | Each processor calculates a different geographic region |
| Machine Learning Training | Different batches of data processed simultaneously |
| Scientific Simulations | Different parts of the model computed at the same time |
| AI / Deep Learning | GPU cores run thousands of operations in parallel |
Key Comparisons
| Feature | Multiprogramming | Multitasking |
| Goal | Maximize CPU utilization | Maximize user interaction |
| CPU switch trigger | Process waits (I/O) | Time slice expires |
| System type | Mostly batch systems | Interactive systems |
| Concept era | Older | Modern |
| Feature | Multitasking | Multiprocessing |
| Hardware | One CPU / core switching among tasks | Multiple CPUs / cores |
| Execution type | Concurrency (interleaved) | Parallelism (simultaneous) |
| Mechanism | Context switching | Simultaneous execution |
| Feature | Multiprocessing | Multithreading |
| Unit | Multiple CPUs / cores | Multiple threads inside one process |
| Basis | Hardware-level parallelism | Software execution units |
| Cost | Higher hardware cost | Lower overhead |
Concurrency vs Parallelism
| Feature | Concurrency | Parallelism |
| Definition | Multiple tasks make progress during overlapping time | Multiple tasks execute at the exact same instant |
| CPU requirement | Single CPU is sufficient (context switching) | Multiple cores required |
| Execution | Interleaved (rapid switching) | Truly simultaneous |
| Example | One CPU switching among Task A, B, C | Core 1 → Task A, Core 2 → Task B |
| Feature | Single-Core | Multi-Core |
| Execution units | One | Multiple |
| Context switching | More needed | Less needed |
| Throughput | Lower | Higher |
| Cost | Lower | Higher performance |
Memory Tricks
| Mnemonic | Full Form |
| Multitasking Types — CP |
C → Cooperative P → Preemptive |
| Multiprocessing Types — SA |
S → Symmetric (SMP) A → Asymmetric (AMP) |
| CPU Sharing Goals — ULTP |
U → Utilization L → Load Balancing T → Throughput P → Performance |
| Concurrency vs Parallelism |
Concurrency = one CPU, overlapping. Parallelism = multiple cores, simultaneous. |
Frequently Asked Exam Questions
| Question | Answer |
| What is multitasking? | OS ability to execute multiple tasks by rapidly switching the CPU among them |
| What is multiprocessing? | Use of multiple CPUs or cores to execute processes simultaneously |
| Cooperative vs preemptive multitasking? | Cooperative: process voluntarily yields. Preemptive: OS interrupts the process. |
| What is SMP? | Symmetric Multiprocessing — all processors equal, share memory, run any task |
| What is processor affinity? | Keeping a process on the same CPU to improve cache performance |
| Concurrency vs parallelism? | Concurrency: overlapping progress (one CPU). Parallelism: simultaneous execution (multiple cores). |
| Multitasking vs multiprocessing? | Multitasking: one CPU switches (concurrency). Multiprocessing: multiple CPUs run in parallel. |
Practice MCQs
-
1. Which multitasking type allows the OS to interrupt a running process?
A. Cooperative B. Batch C. Preemptive D. Sequential
✅ Answer: C — Preemptive
-
2. Which multiprocessing model treats all processors equally?
A. Asymmetric Multiprocessing B. Symmetric Multiprocessing C. Batch Processing D. Time Sharing
✅ Answer: B — Symmetric Multiprocessing (SMP)
-
3. Time-sharing systems primarily aim to:
A. Reduce RAM usage B. Share CPU time among users or processes C. Eliminate context switching D. Remove deadlocks
✅ Answer: B — Share CPU time among users or processes
-
4. Which concept keeps a process on the same CPU to improve cache efficiency?
A. Paging B. Processor Affinity C. Spooling D. Segmentation
✅ Answer: B — Processor Affinity
-
5. True parallel execution requires:
A. One CPU only B. Multiple processors or cores C. A larger hard disk D. More RAM only
✅ Answer: B — Multiple processors or cores