Three things at once
Your phone plays music. A chat message arrives. A game is open too.
One small processor does all of this. Who decides what runs and when? The operating system is the main program that runs the computer. Different jobs need different kinds of it.
Key words
| Word | What it means | Example |
|---|---|---|
| Operating system | The main program. It runs the computer and shares its parts between other programs. | Windows, Linux, Android |
| Batch | Jobs are collected and run later, one after another. Nobody waits for the result. | Printing 10000 bills (papers that say how much to pay) at night |
| Scheduling | Choosing which job runs next, and when. | Run the jobs in a set order |
| Multitasking | Running many programs at the same time. | Music and chat together |
| Time-slicing | Giving each program a very short turn on the processor, again and again. | 10 milliseconds each (1 millisecond is one thousandth of a second) |
| Interrupt | A signal that says "stop, I need attention now". | A key press |
| Real-time | The answer must come within a fixed, short time. | A car airbag |
| Network | Computers joined together so they can share things. | College Wi-Fi |
The cells students fill in are left blank in this preview.
Five types at a glance
| Type | Main idea | Key features | Example use |
|---|---|---|---|
| Batch | Run big jobs later, with no user | No user waiting, very many jobs, scheduling | Paying wages, printing bills |
| Multitasking | Many programs seem to run together | Time-slicing, interrupts | A laptop or phone |
| Real-time | Always answer in time | Monitoring and control, transaction processing (payments and bookings) | Airbags, robots, card payments |
| Network | Look after a whole network | Resource sharing (many people use one printer or files), user management, communication | A college server |
| Mobile | Work well on small devices | Small processor, long battery life | Android, iOS |
The cells students fill in are left blank in this preview.
Batch and multitasking
A batch system has no user waiting. The jobs wait in a line (a queue). Scheduling decides the order. A company pays all its workers at night. Nobody types, and the machine stays busy.
Multitasking is different. You are there, and you want many things now. The processor gives each program a short turn. This is time-slicing. It happens so fast that all the programs seem to run together.
Try it: time-slicing
# The processor gives each task one short slice of time, in turn, again and again.
tasks = ["music", "chat", "game"]
for round_number in range(1, 4):
for name in tasks:
print("Round", round_number, "->", name, "gets a slice")
# Add a new task, such as "photos", and run it again.
What is an interrupt?
data-callouts.note.label
You press a key while the processor is busy. The keyboard sends an interrupt. The processor pauses, does what the key asks, then goes back to its work. Without interrupts the computer would not notice you.
Extra: Meet a real operating system
uname -srA command for the lesson’s lab terminal. It is shown here and not run.
Extra: See many tasks at once
ps -e | head -8A command for the lesson’s lab terminal. It is shown here and not run.
Extra: Count the tasks
ps -e | wc -lA command for the lesson’s lab terminal. It is shown here and not run.
Extra: What you saw
data-callouts.note.label
The first command named the operating system, Linux. The second listed tasks that run now. The third counted them. A small server already runs many tasks, and each one gets short turns on the processor.
Real-time operating systems
A real-time operating system must answer inside a fixed time. A late answer is a wrong answer.
It is used for monitoring and control: an airbag, a factory robot, a heart monitor. It is also used for transaction processing: a card payment or a plane seat booking must finish at once and without mistakes. A transaction is one payment or one booking.
Quick check: real-time
Have a go
Quick check: real-time
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.