Types of Operating Systems
By the end of this lesson you will be able to name the main types of operating systems, say what problem each one solved, and check a simple real-time task set with Python.
Operating systems did not appear in one go. Each type was invented to fix a problem with the type before it. Following that story is the easiest way to remember them, and GATE and university exams love to ask about the differences.
Batch systems: one job after another
Early computers were huge and very expensive. Users did not sit at them. They handed over their programs, called jobs, on punched cards. An operator grouped similar jobs into a batch and the computer ran them one by one.
Think of a photocopy shop near a college that collects everyone's notes in the morning and returns the copies in the evening. It is efficient for the shop, but you cannot ask a quick question in between.
The big problem: while a job waited for a slow card reader or printer, the expensive CPU sat idle.
Multiprogramming: keep the CPU busy
Multiprogramming keeps several jobs in memory at once. When the running job has to wait for input or output (I/O), the OS switches the CPU to another job that is ready.
A good analogy is a cook in a dhaba. While the dal is simmering, the cook does not stand and stare at it. The cook starts rolling rotis. The cook (CPU) stays busy even though each dish (job) has waiting periods.
Multiprogramming raised CPU use a lot, but it still had no idea of a person waiting at a keyboard.
Time-sharing: every user feels served
Time-sharing (also called multitasking) switches the CPU between programs on a timer, many times per second, even if no program is waiting for I/O. Each user or program gets a short time slice. The goal is a short response time: the delay between pressing a key and seeing a reaction.
Step 1: run this comparison. Three students submit work to a shared computer. In batch style each job runs to the end. In time-sharing style each job gets 1 unit at a time.
jobs = [("Aarav", 6), ("Priya", 2), ("Kabir", 1)]
# Batch: run each job to completion in order
clock = 0
print("Batch: first response time")
for name, need in jobs:
print(f" {name}: {clock}")
clock += need
# Time-sharing: everyone gets a 1-unit slice in turn
print("Time-sharing: first response time")
for turn, (name, need) in enumerate(jobs):
print(f" {name}: {turn}")Batch: first response time Aarav: 0 Priya: 6 Kabir: 8 Time-sharing: first response time Aarav: 0 Priya: 1 Kabir: 2
Step 2: compare the numbers. Kabir's tiny job waits 8 units in batch mode but only 2 with time-sharing. This is why every desktop and phone OS today is a time-sharing system.
Real-time systems: on time, every time
A real-time operating system (RTOS) must finish certain tasks before a fixed deadline. Being correct but late counts as a failure.
- Hard real-time: missing a deadline can be dangerous. Examples: airbag controllers, pacemakers, anti-lock brakes.
- Soft real-time: missing a deadline lowers quality but is not a disaster. Examples: video calls, music streaming, online games.
A Mumbai local train timetable is a good picture of real-time thinking. A train that reaches the station late is a problem even if it carries every passenger safely.
Examples of RTOSes are FreeRTOS, Zephyr and VxWorks. Linux can also be built for real-time use: the PREEMPT_RT option became part of the main Linux kernel in version 6.12 (2024).
Advanced: can these tasks meet their deadlines?
Real-time tasks often repeat. A task with period T and run time C uses a fraction C / T of the CPU. The total of these fractions is the CPU utilisation U. For independent periodic tasks on one CPU, where each deadline equals its period, the Earliest Deadline First (EDF) method meets every deadline exactly when U <= 1.
tasks = {"brake_sensor": (1, 4), "engine_check": (2, 10), "dashboard": (3, 20)}
U = sum(c / t for c, t in tasks.values())
print(f"Utilisation = {U:.2f}")
if U <= 1:
print("EDF can meet every deadline")
else:
print("Overloaded: some deadline will be missed")Utilisation = 0.60 EDF can meet every deadline
Each pair is (C, T): the brake sensor needs 1 ms of CPU every 4 ms, and so on. Try making dashboard need 12 ms every 20 ms and run it again.
Other types you should know
| Type | Key idea | Example |
|---|---|---|
| Multiprocessor OS | One OS uses several CPU cores that share memory | Windows and Linux on any modern laptop |
| Distributed OS | Many separate computers cooperate and look like one system | Research systems; cloud platforms use the same ideas |
| Network OS | Computers share files and printers over a network | Windows Server, Linux file servers |
| Mobile OS | Built for touch, battery life and app permissions | Android, iOS |
| Embedded OS | Small OS inside a device with one job | Smart TV, washing machine, router |
Mobile operating systems are time-sharing systems with extra rules. Android, for example, may pause or stop background apps to save battery, and every app must ask for permissions such as camera or location.
Multiprogramming, multitasking, multiprocessing
These three words confuse almost everyone. Read them slowly.
- Multiprogramming: several programs in memory, so the CPU switches when one waits for I/O.
- Multitasking (time-sharing): the CPU switches on a timer, so every program gets regular turns.
- Multiprocessing: the computer has more than one CPU core, so programs truly run at the same time.
A modern laptop does all three together.
Common mistakes
- Saying real-time means "very fast". Real-time means predictable and on time. A slow task that always meets its deadline is real-time.
- Mixing up multiprogramming and multiprocessing. One is about many programs in memory; the other is about many CPUs.
- Thinking batch processing is dead. Payroll runs, bank interest calculations and nightly backups are still run as batch jobs today.
Key points
- Batch systems ran jobs one after another with no user interaction.
- Multiprogramming keeps several jobs in memory so the CPU works while one waits for I/O.
- Time-sharing switches on a timer to give every user a short response time.
- Real-time systems must meet deadlines; hard real-time misses can be dangerous.
- For periodic tasks on one CPU with deadline equal to period, EDF meets all deadlines when utilisation is at most 1.
- Mobile and embedded systems are specialised time-sharing or real-time systems.
Exercise
A drone controller has three periodic tasks: motor_control needs 2 ms every 5 ms, camera needs 4 ms every 20 ms, and gps needs 3 ms every 15 ms. Use the utilisation program to decide whether EDF can schedule them. Then add a fourth task, logging, that needs 1 ms every 10 ms. What changes?
Show solution
tasks = {"motor_control": (2, 5), "camera": (4, 20), "gps": (3, 15), "logging": (1, 10)}
U = sum(c / t for c, t in tasks.values())
print(f"Utilisation = {U:.2f}")
print("EDF OK" if U <= 1 else "Overloaded")Utilisation = 0.90 EDF OK
Without logging, U = 0.4 + 0.2 + 0.2 = 0.80. Adding logging raises it to 0.90, which is still at most 1, so EDF can still meet every deadline.
Quick Quiz
1. Which type of OS was created mainly to stop the CPU sitting idle during I/O?
Multiprogramming keeps several jobs in memory and switches to another one when the running job waits for I/O.
2. An airbag controller must react within a few milliseconds every time. What kind of system is this?
Missing an airbag deadline could cause injury, so it is hard real-time.
3. What is the main goal of a time-sharing system?
Time-sharing switches the CPU on a timer so each user sees a quick response.
4. Four periodic tasks have a total utilisation of 1.15 on one CPU. What does this tell you?
The CPU cannot do more than 100% work, so a utilisation above 1 means the tasks cannot all fit.
Learn Operating Systems with a mentor
Free lessons get you started. Our Computer Science Fundamentals training adds real projects and code reviews from working developers.
- Project-based learning
- Mentor code reviews
- Free counselling call
