Chapter 02 of 38

Types of Operating Systems

The operating system in your phone, the one on a bank's server, and the one inside a car's airbag controller are all "operating systems", but they are built for very different goals. A phone must feel responsive and save battery. A server must handle thousands of requests per second. An airbag controller must react within a few milliseconds, every single time.

Over the years, operating systems have evolved through several designs, and each design solved a problem the earlier one had. In this chapter we will walk through the main types of operating systems in roughly historical order, understand why each one was invented, and compare the terms that students most often confuse: multiprogramming, multitasking and multiprocessing.


1. Batch Operating System

In the 1950s and 60s, computers were extremely expensive and there was no interactive screen. Programmers wrote their programs on punched cards and handed them to a computer operator.

To save time, the operator grouped similar jobs together (for example, all FORTRAN jobs) into a batch and fed them to the computer one after another. A small resident program called the monitor automatically loaded the next job as soon as the previous one finished.

A Batch Operating System collects jobs with similar needs into batches and runs them one after another without any interaction with the user while they run.

  Job 1  -->  Job 2  -->  Job 3  -->  Job 4  --> ...
 (runs to   (starts only
 completion) after Job 1 ends)

Advantages

  • Less idle time between jobs than manual loading

  • Good for large, repetitive work (payroll, bank statements, billing)

Disadvantages

  • No interaction: you submit a job and wait, maybe for hours, to see that you had a syntax error

  • The CPU sits idle whenever the running job waits for slow I/O (card reader, tape, printer)

  • One job stuck in an infinite loop could hold the machine

The idea is not dead. Overnight report generation, payroll processing and scheduled data-processing jobs on servers are still called "batch jobs" today.

Spooling

A related idea from this era is SPOOLing (Simultaneous Peripheral Operations On-Line). Instead of making the CPU wait for a slow printer, output is first written quickly to the disk, and the printer reads it from the disk at its own speed. Print queues on modern computers still work this way.


2. Multiprogramming Operating System

The big problem with batch systems was CPU idle time. When a job reads from a tape, the CPU, the most expensive part of the machine, just waits.

The fix: keep several jobs in memory at the same time. When the running job has to wait for I/O, the OS gives the CPU to another job that is ready.

A Multiprogramming Operating System keeps multiple programs in main memory at once, so that the CPU always has something to execute when the current program waits for I/O. The goal is to maximise CPU utilization.

Worked Example

Two jobs. Each one uses the CPU, then waits for I/O, then uses the CPU again (times in milliseconds):

Job

CPU

I/O

CPU

A

2

3

2

B

3

2

1

Without multiprogramming (one job in memory at a time), B can start only after A finishes completely:

Time:  0    2         5    7         10        12 13
CPU:   [ A ][  idle   ][ A ][    B    ][  idle  ][B]
I/O:        [ A I/O   ]               [ B I/O  ]

Total time = 13 ms, CPU busy = 2+2+3+1 = 8 ms
CPU utilization = 8 / 13 = 61.5%

With multiprogramming (both jobs in memory; assume each job uses a different I/O device so their I/O can overlap):

Time:  0    2         5    7  8
CPU:   [ A ][    B    ][ A ][B]
I/O:        [ A I/O   ][B I/O]

At t=2, A starts I/O  -> CPU switches to B
At t=5, B starts I/O  -> A's I/O is finished, A gets the CPU
At t=7, A is done     -> B's I/O is finished, B gets the CPU

Total time = 8 ms, CPU busy = 8 ms
CPU utilization = 8 / 8 = 100%

The same work finished in 8 ms instead of 13 ms, and the CPU was never idle. That is the whole point of multiprogramming. (Real systems rarely reach 100%, but the improvement is real.)

How Much Does More Multiprogramming Help?

A common textbook approximation: if a process spends a fraction p of its time waiting for I/O, and n processes are in memory, then the CPU is idle only when all of them are waiting at the same time. Treating them as independent, that probability is pn, so:

CPU utilization ≈ 1 − p^n

For a typical I/O-heavy process with p = 0.8 (80% waiting):

Processes in memory (n)

CPU utilization

1

20.00%

2

36.00%

4

59.04%

8

83.22%

The number of programs in memory at once is called the degree of multiprogramming. Raising it helps, but only up to a point: memory is limited, and with too many processes the system can start thrashing (you will meet this in the chapter on Thrashing). Also remember this formula is a simplified model; real processes are not perfectly independent.

What multiprogramming does not solve: a job only gives up the CPU when it waits for I/O. A long CPU-heavy job can still keep the CPU for a long time, so it is still not good for interactive users.


3. Multitasking (Time-Sharing) Operating System

By the 1960s and 70s, people wanted to sit at terminals and interact with the computer. If you type a command and wait one minute because someone else's job is computing, the system is unusable.

The solution was time-sharing: the CPU is given to each program for a small slice of time, called a time quantum or time slice (typically a few milliseconds). When the slice ends, a timer interrupt brings control back to the OS, which switches to the next program, even if the current one has not finished or asked for I/O.

A Multitasking (Time-Sharing) Operating System rapidly switches the CPU among many programs, giving each a short time slice, so that every user or program gets a quick response and feels like it has the computer to itself. The goal is to minimise response time.

Time slice = 10 ms

CPU:  [P1][P2][P3][P1][P2][P3][P1][P2][P3] ...
      0   10  20  30  40  50  60  70  80  90 ms

Each program gets the CPU at least once every 30 ms.
To a human, that looks like all three are running at the same time.

Multitasking is really multiprogramming + time slicing (preemption by a timer). Every desktop and phone OS today is a multitasking OS: Windows, Linux, macOS, Android and iOS.

Advantages: fast response, many users or apps at once, no single program can hog the CPU.

Disadvantages: switching between programs costs some time (context switch overhead), and the OS becomes more complex (it needs CPU scheduling, memory protection, and synchronization).

How the OS chooses which program runs next is the subject of CPU Scheduling Basics and Round Robin Scheduling.


4. Multiprocessing Operating System

Multiprogramming and multitasking work even with a single CPU. A multiprocessor system has two or more CPUs (or cores) sharing memory, and the OS can run several programs truly in parallel.

A Multiprocessing Operating System manages a computer with multiple processors (or cores) and schedules work on all of them so that several programs or threads execute at exactly the same time.

Your laptop with an 8-core CPU is a multiprocessor system, and Windows, Linux and macOS are multiprocessing operating systems.

Symmetric vs Asymmetric Multiprocessing

Feature

Symmetric (SMP)

Asymmetric (AMP)

Role of processors

All processors are equal; any CPU can run the kernel or user programs

One master processor controls the system and gives work to the others

Failure

If one CPU fails, others continue

If the master fails, the system is in trouble

Complexity

More complex OS (shared kernel data must be protected with locks)

Simpler OS design

Used in

Almost all modern desktops, laptops, servers and phones

Some embedded and older systems

Advantages of multiprocessing:

  • Higher throughput – more work done per second

  • Reliability – the system can keep running if one processor fails (graceful degradation)

  • Economy – processors share memory, disks and power supply

Note: N processors do not give N times the speed. Some work cannot be parallelised, and processors spend time coordinating with each other.


Multiprogramming vs Multitasking vs Multiprocessing

This comparison is a favourite in exams and interviews.

Feature

Multiprogramming

Multitasking

Multiprocessing

Main idea

Many programs in memory; switch when one waits for I/O

Many programs share the CPU using time slices

Many CPUs/cores run programs in parallel

Number of CPUs needed

One is enough

One is enough

Two or more

When the CPU switches

Only when the running program waits (non-preemptive)

On I/O wait and when the time slice ends (preemptive)

Each CPU switches like in multitasking

Main goal

Maximise CPU utilization

Minimise response time

Increase throughput / true parallelism

Truly simultaneous?

No (concurrent)

No (concurrent)

Yes (parallel)

Concurrency vs parallelism: Concurrency means several tasks are in progress during the same period (they take turns). Parallelism means several tasks are executing at the same instant. One CPU can give you concurrency; you need multiple CPUs for parallelism.

You may also hear multithreading: running several threads of the same program concurrently. That is covered in Threads & Multithreading.


5. Network Operating System

A Network Operating System (NOS) runs on a server and provides services such as shared files, printers, user accounts and security to client computers over a network. Each machine still has its own OS, and users know that they are accessing a remote machine (for example, a shared drive \\fileserver\notes).

Examples: Windows Server, Linux servers running Samba or NFS, and historically Novell NetWare.


6. Distributed Operating System

A Distributed Operating System manages a group of independent computers connected by a network and makes them appear to the user as one single computer. The user does not know (or care) which machine actually ran their program or stored their file.

Network OS

Distributed OS

Each computer has its own OS; they share services

The whole group behaves like one system

User is aware of remote machines

Remote machines are hidden (transparency)

Easier to build, very common

Hard to build; mostly research systems (Amoeba, Plan 9)

Advantages of distributed systems: resource sharing, more computing power, reliability (one machine failing does not stop everything), and scalability.

In practice today, the "single system" feeling is usually provided by middleware and cluster software running on top of normal operating systems, for example Kubernetes managing containers on many Linux machines, or distributed databases. The goals are the same as a distributed OS even though each machine runs ordinary Linux.


7. Real-Time Operating System (RTOS)

In some systems, a correct answer that comes late is a wrong answer. An airbag must inflate within a few milliseconds of a crash; a pacemaker must deliver a pulse on time.

A Real-Time Operating System guarantees that tasks are completed within strict time limits (deadlines). Correctness depends not only on the result, but also on when the result is produced.

An RTOS is designed to be predictable (deterministic), not necessarily fast on average. It uses priority-based preemptive scheduling, keeps interrupt handling short, and avoids features with unpredictable delays.

Hard vs Soft Real-Time

Feature

Hard real-time

Soft real-time

Missing a deadline

Is a system failure, can be dangerous

Reduces quality but is tolerable

Examples

Airbag control, anti-lock brakes, pacemaker, flight control, industrial robots

Video streaming, online games, audio playback, VoIP calls

Guarantee

Deadline always met

Deadline usually met; critical tasks get priority

Examples of RTOSes: FreeRTOS, Zephyr, VxWorks, QNX. Linux also has real-time scheduling classes and, since kernel 6.12, the PREEMPT_RT real-time support is part of the mainline kernel, which makes it suitable for many soft and some firm real-time uses.


8. Embedded Operating System

An embedded OS runs inside a device that is not a general-purpose computer: washing machines, smart TVs, routers, smartwatches, cars, medical devices.

  • Small memory and storage footprint

  • Designed for one specific job

  • Often power-efficient and very reliable; many are also real-time

Examples: FreeRTOS and Zephyr on microcontrollers, embedded Linux on routers and smart TVs.


9. Mobile Operating System

A mobile OS is designed for smartphones and tablets. Compared to a desktop OS it focuses on:

  • Battery life – aggressively suspending background apps

  • Touch input and sensors (GPS, camera, accelerometer)

  • Strong app isolation – each app runs in its own sandbox with explicit permissions

  • Wireless connectivity – mobile data, Wi-Fi, Bluetooth

Examples: Android (Linux kernel) and iOS (XNU kernel, same family as macOS).


Quick Comparison of All Types

Type

Key idea

Main goal

Example use

Batch

Run grouped jobs one after another, no interaction

Reduce setup time

Payroll, overnight reports

Multiprogramming

Many jobs in memory, switch on I/O wait

CPU utilization

Early mainframes

Multitasking / time-sharing

Time slices with preemption

Response time

Windows, Linux, macOS

Multiprocessing

Multiple CPUs share memory

Throughput, parallelism

Multicore laptops, servers

Network

Server provides shared services

Resource sharing

Windows Server, Samba

Distributed

Many computers appear as one

Transparency, scalability

Research OSes; clusters

Real-time

Guaranteed deadlines

Predictability

Airbags, medical devices

Embedded

Built into a device

Small, reliable, efficient

Routers, appliances

Mobile

Phones and tablets

Battery, touch, security

Android, iOS

Note that these categories overlap. Linux on a server is multitasking, multiprocessing and network-capable at the same time. Android is a mobile, multitasking, multiprocessing OS.


Common Mistakes

  • Saying multiprogramming and multitasking are the same. Multiprogramming switches only when a job waits; multitasking also switches when the time slice expires. Multitasking is an extension of multiprogramming.

  • Thinking multitasking needs multiple CPUs. It does not. A single core can multitask. Multiple CPUs is multiprocessing.

  • Thinking "real-time" means "very fast". Real-time means predictable and on time. A system that is fast on average but sometimes very slow is not hard real-time.

  • Mixing up network OS and distributed OS. In a network OS, users know about separate machines; in a distributed OS, the machines are hidden behind a single-system view.


Interview Questions

What is the difference between multiprogramming and multitasking?

Multiprogramming keeps several programs in memory and switches the CPU only when the running program waits (for I/O), to maximise CPU utilization. Multitasking adds time slicing: the OS also preempts a program when its time slice ends, to give every program a quick response.

What is the degree of multiprogramming?

The number of processes held in main memory at the same time.

What is the difference between hard and soft real-time systems?

In a hard real-time system, missing a deadline is a failure (airbags, pacemakers). In a soft real-time system, missing a deadline lowers quality but is acceptable (video streaming, games).

What is SMP?

Symmetric multiprocessing: all processors are peers, share the same memory and can run both kernel and user code. Almost all modern multicore systems use SMP.

Concurrency vs parallelism?

Concurrency: multiple tasks make progress in overlapping time periods, possibly by taking turns on one CPU. Parallelism: multiple tasks execute at the same instant on different CPUs.

What is spooling?

Simultaneous Peripheral Operations On-Line: output (or input) for a slow device is buffered on disk so the CPU and programs do not wait for the device. Printer queues are the classic example.


Summary

  • Batch OS: jobs run one after another with no interaction; CPU idles during I/O.

  • Multiprogramming: keep several jobs in memory and switch when one waits, to keep the CPU busy. Utilization ≈ 1 − pn.

  • Multitasking / time-sharing: add time slices and timer preemption for quick response. All modern desktop and phone OSes do this.

  • Multiprocessing: multiple CPUs/cores give true parallelism; SMP is the common design.

  • Network OS shares services; distributed OS makes many machines look like one.

  • Real-time OS guarantees deadlines (hard or soft); embedded and mobile OSes are designed for devices and phones.

Next, in OS Structure & Kernel, we look inside the OS itself: how the kernel is protected from user programs, and the different ways a kernel can be organised.