Software
Hardware on its own does nothing. Software is the set of programs that tell the
hardware what to do. This chapter looks at the two broad kinds of software, the
operating system that manages everything, how the CPU responds to urgent events
through interrupts, and the languages and tools programmers use to create software in
the first place.
THESE NOTES BRIEFLY COVERS THE FOLLOWING
• 01System vs Application
• 02Operating System Functions
• 03The Software Layers
• 04Interrupts
• 05High and Low Level Languages
• 06Assembly Language
• 07Compilers vs Interpreters
• 08Assemblers
• 09Integrated Development Environments
System Software vs Application Software
All software falls into two categories, based on who it serves: the computer itself, or the
user.
SYSTEM SOFTWARE APPLICATION SOFTWARE
Purpose Provides the services the computer needs to Provides the services the user
operate and manages the hardware needs to complete tasks
Runs on Directly manages the hardware Runs on top of the operating
system
Examples Operating systems (Windows, Linux, Word processor, web browser,
macOS), utility programs, device drivers, spreadsheet, games, photo editor
antivirus, disk defragmenter
QUICK TEST
Ask "is this for the user or for the machine?" A web browser helps you complete a task,
so it is application software. A device driver lets the operating system talk to a printer, so
it is system software.
Functions of the Operating System
The operating system (OS) is system software that manages the computer's hardware
and software resources and provides a platform on which applications can run. You
should be able to name and describe its main functions.
Computer Science Notes @abzmcwenzy
FUNCTION WHAT IT DOES
Managing files Organises files into directories, handles reading and writing, and
manages file permissions
Handling interrupts Receives and prioritises interrupt signals and runs the matching
interrupt service routines
Providing an interface Gives the user a way to interact, either a graphical interface (GUI)
or a command-line interface (CLI)
Managing peripherals Loads device drivers so hardware such as a printer or keyboard
and drivers works with the OS
Managing memory Allocates RAM to running programs and manages virtual memory
Managing multitasking Allows several programs to run at once by rapidly switching CPU
time between them
Platform for applications Provides interfaces so applications can use the hardware without
controlling it directly
Managing security Handles authentication, access control and firewall settings
Managing user accounts Creates and manages user profiles, permissions and login details
IN THE EXAM
If asked to "describe" rather than just "state" a function, add what it achieves. For
example: "managing memory: the OS allocates areas of RAM to each running program
so they do not overwrite one another."
Computer Science Notes @abzmcwenzy
Hardware, Firmware and the OS: the Software
Layers
Software runs in layers, and each layer depends on the one below it. Understanding this
stack explains how a program you click on eventually controls the hardware.
Application Software
The programs the user runs, such as a browser or game
runs on ↓
Operating System
Manages hardware and provides a platform for applications
runs on ↓
Firmware (Bootloader, BIOS or UEFI)
Permanent software in ROM that starts the hardware and loads the OS
runs on ↓
Hardware
The physical components: CPU, memory, storage and devices
Firmware is software permanently stored in ROM on the hardware. The bootloader,
which is a piece of firmware, initialises the hardware and loads the operating system
when the computer is switched on.
Interrupts
An interrupt is a signal sent to the CPU telling it that an event needs immediate
attention. The CPU pauses what it is doing, deals with the event, and then carries on
exactly where it left off. Interrupts are how a computer responds instantly to things like a
key press while still running other programs.
W A T C H I T How the CPU handles an interrupt
The steps in handling an interrupt
1. A device or program generates an interrupt signal
2. The CPU finishes its current instruction (not the whole task)
3. The CPU saves its current state, the registers and program counter, onto the
stack
4. The CPU runs the appropriate interrupt service routine (ISR)
5. When the ISR finishes, the CPU restores the saved state and resumes the
original task exactly where it paused
Computer Science Notes @abzmcwenzy
Two kinds of interrupt
HARDWARE
SOFTWARE INTERRUPTS
INTERRUPTS
Generated by a physical Generated by a running program
device
Pressing a key on the An attempt to divide by zero
keyboard
Moving the mouse Two processes trying to access the same memory location
A printer finishing a print job A program requesting an operating system service (a system
call)
WHY SAVE THE STATE?
The CPU saves its registers and program counter so that, once the urgent event is dealt
with, it can pick up the original task exactly where it left off, as if nothing had happened.
Without saving state, the paused task would be lost.
High Level and Low Level Languages
Programming languages sit on a scale. High level languages are close to human
language and easy to work with. Low level languages are close to the machine and
harder for humans but give precise control.
Computer Science Notes @abzmcwenzy
HIGH LEVEL LANGUAGE LOW LEVEL LANGUAGE
Readability English-like syntax, easy to read and Uses mnemonics or binary,
write hard to read
Debugging Easier, the code is logical and Harder, you must trace binary
structured or mnemonics
Machine Portable, runs on different machines Machine specific, written for
independence with the right translator one type of CPU
Hardware control Cannot directly control hardware Direct access to hardware
registers and memory
Speed Slightly slower after translation Very fast, runs directly or
almost directly
Examples Python, Java, C++, [Link] Assembly language, machine
code
Assembly Language
Assembly language is a low level language that uses mnemonics, short human-
readable codes, to represent machine code instructions. It is much easier to follow than
raw binary while still giving direct control over the hardware.
; A short assembly program
LDA 5 ; Load the value from memory address 5 into the accumulator
ADD 3 ; Add the value from address 3 to the accumulator
STA 10 ; Store the result into memory address 10
HLT ; Halt, stop execution
KEY FACT
One assembly instruction corresponds to exactly one machine code instruction. This is
different from a high level language, where a single line may produce many machine
code instructions.
Computer Science Notes @abzmcwenzy
Compilers and Interpreters
A high level language cannot be run directly by the CPU. It must first be translated into
machine code. There are two ways to do this, and the difference is a frequent exam
topic.
COMPILER INTERPRETER
How it translates The entire source code at once One line at a time, executing as it
goes
Output Produces a standalone executable No executable file is produced
file
Speed when Faster, it is already translated Slower, it translates every time it
running runs
Errors Reports all errors together after Stops at the first error it meets
compiling
Typically used The final released version of a Developing and testing a
for program program
THE EXAM DISTINCTION
Compiler: full error report after compiling, used for the final release. Interpreter: stops at
the first error, easier for testing during development. Learn this pairing, it comes up
almost every year.
Assemblers
An assembler is the translator for assembly language. It converts an assembly
language program into machine code. Because each assembly instruction maps to
exactly one machine code instruction, the assembler's job is a direct one-to-one
translation.
THE THREE TRANSLATORS
A compiler and an interpreter both translate high level languages.
An assembler translates assembly language. All three turn human-written code into
machine code the CPU can run.
Computer Science Notes @abzmcwenzy
Integrated Development Environments (IDEs)
An IDE is an application that gives programmers a complete set of tools for writing,
testing and debugging code, all in one place. Instead of switching between separate
programs, everything is combined.
FEATURE WHAT IT DOES
Code editor A text editor with syntax highlighting and formatting for writing
code
Run-time Lets the program be run and tested inside the IDE
environment
Translator A built-in compiler or interpreter to translate and run the code
Error diagnostics Highlights syntax errors as you type and shows error messages
Auto-completion Suggests completions for variable names, functions and keywords
Auto-correction Suggests or applies fixes for common mistakes automatically
Prettyprint Automatically formats code with correct indentation and spacing
Computer Science Notes @abzmcwenzy
Exam Practice
4 marks
Q1. Describe the difference between system software and application software, giving
two examples of each.
ANSWER
System software provides the services the computer needs to operate and manages the
hardware, for example an operating system and a device driver. Application software
provides the services the user needs to complete tasks and runs on top of the operating
system, for example a word processor and a web browser.
4 marks
Q2. State four functions of an operating system.
ANSWER
Any four of: managing files, handling interrupts, providing a user interface, managing
peripherals and drivers, managing memory, managing multitasking, providing system
security, and managing user accounts.
5 marks
Q3. Describe the steps the CPU takes when it receives an interrupt.
ANSWER
A device or program generates an interrupt signal. The CPU finishes its current instruction,
then saves its current state, the registers and program counter, onto the stack. It runs the
appropriate interrupt service routine to deal with the event. Once the routine finishes, the
CPU restores the saved state and resumes the original task from where it paused.
2 marks
Q4. Give one hardware interrupt and one software interrupt.
ANSWER
A hardware interrupt is a physical event such as pressing a key on the keyboard or a printer
finishing a job. A software interrupt is generated by a program, such as an attempt to divide
by zero or a request for an operating system service.
4 marks
Q5. Compare how a compiler and an interpreter translate a high level language program
and report errors.
ANSWER
A compiler translates the entire source code at once and produces a standalone executable
file, then reports all the errors it found together after compilation. An interpreter translates
and executes the code one line at a time, producing no executable file, and stops as soon as
it reaches the first error.
3 marks
Q6. Explain what an IDE is and describe two features it provides.
ANSWER
An IDE is an application that provides a complete set of tools for writing, testing and
debugging code in one place. Two features, for example: a code editor with syntax
highlighting for writing code, and error diagnostics that highlight syntax errors as the
programmer types.
Computer Science Notes @abzmcwenzy