Types of Software and Interrupts
The two families of software, what an operating system does, how hardware, firmware and the operating system work together to run an application, and how the processor handles an interrupt.
WATCH IT EXPLAINED
EXPLORE IT IN 3D
The software stack
An office PC with its lid off and its software lifted out above it, layer by layer. Sort it, start it, share the processor out, then interrupt it in the middle of a song.
Two kinds of software
System software serves the computer; application software serves the person using it.
| System software | Application software | |
|---|---|---|
| Provides | the services that the computer requires | the services that the user requires: a job the user wants done |
| Examples | operating system, utility software, device drivers, translators (compilers and interpreters) | word processor (writing an essay), spreadsheet (working out sums), web browser, photo editor, video player, games |
Remember:To sort any example, ask one question. Is it there for the computer, or for the person using it?
Utility software
A utility is small system software that looks after the computer, not the user's task.
Utility software is a small piece of system software. It looks after the computer instead of doing the user's task.
| Utility | What it does |
|---|---|
| Anti-malware, including anti-virus | finds and removes malware, such as viruses |
| Disk defragmenter | moves the scattered pieces of each file on a hard disk back next to each other |
| Backup | copies files, so they can be restored if the originals are lost |
| Compression | makes files smaller |
| Disk formatting | prepares a disk so it can store files |
After defragmenting, the read/write head moves less, so the file is read faster.
Watch out:An SSD has no moving parts, so it does not need defragmenting.
In an answer, name the utility and say what it does.
Each layer runs on the one below
Software sits in layers: each layer runs on the one below, down to the hardware.
| Layer | Runs on |
|---|---|
| Application | the operating system |
| Operating system | the firmware |
| Firmware (the bootloader) | the hardware |
| Hardware: CPU, RAM, ROM, storage | nothing: it is the bottom layer |
Firmware is software stored permanently on the hardware itself, in ROM or flash memory. It is still there after the power has been off.
What happens when you switch on:
- RAM is volatile, so it is empty.
- The processor runs the bootloader from ROM.
- The bootloader loads the operating system from secondary storage into RAM.
- Only then can an application be loaded and run.
An application never talks to the hardware itself
An application asks the operating system, and the OS uses a device driver to talk to each device.
One job of the operating system (OS) is providing a platform for running applications.
An application asks the OS for everything that touches the hardware: saving a file, printing, reading the keyboard.
The OS reaches each device through its device driver.
Exam:A device driver is software that translates the operating system's general commands into the exact commands that one device understands.
So:
- a new printer needs its driver installed.
- the same application can print on any printer that has a driver.
The nine jobs of an operating system
The operating system runs all the time and does nine jobs, named in the syllabus.
The OS runs the whole time the computer is on. A few minutes of ordinary use makes it do all nine jobs.
| Syllabus name | What it means |
|---|---|
| Managing files | where files are kept: folders and names |
| Handling interrupts | responds when a device or program asks |
| Providing an interface | a GUI or a command line for the user |
| Managing peripherals and drivers | keyboard, printer, disks, through drivers |
| Managing memory | which program uses which part of RAM |
| Managing multitasking | shares processor time between programs |
| Providing a platform for running applications | applications run on it and use it |
| Providing system security | passwords and access rights |
| Managing user accounts | each user's own files and settings |
Exam:Use the syllabus name, then add a few words on what it means.
Step through the figure: it lights up the jobs each action uses.
Multitasking is taking turns, very fast
Multitasking means the processor takes turns between processes so fast that they all seem to run together.
A single-core processor runs only one process at a time.
In multitasking, the operating system gives each process a short time slice in turn. It switches between them so quickly that they all seem to run at the same time.
At each switch, the OS:
- saves the state of the process it stops: the contents of the registers.
- loads the saved state of the next process.
This is the same save and restore that an interrupt uses. A timer interrupt tells the OS when each time slice is over.
M Music 4, B Browser 6, W Word 3
(units of work each process needs)
time slice 1 MBWMBWMBWMBBB
time slice 2 MMBBWWMMBBWBB
time slice 3 MMMBBBWWWMBBBWhat an interrupt is
An interrupt is a signal telling the processor that something needs its attention now.
Exam:An interrupt is a signal sent to the processor saying that something needs its attention now. It is generated by an event.
A hardware interrupt is sent by a device:
- a key is pressed on the keyboard
- the mouse is moved
- a printer runs out of paper
A software interrupt is caused by a program:
- a division by zero
- two processes try to access the same memory location
Why have interrupts? Without them, the processor would keep asking every device, "Has anything happened?" Most of the time the answer would be no.
How an interrupt is handled
The processor finishes its instruction, saves its registers, runs the ISR, then restores them and carries on.
- The interrupt signal arrives.
- The processor finishes the instruction it is executing. It does not stop half-way.
- At the end of that fetch-decode-execute cycle, it checks for interrupts and finds one waiting.
- It saves its current state onto a stack: the contents of its registers, including the program counter (PC).
- It runs the interrupt service routine (ISR) for that interrupt.
- It restores the saved registers from the stack.
- The interrupted program carries on exactly where it stopped.
Remember:The saved PC holds the address of the next instruction, so nothing is lost. The next note shows when a program cannot carry on.
What happens as a result
What the ISR does depends on the interrupt, and a more urgent interrupt is served first.
| Interrupt | What the ISR does | Then |
|---|---|---|
| A key press | stores the key's code, so the program can use it | the program carries on |
| A printer out of paper | shows a message to the user | printing waits |
| A division by zero | shows an error message | the program that caused it may be stopped |
Watch out:A stopped program does not carry on. Its saved registers are never restored.
What if another interrupt arrives while an interrupt service routine (ISR) is running? The processor compares their priorities:
- A higher-priority interrupt is serviced first.
- A lower-priority one waits its turn.
System software runs the computer; application software does a job for the user.
PICK ONE, THEN PICK ITS GROUP
- empty
- empty
KEY TERMS
CHECK YOURSELF
1.What loads the operating system into RAM when a computer is switched on?
2.What happens before the ISR runs?
3.Which of these is a software interrupt?
4.A computer with one single-core processor plays music while you type an essay. How?
5.Which of these is utility software?