Operating systems have been designed for very different needs: running jobs in bulk, serving many users at once, using many processors, or reacting within a fixed time.
Batch Systems
In a batch system, users prepare jobs (program, data and control cards) and hand them to an operator, who groups similar jobs into batches that run one after another, with no user interaction. A resident monitor loads each job in turn. Batch systems used the computer better than manual operation, but the CPU sat idle while slow I/O took place, and users had to wait a long time for results. Payroll and bank statement processing still use batch processing today.
Definition: Multiprogramming. A technique in which several jobs are kept in memory at the same time, and the CPU switches to another job whenever the current one must wait, so that the CPU is kept busy.
Multiprogramming and Time-Sharing
In multiprogramming, several jobs are kept in memory at once. When the running job waits for I/O, the OS switches the CPU to another job, so the CPU is rarely idle. This raises CPU utilisation, but there is still no direct interaction with the user. Time-sharing, or multitasking, extends multiprogramming: the CPU switches among jobs so often, every few milliseconds (a time slice), that each user can interact with his or her program and feels that the computer is all theirs. Time-sharing needs CPU scheduling, memory management and protection, and gives a short response time. UNIX and all modern desktop systems are time-sharing systems.
Parallel Systems
A parallel or multiprocessor system has two or more CPUs that share memory and a clock. Its advantages are greater throughput, economy of scale, and reliability, since the failure of one CPU only slows the system. In symmetric multiprocessing (SMP), every CPU runs the same OS and shares the work. In asymmetric multiprocessing, a master CPU assigns work to the others. Modern multi-core processors are parallel systems.
Distributed Systems
A distributed system is a collection of separate computers, each with its own memory, connected by a network, which appears to its users as a single system. It allows resource sharing, computation speed-up, reliability and communication. Examples are cloud platforms, web search systems and distributed databases. They may be client-server or peer-to-peer.
Real-Time Systems
A real-time system must respond to events within a fixed time limit (deadline). In a hard real-time system, missing a deadline is a failure, as in air-bag control, pacemakers and missile guidance. In a soft real-time system, a missed deadline lowers quality but is tolerated, as in video streaming and online games. Examples are VxWorks and FreeRTOS. Other types are network, mobile, embedded and multi-user operating systems.
Table 1.3: Types of operating systems
| Type | Key idea | Example use |
|---|---|---|
| Batch | Jobs run in groups, no interaction | Payroll |
| Multiprogramming | Several jobs in memory, CPU kept busy | Early mainframes |
| Time-sharing | Rapid switching, interactive users | UNIX, Windows |
| Parallel | Several CPUs share memory | Multi-core servers |
| Distributed | Networked computers act as one | Cloud platforms |
| Real-time | Responses within deadlines | Air-bag control |
Example 1.3: CPU utilisation with multiprogramming
Problem: A job computes for 20 ms and then waits 80 ms for I/O, repeatedly. Find the CPU utilisation with one job in memory, and estimate it with three such jobs, assuming their waits do not overlap badly.
Solution:
- One job: busy 20 ms out of every 100 ms, so utilisation = 20 percent.
- With n jobs, a rough model gives utilisation = 1 − p^n, where p = 0.8 is the fraction of time a job waits.
- With three jobs: 1 − 0.8³ = 1 − 0.512 = 0.488.
Result: Utilisation rises from 20 percent to about 49 percent with three jobs.
#include <stdio.h>
#include <math.h>
int main(void) {
double p = 0.8;
for (int n = 1; n <= 6; n++)
printf("%d jobs: CPU utilisation = %.1f%%\n",
n, (1 - pow(p, n)) * 100);
return 0;
}
Output
1 jobs: CPU utilisation = 20.0%
2 jobs: CPU utilisation = 36.0%
3 jobs: CPU utilisation = 48.8%
4 jobs: CPU utilisation = 59.0%
5 jobs: CPU utilisation = 67.2%
6 jobs: CPU utilisation = 73.8%
Common mistakes
- Treating multiprogramming and time-sharing as the same. Time-sharing adds interaction and time slices.
- Calling any fast system real-time. Real-time means meeting deadlines.
- Confusing parallel systems (shared memory) with distributed systems (separate memories).
Key takeaways
- Batch systems run jobs in groups without interaction.
- Multiprogramming keeps the CPU busy; time-sharing adds interactive response.
- Parallel systems share memory; distributed systems connect separate computers.
- Hard real-time systems must never miss deadlines.
Practice questions
- What is time-sharing?
- Distinguish hard and soft real-time systems.
- What is symmetric multiprocessing?
Answers to the practice questions
- Rapid switching of the CPU among users' programs in small time slices so that each user can interact with the computer.
- In a hard real-time system a missed deadline is a failure; in a soft one it only lowers quality.
- A parallel system in which every CPU runs the same OS and shares the work equally.
Sources
- Official BCA syllabus Operating Systems, course code 25BCA402DS03, Unit I
