Types of Operating Systems
Operating systems are classified by the work they are built for. Each type answers the same question differently: who gets the CPU next, and for how long. The answer decides whether the system is good at throughput, response time, deadlines or small size.
How Operating Systems Are Classified
There is no single official list, but every classification of operating systems comes down to a few questions. Who is waiting for the result: nobody, a person at a keyboard, or a machine with a deadline? How many users and programs share it? How many processors, and are they in one box or many?
The answers change the design, most of all the scheduler. A system for overnight jobs never needs to interrupt anyone. A system for people at keyboards must interrupt constantly. A system that fires an airbag must prove it will never be late. The sections below take the common types in roughly the order they appeared.
- By who waits: batch, interactive (time-sharing), real-time
- By users and tasks: single-user or multi-user, single-tasking or multitasking
- By hardware: single processor, multiprocessor, distributed, embedded, mobile
Batch and Multiprogramming Systems
A batch operating system collects jobs and runs them one after another with no user interaction. On early mainframes, jobs arrived on punched cards and the output came back hours later as a printout. Each job ran until it finished.
That wastes the CPU whenever a job waits for a disk or tape. Multiprogramming fixed this by keeping several jobs in memory at once: when the running job blocks on I/O, the OS gives the CPU to another one. The tracer shows two jobs finishing at 6 ms instead of 9 for this reason alone.
Batch work has not gone away. Payroll runs, nightly data pipelines, jobs on a computing cluster and CI build queues are all batch processing: nobody watches them, so only the total time matters.
- Goal: throughput, the number of jobs finished per hour
- Weakness: a short job can wait behind a long one
- Examples: IBM OS/360 batch jobs, today's cluster job schedulers
Time-Sharing and Multitasking Systems
A time sharing operating system gives each program a short slice of CPU time, a quantum of a few milliseconds, and then switches to the next. Switching fast enough makes every user feel they have the machine to themselves. Multitasking is the same idea on a single-user machine: many programs appear to run at once.
The key part is the timer interrupt. When the quantum ends, the hardware interrupts the running program whether it is finished or not, and the OS picks another. Without it, a program stuck in a loop keeps the CPU forever, which is what happened on cooperative systems such as classic Mac OS.
Each switch costs a little: saving registers, changing the page table and losing warm cache lines. So time-sharing finishes slightly less work per second than batch, in exchange for much faster response. Unix was built this way, and Windows, macOS and Linux all work like this today. The rule for which job runs next is covered in CPU scheduling algorithms.
- Goal: response time for people at keyboards
- Needs a timer interrupt to take the CPU back
- Examples: Unix, Linux, Windows, macOS
Terms, operations, and practical uses
Workload categories
- BatchRuns prepared jobs with little interactive input and emphasizes throughput.
- Time sharingPreempts work frequently to keep many interactive programs responsive.
- Real timeEvaluates correctness partly by whether deadlines are met.
Specialized systems
- EmbeddedRuns inside a device with a narrow purpose and constrained resources.
- MobileCoordinates radios, sensors, touch input, application sandboxes, and battery limits.
- DistributedCoordinates services across multiple computers while hiding some machine boundaries.
Evaluation criteria
- Response timeDelay before a request begins receiving service.
- ThroughputAmount of work completed per unit of time.
- PredictabilityAbility to bound when important work will finish.
One job set under batch, time-sharing and real-time scheduling
from collections import deque
JOBS = [("A", 4), ("B", 3), ("C", 2)] # all ready at t = 0, times in ms
def batch(jobs):
"""Run each job to completion, in order. Returns finish time per job."""
t, done = 0, {}
for name, need in jobs:
t += need
done[name] = t
return done
def time_sharing(jobs, quantum):
"""Give each job at most `quantum` ms, then send it to the back."""
t, done, ready = 0, {}, deque(jobs)
while ready:
name, left = ready.popleft()
run = min(quantum, left)
t += run
if left > run:
ready.append((name, left - run)) # preempted: back of the queue
else:
done[name] = t
return done
for label, done in (("batch", batch(JOBS)), ("time-sharing", time_sharing(JOBS, 2))):
finish = ", ".join(f"{n} {t}" for n, t in done.items())
print(f"{label}: {finish} | average {sum(done.values()) / len(done):.2f}")#include <cstdio>
#include <deque>
#include <utility>
#include <vector>
using namespace std;
typedef vector<pair<char, int>> Jobs; // (name, ms needed); all ready at t = 0
// Run each job to completion, in order. Returns (name, finish time).
Jobs batch(const Jobs& jobs) {
Jobs done;
int t = 0;
for (auto [name, need] : jobs) {
t += need;
done.push_back({name, t});
}
return done;
}
// Give each job at most `quantum` ms, then send it to the back.
Jobs timeSharing(const Jobs& jobs, int quantum) {
Jobs done;
deque<pair<char, int>> ready(jobs.begin(), jobs.end());
int t = 0;
while (!ready.empty()) {
auto [name, left] = ready.front();
ready.pop_front();
int run = min(quantum, left);
t += run;
if (left > run) ready.push_back({name, left - run}); // preempted: back of the queue
else done.push_back({name, t});
}
return done;
}
void show(const char* label, const Jobs& done) {
printf("%s: ", label);
int sum = 0;
for (size_t i = 0; i < done.size(); i++) {
printf("%s%c %d", i ? ", " : "", done[i].first, done[i].second);
sum += done[i].second;
}
printf(" | average %.2f\n", (double)sum / done.size());
}
int main() {
Jobs jobs = {{'A', 4}, {'B', 3}, {'C', 2}};
show("batch", batch(jobs));
show("time-sharing", timeSharing(jobs, 2));
}import java.util.ArrayDeque;
import java.util.LinkedHashMap;
import java.util.Map;
class Main {
static final String[] NAMES = {"A", "B", "C"};
static final int[] NEED = {4, 3, 2}; // ms; all ready at t = 0
// Run each job to completion, in order. Returns finish time per job.
static Map<String, Integer> batch() {
Map<String, Integer> done = new LinkedHashMap<>();
int t = 0;
for (int i = 0; i < NAMES.length; i++) {
t += NEED[i];
done.put(NAMES[i], t);
}
return done;
}
// Give each job at most `quantum` ms, then send it to the back.
static Map<String, Integer> timeSharing(int quantum) {
Map<String, Integer> done = new LinkedHashMap<>();
ArrayDeque<int[]> ready = new ArrayDeque<>(); // {job index, ms left}
for (int i = 0; i < NAMES.length; i++) ready.add(new int[]{i, NEED[i]});
int t = 0;
while (!ready.isEmpty()) {
int[] job = ready.poll();
int run = Math.min(quantum, job[1]);
t += run;
if (job[1] > run) ready.add(new int[]{job[0], job[1] - run}); // preempted: back of the queue
else done.put(NAMES[job[0]], t);
}
return done;
}
static void show(String label, Map<String, Integer> done) {
StringBuilder sb = new StringBuilder(label + ": ");
int sum = 0;
for (Map.Entry<String, Integer> e : done.entrySet()) {
if (sum > 0) sb.append(", ");
sb.append(e.getKey()).append(' ').append(e.getValue());
sum += e.getValue();
}
System.out.println(sb + String.format(" | average %.2f", (double) sum / done.size()));
}
public static void main(String[] args) {
show("batch", batch());
show("time-sharing", timeSharing(2));
}
}Step through it
Running on A = 4 ms, B = 3 ms, C = 2 ms; quantum 2 ms
Real-Time Systems
A real-time OS is judged on whether every task finishes before its deadline, every time. Fast on average is not enough. In a hard real-time system, such as anti-lock brakes or a pacemaker, a late answer counts as a failure. In a soft real-time system, such as video playback, a late answer only lowers quality.
To make timing predictable, these systems schedule by priority or deadline and avoid anything with variable delays, such as paging to disk. VxWorks, QNX and FreeRTOS are common examples. The full story is in real-time operating systems.
- Goal: every deadline met
- Hard real-time: a miss is a failure; soft real-time: a miss lowers quality
Multiprocessor, Distributed and Network Systems
A multiprocessor OS runs one system across several CPUs that share memory, and must decide which core each thread runs on. Every phone, laptop and server sold today has several cores, so this is now the normal case; see multiprocessor systems.
A distributed OS goes further: separate computers, each with its own memory, joined by a network and presented as one system. A network OS is looser: each machine keeps its own OS, and the server shares files, printers and user accounts across the network. Novell NetWare and Windows Server are network operating systems. More in distributed operating systems.
- Multiprocessor: many CPUs, one shared memory
- Distributed: many computers acting as one
- Network OS: separate machines sharing files, printers and accounts
Embedded and Mobile Systems
An embedded OS runs fixed software on dedicated hardware: a washing machine, a car's engine controller, a router. It may have only kilobytes of memory and no disk, and it often has real-time deadlines too. FreeRTOS and Zephyr are typical; many routers run a trimmed Linux.
A mobile OS adds battery life and touch input to the design. Android (on the Linux kernel) and iOS suspend background apps, group timer wake-ups to save power, and close background apps when memory runs low instead of swapping to flash storage.
- Embedded: one job, small memory, often real-time
- Mobile: battery and memory pressure shape every decision
Single-User and Multi-User Systems
A single-user system serves one person at a time. MS-DOS was single-user and single-tasking: one program at a time. Windows 95 and classic Mac OS were single-user but multitasking.
A multi user operating system lets many people use one machine at the same time, each with their own account, files and processes, kept apart by the OS. Unix and Linux servers are the standard example: dozens of users can be logged in over SSH at once. This needs protection between users, which a single-user system can skip.
- Single-user: one person at a time (MS-DOS, classic Mac OS)
- Multi-user: many accounts at once, isolated from each other (Unix, Linux servers)
Comparing the Types
The same kernel can serve several types. Linux runs in routers, phones, desktops and supercomputers; what changes is the configuration of the scheduler and memory manager. The table lists each type with examples and what it is built to optimise.
| Type | Optimises | Typical examples |
|---|---|---|
| Batch | Jobs finished per hour | Payroll runs, cluster job queues |
| Time-sharing | Response time | Unix, Linux, Windows, macOS |
| Real-time | Meeting every deadline | VxWorks, QNX, FreeRTOS |
| Distributed | Many machines acting as one | Amoeba, Plan 9 (research systems) |
| Embedded | Small size, fixed job | Routers, car controllers, appliances |
| Mobile | Battery life and touch response | Android, iOS |
- A desktop OS mixes types: interactive apps, background batch work and soft real-time audio