2. Types of Operating Systems

Tanish KumarTanish Kumar
3 min read

1. Goals of an OS

Why do we need different OS types?
To achieve:

  1. Maximum CPU Utilization: Keep CPU busy (no idle time).

    • Example: If Process 1 waits for I/O, run Process 2.
  2. No Process Starvation: All processes get fair CPU time.

    • Example: Prevent one infinite loop (while(1)) from blocking other apps.
  3. 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

ConceptWhat?Example
Context SwitchingSaving/restoring process statesBookmarking textbooks
Time QuantumFixed CPU time per job (e.g., 100ms)Traffic light timers
PCBProcess 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

  1. How does multitasking prevent starvation?

  2. Why can’t RTOS tolerate delays?

  3. 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:

  1. Idle CPUMultiprogramming.

  2. UnfairnessMultitasking.

  3. Hardware limitsMultiprocessing/Distributed.

1
Subscribe to my newsletter

Read articles from Tanish Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Tanish Kumar
Tanish Kumar