Home / GCSE · AQA / Computer Science / Computer systems

CS15Software, Programming Languages and Translators

3.4.1 Hardware and software

Hardware and software

Every computer system is made of hardware and software. Learn AQA’s two definitions word for word: examiners want them exactly.

  • Hardware: the physical/electronic components of the computer system. Examples: the CPU, RAM, a solid state drive, a keyboard, a monitor.
  • Software: program/code/instructions executed by the hardware. Examples: an operating system, a web browser, a game.
  • How they depend on each other: software needs hardware to run on, because the instructions are executed by the processor. Hardware needs software to do anything useful, because it only carries out the instructions it is given.
  • The same hardware can do completely different jobs just by running different software.

Software sits in layers on top of the hardware that executes it.

Exam tip“Software is non-physical” isn’t a definition and doesn’t score. Say what it is: program/code/instructions executed by the hardware. And for hardware, give the definition, not just a list of examples.
Hardware
The physical/electronic components of the computer system.
Software
Program/code/instructions executed by the hardware.
3.4.3 Software classification

System software and application software

  • System software manages the computer system resources and acts as a platform to run application software.
  • Examples of system software: an operating system (such as Windows, macOS, Linux, Android or iOS) and utility programs (such as backup or compression software). Translators such as compilers are often counted as system software too.
  • Application software is software that performs end-user tasks: tasks a user might want to do even without a computer, such as writing a letter.
  • Examples of application software: a word processor, a spreadsheet, a web browser, an email client, a photo editor, a game.
  • The test: does it help run and look after the computer (system), or does it do a job for the user (application)?
System softwareApplication software
What it doesManages the computer system resources; a platform to run applicationsPerforms end-user tasks
ExamplesOperating system, utility programsWord processor, web browser, game
Can the computer work without it?Not usefully: there is nothing to manage the hardware or run applicationsYes, but the user can’t do that task
Exam tip“System software comes pre-installed” and “application software is downloaded” score nothing: both kinds can be pre-installed or downloaded. Use the definitions.
System software
Software that manages the computer system resources and acts as a platform to run application software.
Application software
Software that performs end-user tasks.
3.4.3 Operating systems

The operating system

The operating system (OS) is the most important piece of system software. Its role is to hide the complexities of the hardware from the user.

  • Processor management: decides which program gets processor time and switches between them so several programs appear to run at once. On a multi-core CPU it shares the work between the cores.
  • Memory management: gives each running program its own part of main memory, stops programs overwriting each other’s data, and frees the memory when a program closes.
  • Input/output (I/O) device management: communicates with devices such as keyboards, printers and screens (using drivers), so applications don’t need to know how each device works.
  • Application management: loads, runs and closes applications, and lets them use the hardware through the OS.
  • Security: user accounts and passwords, and controlling which users can open which files. (How security methods work is in Network security and protecting systems.)
  • Hiding the hardware is useful because users don’t need to know how the hardware works to use it, and programmers can write applications that ask the OS to, say, save a file, without writing code for each make of drive.
Exam tip“Handles memory” or “deals with security” is too vague. Say manages plus the resource, and add how: “manages memory by giving each running program its own space in RAM”. If the question already names one function, don’t give it back as an answer.
Operating system (OS)
System software whose role is to hide the complexities of the hardware from the user. It manages the processor(s), memory, I/O devices, applications and security.
3.4.3 Utility programs

Utility programs

Utility software is software that can help maintain a system. It is system software, but it does one specific housekeeping job.

  • Backup software: copies files to another place, often on a schedule, so they can be restored if the originals are lost, damaged or encrypted by ransomware.
  • Encryption software: scrambles data so it can’t be understood without the key, for example on a laptop that might be stolen.
  • Compression software: makes files smaller so they take less storage space and are quicker to send.
  • Defragmentation (for magnetic hard disks): moves the parts of each file together so the read/write head moves less and files open more quickly. It isn’t needed on solid state drives.
  • Other common utilities: anti-malware scanners and disk clean-up tools.
Exam tipA utility looks after the computer system. A photo editor or a game isn’t a utility: it is application software.
Utility software
Software that can help maintain a system, for example backup, encryption or compression software.
3.4.4 Low-level languages

Low-level languages: machine code and assembly language

A low-level language is one that is closer to the hardware and the computer’s instruction set. Machine code and assembly language are both low-level languages.

  • Machine code is the actual binary instructions that can be executed by a processor. It is specific to a processor or family of processors.
  • Each type of processor has its own instruction set: the machine-code instructions it understands. Machine code written for one family won’t run on another.
  • Processors execute machine code directly. It is the only language that doesn’t need translating.
  • Assembly language uses mnemonics (short codes like ADD or LOAD) that represent machine-code instructions.
  • Assembly language has a 1:1 correspondence with machine code: each line of assembly becomes exactly one machine-code instruction.
  • Assembly language needs translating (assembling) before it can be run, by an assembler.
  • Assembly language is often used to develop software for embedded systems and for controlling specific hardware components.
Machine codeAssembly language
Written asBinary (0s and 1s)Mnemonics such as ADD, with addresses or values
Run directly by the processor?YesNo: an assembler must translate it first
Readable by peopleVery hard to read or debugEasier to read than binary, though still hard
Processor-specific?YesYes: each line matches one instruction in that processor’s set

One high-level statement becomes several machine-code instructions; each line of assembly becomes exactly one.

Exam tip“Low-level languages don’t need translating” is wrong: assembly language does. Only machine code runs directly. And machine code isn’t compiled: it is what compilers and assemblers produce.
Exam tipFor “two differences between assembly language and machine code”, give two different points with both sides, such as “machine code is binary, assembly uses mnemonics” and “machine code runs directly, assembly must be assembled first”. A point and its reverse count once.
Low-level language
A language that is closer to the hardware and the computer’s instruction set, such as machine code or assembly language.
Machine code
The actual binary instructions that can be executed by a processor; specific to a processor or family of processors.
Assembly language
A language that uses mnemonics to represent machine-code instructions. It needs translating (assembling) before it can be run.
Instruction set
The set of machine-code instructions a particular type of processor can execute.
3.4.4 High-level languages

High-level languages

A high-level language (HLL) is more abstracted from the hardware of the computer, and its instructions are more powerful than in a low-level language. Python, C# and VB.NET are high-level languages. Most computer programs are written in HLLs.

  • HLLs use English-like keywords such as if, while and print, so code is easier to read, write and debug.
  • HLLs support structured statements such as selection and iteration, and local variables and parameters, which help programmers split a big program into subroutines.
  • One HLL statement can do the work of many machine-code instructions, so programs are shorter and quicker to write.
  • HLL code is portable: the same source code can be translated for different processors, so it isn’t tied to one instruction set.
  • Why most programs use HLLs: programmers can write, test and maintain them in much less time, more people can understand the code, and one program can be made to run on many kinds of computer.
High-level languageLow-level language (assembly)
ReadabilityEnglish-like keywords: quick to learn, write and debugMnemonics and memory addresses: slow to write, easy to make mistakes
PortabilityPortable: translate the same code for each processorTied to one processor family’s instruction set
Control of hardwareLittle direct control: the translator chooses the instructionsDirect control of specific hardware components and memory
Speed and size of the resultTranslated code may be larger and run a little more slowlyCan be written to run quickly and use very little memory
Instructions per statementOne statement → many machine-code instructionsOne line → one machine-code instruction
Worked exampleWhy does one line of Python need several machine-code instructions?
  1. total = price + tax
    One HLL statement.
  2. Load price from memory; add tax; store the result in totalThe processor can only do one simple step per instruction.
  3. So the translator produces about three instructions for this one lineIn the made-up assembly language in the diagram: LOAD 20, ADD 21, STORE 22.
HLL instructions are more powerful: each one is translated into several simple machine-code instructions.
Exam tip“Easier” and “faster” earn nothing on their own. Say what is easier and why: “quicker to write and debug because it uses English-like keywords”; “the program can run faster because the programmer controls exactly which instructions the processor executes”.
Exam tipIf the question asks for an advantage of assembly language, don’t give an advantage of high-level languages. Read which side the question is on.
High-level language (HLL)
A type of language that is more abstracted from the hardware of the computer and in which instructions are more powerful than in a low-level language. HLLs use English-like keywords.
Portable
Able to be run on different types of processor, once translated for each.
3.4.4 Program translators

Why code must be translated

  • A processor can only execute machine code instructions.
  • So all programming code written in high-level or assembly languages must be translated into machine code before (or while) it is run.
  • A program translator does this. There are three common types: compiler, interpreter and assembler.
  • Source code is the program as the programmer wrote it. Object code is the machine code a compiler produces from it.
  • Compilers and interpreters translate high-level languages. Assemblers translate assembly language.
Watch outTranslators don’t turn machine code into “human language”, and an assembler doesn’t turn a high-level language into a low-level one. Translation always goes towards machine code.
Program translator
A program that translates assembly language or HLL code into machine code so it can be run: an assembler, compiler or interpreter.
Source code
A program in the form the programmer wrote it, in a high-level or assembly language.
Object code
The machine code a compiler produces from source code; it can be saved as an executable file.
3.4.4 Types of translator

Compilers, interpreters and assemblers

  • Compiler: translates the whole source code at once and produces object code (machine code), which can be saved as an executable file. If it finds an error, it won’t produce an executable (the program won’t compile), and it lists the errors.
  • Once compiled, the executable can be run again and again without the compiler and without the source code. Compiled code can only be executed on a machine with the same instruction set.
  • Interpreter: analyses the source code line by line. For each statement it calls appropriate machine-code subroutines within its own code to carry it out. It doesn’t generate machine code directly, and no executable file is made.
  • An interpreter runs the source code up to the first error, then stops. Interpreted code runs more slowly than compiled code, because each line is analysed every time it runs (even inside a loop).
  • An interpreter always needs a copy of the source code at runtime, and the interpreter itself must be on the computer. Interpreted code is more portable: the same source runs on any machine with an interpreter for that language.
  • Assembler: translates assembly language into machine code. Each line of assembly language is assembled into a single machine-code instruction.
  • Compilers and assemblers translate their input into machine code directly; interpreters don’t.
CompilerInterpreterAssembler
TranslatesHigh-level languageHigh-level languageAssembly language
How much at a timeWhole program at onceOne line at a time, as it runsLine by line, each line → one instruction
Produces machine code?Yes: object code / an executableNo: calls its own machine-code subroutinesYes
ErrorsReports them; no executable until all are fixedStops at the first error it reachesReports them; no machine code until fixed
Needed each time the program runs?NoYes, with the source codeNo

Compilers and assemblers produce machine code; an interpreter carries out each line using its own machine-code subroutines.

Exam tipOver half of students scored 0 when asked how an interpreter works. “Line by line, stops at an error” is only the start. Add that it doesn’t produce machine code, and that it calls machine-code subroutines within its own code to carry out each statement.
Exam tipIf a question asks how compilers and interpreters operate, describe each one. Don’t just compare them, and write about both: describing only one caps your marks.
Compiler
A translator that produces object code from source code, translating the whole source code at once. It won’t produce an executable file if an error is encountered.
Interpreter
A translator that analyses the source code line by line and runs it up to the first error, calling machine-code subroutines within its own code to carry out each statement.
Assembler
A translator that translates assembly language into machine code.
Executable file
A file of machine code that can be run without the translator or the source code.
3.4.4 Choosing a translator

When to use each translator

  • Interpreter during development: the programmer can run the code straight away without waiting for the whole program to compile, and it stops at the first error, which shows where the problem is. Good for learning and testing small changes.
  • Interpreter for portability: the same source code runs on any computer with the right interpreter (for example scripts in web pages, or Python programs shared between Windows, macOS and Linux).
  • Compiler for release: users get an executable that runs without the compiler, and they don’t receive the source code, so it is harder for others to copy or change it.
  • Compiler for speed: translation happens once, so the finished program runs more quickly than interpreted code each time it is used. Useful for games and other programs that must run quickly.
  • Assembler: whenever the program is written in assembly language, for example code for an embedded system or a driver for a specific hardware component.
SituationBest translatorWhy
Trying out each new line while learning to codeInterpreterRuns straight away and stops at the first error
Selling a finished app to customersCompilerCustomers get an executable; no translator or source code needed
A program that must run as quickly as possibleCompilerAlready machine code, so no translating while it runs
A script that must run on many types of computerInterpreterSame source code runs anywhere with the interpreter
Code for a microwave’s controller, written in mnemonicsAssemblerAssembly language must be assembled into machine code
Exam tipAlways link the choice to the situation: “a compiler, because the customers won’t have a translator on their phones”.