2. Types of Operating Systems

1. Goals of an OS
Why do we need different OS types?
To achieve:
Maximum CPU Utilization: Keep CPU busy (no idle time).
- Example: If Process 1 waits for I/O, run Process 2.
No Process Starvation: All processes get fair CPU time.
- Example: Prevent one infinite loop (
while(1)
) from blocking other apps.
- Example: Prevent one infinite loop (
High-Priority Job Execution: Critical tasks (e.g., antivirus) jump the queue.
2. Types of OS
1. Single-Process OS
What? Runs one job at a time (e.g., MS-DOS).
Why? Early hardware could only handle one task.
Problems:
CPU sits idle during I/O.
Starvation: Long jobs block others.
No priority support.
2. Batch Processing OS
What? Groups similar jobs into batches (e.g., ATLAS).
How?
Operator sorts jobs (e.g., by estimated runtime) → Submits batches sequentially.
Problems:Still no CPU utilization during I/O.
Batch Starvation: Long batches delay others.
Analogy:
- Like a teacher grading papers batch by batch (Math first, then Science).
3. Multiprogramming OS
What? Runs multiple jobs in memory; switches when one waits for I/O.
Key Concept: Context Switching
Saves current process state (in PCB) → Loads another.
Real-life Example: Switching from Physics to Chemistry books (bookmarking each).
Why Better?
CPU never idle during I/O.
Limitation:No time limits → Long jobs can still hog CPU.
4. Multitasking (Time-Sharing) OS
What? Adds time quanta (e.g., 100ms per job).
How?
Forces context switch after each time slice.
Example: CPU cycles between Chrome, Word, and Spotify.
Why Best?
✅ Max CPU utilization (no idle time).
✅ No starvation (every job gets turns).
✅ Priority support (e.g., antivirus interrupts).
Used in: Modern OS (Windows, Linux).
5. Multiprocessing OS
What? Uses multiple CPUs/cores.
How?
Jobs distributed across CPUs.
Example: Gaming (CPU1: Physics, CPU2: AI).
Advantages:
- Higher speed + reliability (if one CPU fails, others work).
6. Distributed OS
What? Manages networked computers (e.g., cloud systems).
How?
- Jobs split across machines (e.g., LeetCode executes code on remote servers).
Key Term: Loosely coupled (independent but collaborative).
7. Real-Time OS (RTOS)
What? Error-free, instant response systems.
Used in:
Air Traffic Control (ATC), Nuclear plants.
Why Critical?Lives depend on zero delays/errors.
3. Key Concepts Simplified
Concept | What? | Example |
Context Switching | Saving/restoring process states | Bookmarking textbooks |
Time Quantum | Fixed CPU time per job (e.g., 100ms) | Traffic light timers |
PCB | Process Control Block (stores state) | Resume of a paused job |
4. Why Learn This?
Interview Qs: Differences between multitasking vs. multiprogramming.
Real-World: Your phone uses multitasking; clouds use distributed OS.
5. Test Your Understanding
How does multitasking prevent starvation?
Why can’t RTOS tolerate delays?
What’s the role of a PCB?
6. Homework
Find examples for each OS type:
Distributed OS: ?
RTOS: ? (Hint: Medical devices)
Final Notes
OS evolved to solve:
Idle CPU → Multiprogramming.
Unfairness → Multitasking.
Hardware limits → Multiprocessing/Distributed.
Subscribe to my newsletter
Read articles from Tanish Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
