Year 8 · Computer Systems · Part B: Inside the machine

Software

In one line

System software runs the computer. Application software does jobs for people. Programs must be translated into machine code before they run.

1

Sort software into system and application, and draw the layers from hardware up to the user.

2

Explain the six jobs of an operating system, including how it shares the CPU (round robin).

3

Pick the right utility for a problem: defragmenter, compression, backup, encryption, antivirus.

4

Compare open source and proprietary software, and high-level and low-level languages.

5

Say what a compiler, an interpreter and an assembler do, and what an IDE gives you.

SoftwarePrograms: instructions that tell hardware what to do.
Operating systemSystem software that manages hardware and runs programs.
DriverLets the OS talk to one device.
Open sourceCode anyone can see, change and share.
Machine codeBinary instructions the CPU actually runs.
CompilerTranslates the whole program first.
InterpreterTranslates and runs one line at a time.
IDEThe program you write code in.

Two kinds of software

Software is any program. Hardware is the parts you can touch. Software splits into two families: the ones that run the computer, and the ones that do a job for you.

System softwareApplication software
JobRuns and looks after the computerDoes a task for you
ExamplesOperating system, utilities (antivirus, backup), driversBrowser, games, Spotify, Word, Unreal Engine
Without it…The computer can't start or run anythingThe computer works but does nothing useful for you
Useryou: clicks, taps, types Applicationsbrowser · game · Spotify · Thonny · Word Operating system+ drivers + utilities (system software) HardwareCPU · RAM · storage · screen · keyboard · printer
Each layer only talks to the one next to it. A game never drives the graphics card itself: it asks the operating system, which uses the driver.
▶

Sort the software

Is each one system or application software? Tap your answer.

SYSTEM
APPLICATION
?Why?

Why have layers at all? So an app maker doesn't need to know which printer, graphics card or keyboard you have. They ask the operating system. The OS and its drivers deal with the hardware. One app works on millions of different computers.

!Watch out

A web browser is application software, even though it feels like part of the computer. It does a job for you (shows web pages).

What an operating system does

The operating system (Windows, macOS, Linux, Android, iOS) sits between the hardware and every app. It's the manager of the whole computer. It has six main jobs.

Operatingsystem
  1. User interface. How you talk to the computer. A GUI (graphical user interface) has windows, icons, menus and a pointer. A command line means typing commands. Phones use touch; smart speakers use voice.

  2. Memory management. Decides which program gets which part of RAM. Stops one program writing over another's memory. Moves things to virtual memory when RAM is full (Topic 8).

  3. Process scheduling (multitasking). One core can only run one program at a time. The OS switches between programs thousands of times a second, so they all seem to run at once. Step 3 shows how.

  4. Peripherals and drivers. A driver is a small program that lets the OS talk to one device: a printer, a graphics card, a game controller. New device → install its driver.

  5. File management. Folders, file names, copying, moving, deleting. It remembers where on the drive each file's pieces are.

  6. Security and users. Accounts and passwords. Who can open which files. Updates that fix security holes. A firewall.

▶

Which OS job is it?

e.g.Example

You plug in a new game controller. Windows says "Setting up a device". It is finding and installing the driver. Without it, the OS gets button signals but doesn't know what they mean.

★Exams

OCR J277 lists five OS jobs: user interface, memory management and multitasking, peripheral management and drivers, user management, file management. AQA 8525 groups them as managing the processor, memory, I/O devices, applications and security. Same ideas, different words.

Sharing the CPU: round robin

Lots of programs want the CPU at once. One simple, fair way to share it is round robin: everyone gets a short turn, called a time slice, then goes to the back of the queue.

Ready queue Game Browser Music backfront CPUruns for 1 slice not finished? go to the back of the queue done A time slice is tiny: often 1–100 milliseconds. Each switch is called a context switch: the OS saves the registers (PC, ACC…) of one program and loads the next one's.
▶

Round-robin scheduler

Each program needs some time units. The CPU gives the one at the front of the queue one time slice, then moves on.

Time slice:
CPU timeline (one box = one time unit):
?Why?

Why not just run each program to the end? A long job (exporting a video) would freeze everything else. Your music would stop and the mouse would stick. Short turns keep every program moving, so the computer feels responsive.

Why not make slices really tiny? Every switch costs time (saving and loading registers). Too many switches and the CPU spends its time switching, not working.

e.g.Beyond GCSE

Real operating systems also use priorities: the mouse pointer and your music get turns before a background update. Round robin is the simplest fair scheduler.

Utility software

A utility is a small system program that keeps the computer healthy, tidy or safe. Five to know.

UtilityWhat it doesProblem it solves
DefragmentationPuts a hard disk's scattered pieces back togetherHard disk slow to open files
CompressionMakes files smaller (ZIP)Files too big to email or store
BackupCopies files somewhere else, on a scheduleDrive dies, files deleted, ransomware
EncryptionScrambles data so only someone with the key can read itLaptop stolen; data read by the wrong person
AntivirusFinds and removes harmful software (malware)Viruses, worms, trojans

Defragmentation

A hard disk saves a file wherever there's a free gap. Over time, files get split into pieces scattered across the disk. That's fragmentation. The read/write head must jump around to read one file, which is slow.

Before: fragmented After: defragmented Each square is a block on the disk. Same letters = pieces of the same file.
▶

Defragmenter

!Watch out

Don't defragment an SSD. It has no moving parts, so reading scattered blocks is just as fast. Defragmenting only wears its cells out with extra writes. Windows runs a different tidy-up ("TRIM") on SSDs instead.

The other four

  1. Compression. Finds patterns and stores them more briefly. ZIP is lossless: you get every bit back. Topic 7 goes deeper.

  2. Encryption. Scrambles data using a key. BitLocker (Windows) and FileVault (macOS) encrypt the whole drive, so a stolen laptop is useless to the thief.

  3. Antivirus. Compares files with a list of known malware "signatures", and watches for suspicious behaviour. It needs updating every day, because new malware appears every day.

  4. Backup. A copy kept somewhere else. Next step.

Backups: full and incremental

A full backup copies everything. An incremental backup only copies what changed since the last backup. Most people do one full backup, then incrementals.

To restore Saturday: Sunday's full backup, then every incremental, in order. Lose one and the chain breaks.
Full backupIncremental backup
CopiesEvery fileOnly files changed since the last backup
Space usedA lotVery little
Time to makeSlowFast
Time to restoreFast: one copySlower: the full one, then every incremental in order

To compare sizes, put them in the same unit first. The formula box below follows the planner further down: it turns the drive size from TB into GB.

By hand: how many incremental backups fit?

A school backs up 200 GB in full, then about 800 MB of changes a day. The backup drive is 1 TB. How many days of incrementals fit after the full backup?

  1. Put everything in the same unit (GB). 1 TB → GB: a bigger unit going down to a smaller one, so multiply: 1 × 1,000 = 1,000 GB.

  2. 800 MB → GB: going up to a bigger unit, so divide: 800 ÷ 1,000 = 0.8 GB.

  3. Take off the full backup. 1,000 − 200 = 800 GB left for incrementals.

  4. Divide by the size of one. 800 ÷ 0.8 = 1,000 incremental backups.

  5. Sense check. That's nearly 3 years of school days. Doing a fresh full backup every month would only cost 200 GB. ✓

▶

Backup planner

Incrementals that fit
★Remember

The 3-2-1 rule: 3 copies of your data, on 2 different kinds of storage, with 1 kept off site (another building or the cloud). A backup in the same room burns in the same fire.

Open source vs proprietary

Programs are written as source code (text a person can read), then turned into machine code. The question is: can you see and change the source code?

Open sourceProprietary (closed source)
Source codeAnyone can see it, change it and share itKept secret by the company
CostUsually freeUsually paid: a one-off price or a subscription
Licencee.g. GPL, MIT, ApacheAn end-user licence agreement (EULA): you may use it, not copy or change it
ExamplesLinux, Firefox, Python, LibreOffice, Blender, Godot, ThonnyWindows, macOS, Microsoft Office, Photoshop, most console games

Open source

  • + Free to use.
  • + You can change it to fit your needs.
  • + Many people check the code, so bugs can be found fast.
  • − Support may only be forums and volunteers.
  • − Can be less polished or harder to install.

Proprietary

  • + Paid support and regular updates.
  • + Usually well tested and polished.
  • + Often the industry standard (files open everywhere).
  • − Costs money, often every year.
  • − You can't fix or change it; you depend on the company.
!Watch out

Free is not the same as open source. WhatsApp and Fortnite are free to download, but their code is secret: they are proprietary. Open source is about the code, not the price.

e.g.Licences and the law

Software is protected by copyright like a book. In the UK that's the Copyright, Designs and Patents Act 1988; in Spain the Ley de Propiedad Intelectual (Real Decreto Legislativo 1/1996). Copying proprietary software without a licence breaks these laws. A GPL licence says: you may change and share this, but what you share must stay open source too. MIT lets you do almost anything if you keep the author's name.

High-level and low-level languages

The CPU only understands machine code: binary instructions. People find that almost impossible to write. So we write in languages closer to English, and translate.

LevelLooks likeNotes
Machine code (low)10100101 00110010What the CPU runs. Different for each CPU type
Assembly (low)LDA 50 / ADD 51 / STA 52One short word (mnemonic) per machine instruction
High-leveltotal = a + bPython, C#, JavaScript. Easier. Works on any CPU once translated
▶

High to low: one Python line, all the way down

A made-up 8-bit CPU: the first 4 bits are the opcode (what to do), the last 4 are the address. Real CPUs use longer codes, but the idea is the same.

High-levelLow-level (assembly / machine code)
Easy to read and write?Yes: English-like wordsNo: codes and numbers
One line does…Many machine instructionsExactly one
Runs onAny CPU, once translatedOnly one family of CPU
Control over hardwareLittle: the translator decidesTotal: every register and address
Used forAlmost all apps and gamesDrivers, embedded systems, tiny fast code
?Why?

Why does anyone still write assembly? For tiny chips with very little memory (a washing machine controller), or code that must be as fast as possible. You can say exactly which register to use. Old consoles like the NES were programmed this way.

Translators: compiler, interpreter, assembler

A translator turns code people can write into machine code the CPU can run. There are three kinds.

high-level codeline 1line 2line 3 Compiler program.exe0110 1010… CPU all at once, before running; saved file runs again and again high-level codeline 1 ◀line 2line 3 Interpreter translate 1 line, run it CPU next line… no file is made assemblyLDA 6ADD 7 Assembler machine code0001 01100010 0111 one line in →one instruction out
  1. Assembler: assembly → machine code. One line in, one instruction out.

  2. Compiler: translates the whole program first, into a file like .exe. Then that file runs, as often as you like, with no translating.

  3. Interpreter: translates and runs one line at a time. Every time you run the program, it translates again.

CompilerInterpreter
WhenAll at once, before runningLine by line, while running
OutputA file you can run (an executable)No file
SpeedFast to runSlower: translating while running
ErrorsLists them all at the end; nothing runsStops at the first one; lines before it have already run
SharingShare the .exe; your source code stays privateThe user needs the interpreter and your source code
Good forFinished products: games, appsLearning and testing: try a line, see what happens
ExamplesC, C++ (Unreal Engine), RustPython, JavaScript
e.g.Example

A compiler translates a whole book before printing it. An interpreter translates a speech sentence by sentence, as the speaker talks.

?Why do we need translators at all?

The CPU can only run its own machine code. People can't sensibly write millions of 0s and 1s, and machine code only works on one type of CPU. A translator lets us write once, in a language people can read, and run it on any CPU that has a translator.

e.g.Beyond GCSE

Real Python is a mix: it first compiles your code into "bytecode", then an interpreter runs the bytecode. Java and C# do something similar. For GCSE, call Python interpreted.

The IDE: where you write code

An IDE (Integrated Development Environment) is the program you code in. It puts everything a programmer needs in one window. Year 8 uses Thonny or IDLE for Python; you might also see VS Code.

Run Debug Step 1234 for i in range(6): total = total + i print("Total:", total) print("Done" Variablesi = 5total = 15 Shell >>> %Run sums.py SyntaxError: '(' was never closed (line 4) ① editor with colours② breakpoint (red dot)③ variables panel④ error with line number⑤ run, debug, step
A sketch of Thonny. Code colours: purple = keywords, blue = built-in functions, green = text, orange = numbers.
FeatureWhat it doesWhy it helps
EditorWhere you type, with line numbers, auto-indent and syntax colouringMistakes stand out: a string that never ends turns the rest of the line green
Auto-completeSuggests names as you typeFewer spelling mistakes in variable names
Run button + translatorTranslates and runs the code in one clickNo need to use the command line
Error diagnosticsShows the error type and line numberTells you where to look
DebuggerBreakpoints pause the program; step runs one line at a time; watch variables changeFind logic errors: see the exact line where a value goes wrong
e.g.Example

In Thonny, press the bug icon, then Step over (F6) again and again. The Variables panel shows each value change. It's a live trace table.

★Exams

OCR J277 asks for IDE tools: editors, error diagnostics, run-time environment, translators. AQA 8525 doesn't name the IDE, but expects compilers, interpreters and assemblers.

Common mix-ups

The mistakes nearly everyone makes the first time. Read the left side, then the right.

People think

The operating system is the same as the computer.

Actually

It's software running on the hardware. You can wipe Windows and install Linux on the same machine.

People think

Free software means open source.

Actually

Open source is about seeing the code. Lots of free apps are proprietary.

People think

An interpreter makes a program file.

Actually

Only a compiler makes an executable file. An interpreter translates again every run.

People think

A compiler finds logic errors.

Actually

It finds syntax errors (broken grammar). A program that compiles can still give wrong answers.

People think

Defragmenting makes any computer faster.

Actually

Only hard disks benefit. On an SSD it does nothing useful and adds wear.

People think

Multitasking means the CPU runs programs at the same time.

Actually

Each core runs one at a time. The OS switches so fast it looks simultaneous.

People think

An incremental backup is a complete copy.

Actually

It only holds the changes. You need the full backup plus every incremental to restore.

Check yourself

Quick questions first. Then endless practice: a wrong answer shows you the working, step by step.

[ {"q":"Python in school usually runs with…","o":["A compiler","An interpreter"],"a":1,"w":"It runs line by line and stops at the first error."}, {"q":"Which is system software?","o":["Spotify","An operating system","A game"],"a":1,"w":"It runs the computer itself."}, {"q":"Which makes a standalone .exe file?","o":["Compiler","Interpreter"],"a":0,"w":"It translates everything first and saves the result."}, {"q":"A new printer won't work until you install its…","o":["Driver","Compiler","Defragmenter"],"a":0,"w":"A driver lets the operating system talk to one particular device."}, {"q":"Round-robin scheduling means…","o":["The biggest program always runs first","Each program gets a short time slice in turn","Programs run truly at the same time on one core"],"a":1,"w":"Everyone gets a turn, then goes to the back of the queue."}, {"q":"An incremental backup copies…","o":["Every file","Only the files changed since the last backup","Only the operating system"],"a":1,"w":"That's why it's small and quick, but restoring needs the whole chain."}, {"q":"Which is a feature of open-source software?","o":["Anyone can see and change the source code","It always costs money","Its code is kept secret"],"a":0,"w":"Open source is about the code being open, not about price."}, {"q":"Which translator turns assembly into machine code?","o":["Interpreter","Assembler","Compiler"],"a":1,"w":"One assembly instruction becomes one machine-code instruction."} ]