AS & A Level Computer Science · Area 2 · A Level content

Processors, parallel processing, virtual machines and Boolean algebra

This topic splits into two halves that examiners keep separate: how a processor is built and how it can be made to do several things at once, and how logic gates are combined and simplified into circuits. You need paired comparisons between RISC and CISC rather than two lists, an ordered account of interrupt handling, the four Flynn architectures and a working understanding of virtual machines. In the Boolean half the marks are lost by skipping steps in a simplification, by muddling a half adder with a full adder, and by grouping Karnaugh map cells in threes or along diagonals.

Not started

Syllabus coverage

  • Show understanding of Reduced Instruction Set Computers (RISC) and Complex Instruction Set Computers (CISC) processors, including the differences between them
  • Understand interrupt handling on CISC and RISC processors
  • Show understanding of the importance and use of pipelining and registers in RISC processors
  • Show understanding of the four basic computer architectures: SISD, SIMD, MISD and MIMD
  • Show understanding of the characteristics of massively parallel computers
  • Show understanding of the concept of a virtual machine, with examples of the role of virtual machines
  • Understand the benefits and limitations of virtual machines
  • Produce truth tables for logic circuits including half adders and full adders, which may include logic gates with more than two inputs
  • Show understanding of a flip-flop (SR, JK): draw a logic circuit and derive a truth table for a flip-flop
  • Understand the role of flip-flops as data storage elements
  • Show understanding of Boolean algebra, including De Morgan's laws, and perform Boolean algebra using De Morgan's laws
  • Show understanding of Karnaugh maps (K-maps) and the benefits of using them
  • Simplify a logic circuit or expression using Boolean algebra
  • Solve logic problems using Karnaugh maps

Part of the AS & A Level Computer Science syllabus 9618.

RISC and CISC: two ways to design an instruction set

Every processor understands a fixed list of instructions, its instruction set, and the size and style of that set is the main thing that separates a CISC (Complex Instruction Set Computer) from a RISC (Reduced Instruction Set Computer). The two names describe a design choice, not a quality ranking: both designs are used in real machines today, and which one is chosen depends on what the processor has to do and how much power it may use.

A CISC processor has a large instruction set, often several hundred instructions, and the instructions are variable in length. Many are genuinely complex: one instruction can fetch a value from memory, add it to a register and store the result back, and it may take several clock cycles to finish. CISC offers many addressing modes, so an instruction can reach its operand in several different ways, and because each instruction does more work the finished program is shorter. The cost is a complicated control unit, usually microprogrammed, in which each machine instruction is broken into a sequence of simpler micro-instructions held in a control store. That takes transistors, design effort and power, but it keeps a compiler's job easier and keeps decades of old software running, which is why the x86 family in most desktop PCs and servers is CISC.

A RISC processor goes the other way. It has a small instruction set of simple instructions, all of the same fixed length, and nearly every one completes in a single clock cycle. It uses a load/store architecture: only LOAD and STORE instructions touch memory, and every arithmetic or logic instruction works on values already sitting in registers. There are few addressing modes and many general-purpose registers (32 or more is typical), and the control unit is hardwired instead of microprogrammed, which is simpler and faster. The price is that the same job needs more instructions, so the program is larger and the compiler has more work to do; the gain is that each instruction is quick and predictable, which makes the processor cheap to build, low on power and very easy to pipeline.

The comparison you must be able to write is a set of paired statements. 'RISC has fewer instructions' on its own scores nothing, while 'RISC instructions are a fixed length, so the decode stage always takes the same time, whereas CISC instructions vary in length and may take several cycles' scores and is the kind of sentence the mark scheme is built from.

  • Fixed length: RISC instructions are all one word; on a CISC they can be one byte or ten, which makes decoding harder.
  • Cycles per instruction: most RISC instructions complete in one clock cycle; a complex CISC instruction may need many.
  • Memory access: only LOAD and STORE reach memory on a RISC; most CISC instructions can take an operand straight from memory.
  • Registers: a RISC has many general-purpose registers; a CISC has fewer, so intermediate values go back to memory more often.
  • Code size: the CISC program is shorter; the RISC program has more instructions but each one is simpler.
  • Where each is used: CISC for general-purpose desktops and servers that must run existing software; RISC (for example ARM) in phones, tablets and embedded systems where power and heat matter.
FeatureRISCCISC
Instruction setSmall, simple, few hundred at mostLarge, complex, often several hundred to over a thousand
Instruction lengthFixedVariable
Clock cycles per instructionUsually oneOften several
Addressing modesFewMany
Memory accessLoad and store instructions onlyAny instruction may access memory directly
RegistersMany general-purpose registersFewer registers
Control unitHardwired, simple and fastMicroprogrammed, complex
PipeliningEasy, because stages take equal timeDifficult, because instruction lengths differ
Program size and compilerLonger code, more compiler workShorter code, simpler for the compiler
Answer in pairs. Every RISC point you make should be matched by the CISC position, and every claim should say what it does to speed, cost or power.

Interrupts: how a processor responds, and why RISC responds faster

An interrupt is a signal, sent by hardware or generated by software, telling the processor that something needs attention now. It might be a device that has finished a transfer, a timer tick reminding the operating system to switch between processes, a hardware fault such as a power failure, or a program error such as division by zero. Interrupts exist so that the processor does not have to keep stopping to check every device in turn: the device announces itself when it is ready.

The processor does not respond in the middle of an instruction. It checks for pending interrupts at the end of each fetch-decode-execute cycle, and if one is waiting it works through a fixed sequence: finish the instruction it is on; save the processor state (the program counter and the contents of the registers, together called the context), on most designs by pushing them onto a stack in memory; load the address of the correct interrupt service routine (ISR) from the interrupt vector table into the program counter; run the ISR, which services the device; restore the saved state; and resume the interrupted program at exactly the point it had reached. Interrupts carry priorities, so a high-priority interrupt can itself interrupt a low-priority ISR, and interrupts can be masked so that a critical section of code cannot be broken into.

On a CISC processor this sequence is slower and harder to predict. Because the instructions are complex and take several clock cycles, the processor cannot be interrupted halfway through one without preserving a great deal of internal state, so it must run to the end of the instruction; a long instruction means a longer and less predictable wait before the interrupt is serviced, which is the processor's interrupt latency. CISC designs often include dedicated instructions for handling interrupts, which helps the programmer, but because a CISC has relatively few registers, more of the context has to be written out to the stack - several extra memory writes before the ISR can even begin.

A RISC processor handles the same interrupt quickly and predictably. Every instruction is the same length and takes one cycle, so there is never a long instruction left to finish and the processor reaches a safe point almost at once. Because a RISC has many registers, more of the context can be saved into registers instead of memory, and many RISC designs provide register banks or shadow registers so that a whole bank can be swapped in a single step. The load/store design also means that a long operation is already a chain of short instructions, each of which is a safe place to stop. That is why RISC dominates in embedded and real-time systems, where interrupts arrive constantly and must be answered within a guaranteed time.

AspectCISCRISC
Point at which it can be interruptedOnly at the end of a long, multi-cycle instructionAt the end of any one-cycle instruction
Interrupt latencyLonger and variableShort and predictable
Where the context is savedMostly to a stack in memory, because registers are fewLargely into registers, or swapped as a register bank
Memory traffic during a context switchSeveral writes to memoryFew or none
Typical useDesktops and servers, where throughput matters more than response timeEmbedded and real-time systems, where response time is guaranteed
Never write that an interrupt stops or abandons the program. The current instruction is completed, the state is saved, the ISR runs, and the original program continues from the same place.

Pipelining and registers in RISC processors

The fetch-decode-execute cycle is usually drawn as three steps one after another, but the three steps use different hardware inside the processor. Pipelining exploits that: instead of waiting for one instruction to finish before starting the next, the processor overlaps the stages, so while instruction 1 is being executed instruction 2 is being decoded and instruction 3 is being fetched. A typical five-stage pipeline is fetch, decode, execute, memory access and write back.

After the pipeline has filled - which takes as many clock cycles as there are stages - one instruction completes in every clock cycle. A five-stage pipeline therefore gives close to five times the throughput of the same processor without pipelining. It does not make any single instruction finish sooner: the time from fetch to write back for one instruction is unchanged, and may even rise slightly because a register sits between each pair of stages.

RISC suits pipelining almost perfectly, and this is the link the syllabus wants. Fixed-length instructions mean every stage has the same amount of work and can complete in one cycle, so no stage waits for a long instruction to finish. Simple addressing means an effective address can be worked out inside the decode stage. The load/store design means only two instructions use the memory stage, so the stages stay balanced. And having many registers means most operands are already inside the processor, so the pipeline rarely has to stop and wait for memory.

Pipelines are held up by hazards. A data hazard happens when an instruction needs a result that the instruction in front of it has not yet written back; the pipeline must stall (insert a bubble) or the hardware must forward the result straight across. A control hazard happens at a branch, because the processor does not know which instruction to fetch next until the branch is resolved; it either flushes the wrongly fetched instructions or uses branch prediction and speculates. A structural hazard happens when two instructions in the pipeline want the same hardware in the same cycle.

Registers are the small, extremely fast storage locations inside the processor, built from flip-flops, and they exist because main memory is far too slow to feed a one-cycle pipeline. The program counter holds the address of the next instruction to fetch. The memory address register and memory data register hold the address and the data passing to and from memory. The current instruction register holds the instruction being decoded, the accumulator holds the result of the arithmetic being done, the status register holds the condition flags, and the stack pointer holds the top of the stack used for subroutine calls and interrupts. The general-purpose registers hold the operands and results of the program itself, and a RISC has many of them so that a calculation can be done without repeatedly going back to memory.

Clock cycleInstruction 1Instruction 2Instruction 3Instruction 4
1Fetch
2DecodeFetch
3ExecuteDecodeFetch
4MemoryExecuteDecodeFetch
5Write backMemoryExecuteDecode
6Write backMemoryExecute
7Write backMemory
Pipelining raises throughput, not the speed of one instruction. Say that, and you separate a full-mark answer from a vague one about the processor 'doing things at the same time'.

The four basic computer architectures: SISD, SIMD, MISD, MIMD

The four Flynn classifications describe a computer by asking two questions: how many instruction streams can it work on at once, and how many data streams can it work on at once? A stream is a sequence - one instruction stream means one sequence of instructions being executed, and one data stream means one sequence of operands being worked through.

SISD - single instruction, single data - is the ordinary one-processor computer. One instruction is fetched and executed at a time, on one item of data, exactly as the fetch-decode-execute cycle describes. A single-core desktop processor is SISD, even though it pipelines internally, because pipelining overlaps the stages of different instructions rather than executing several instructions in parallel.

SIMD - single instruction, multiple data - applies one instruction to many data items at the same time. Vector and array processors work this way, and so do the thousands of cores in a GPU: one instruction tells every core to add its own pair of pixel values, so a whole image is processed in the time one pixel would have taken. SIMD is ideal when the same operation is repeated over a large regular set of numbers - image and video processing, matrix arithmetic, physics simulations and the arithmetic inside neural networks.

MISD - multiple instruction streams working on a single data stream - is the odd one out. Several processors each apply a different operation to the same data. True MISD machines are rare because most problems do not have that shape; the usual illustration is a fault-tolerant system in which several processors run the same input through different implementations and a voter compares the results, or a systolic array in which data is passed through a chain of processing elements. You are expected to describe it, not to name one on your desk.

MIMD - multiple instruction, multiple data - gives every processor its own instruction stream and its own data. Multicore processors, multi-processor servers, clusters of machines and supercomputers are all MIMD. It is the most flexible arrangement and the one that handles general parallel programs, because different processors can be doing genuinely different jobs; it is also the hardest to program, because the processors must be kept supplied with work and their results must be coordinated through shared memory or messages.

ArchitectureInstruction streamsData streamsWhat it meansExample
SISDOneOneOne instruction at a time on one item of dataA single-core processor executing a program
SIMDOneManyThe same operation is applied to many data items at onceA GPU shading every pixel of an image; a vector processor
MISDManyOneDifferent operations are applied to the same data, usually for checking or pipelining the data through stagesA fault-tolerant control system where several processors compute the same value and a voter compares them
MIMDManyManyEach processor runs its own instructions on its own dataA multicore CPU, a cluster, a massively parallel supercomputer
Classify by counting streams, not by looking at the hardware. Four cores running four different parts of one program is MIMD; one instruction applied to a thousand pixels is SIMD.

Massively parallel computers

A massively parallel computer is a machine built from a very large number of processors - thousands, or tens of thousands - that work on one problem at the same time. Each processor normally has its own local memory and its own copy of the program, so the machine is MIMD in Flynn's terms, and the processors are joined by a very fast internal network over which they pass messages.

The defining characteristics follow from that structure. There are very many processors rather than a handful of cores, so the machine's throughput is enormous and grows as more processors are added. Each processor works on a small part of the problem, which means the problem itself must be divisible into many independent pieces. Processors communicate by message passing or through shared memory, and that communication is the main limit on performance: time spent sending data between processors is time not spent computing, and if the processors must constantly exchange results the gain from adding more of them shrinks. Such machines are expensive, power-hungry and need heavy cooling, they need software written specifically to be parallel, and they are poor at problems that are inherently sequential.

They are used for problems where enormous numbers of similar calculations are needed: weather and climate modelling, which divides the atmosphere into millions of cells; protein folding and drug design; computational fluid dynamics and crash simulation; astrophysics and particle physics; code-breaking; seismic imaging; and the training of large machine-learning models. The same idea at a smaller scale appears in a cluster, a group of ordinary servers linked by a fast network, which is cheaper than a purpose-built supercomputer and is how most universities do this work.

Frontier, at Oak Ridge National Laboratory in the United States, is a working example: thousands of nodes, each containing a CPU and several GPUs, joined by a high-speed network, running one simulation spread across the whole machine. Fugaku, in Japan, is built on ARM-based RISC processors and is another. You do not need their specification, only the shape of the argument: many processors, each with local memory, a fast interconnect, and a problem cut into pieces small enough to be shared out.

  • Very large number of processors, each with its own local memory and its own instructions - the MIMD pattern.
  • The problem must be split into many independent parts, or the processors spend their time waiting for each other.
  • Processors exchange data by message passing over a fast interconnect, or through shared memory.
  • Performance scales with the number of processors only until communication and synchronisation dominate.
  • High cost, high power consumption and heavy cooling; needs a machine room, not a desk.
  • Software must be written or rewritten for parallel execution; an ordinary sequential program gains nothing.
  • Reliability can be improved by redundancy, because losing one node out of thousands need not stop the job.
The characteristic examiners most often see missed is the communication overhead: adding processors only helps while the work each one does is larger than the cost of talking to the others.

Virtual machines: the concept, the roles and the trade-offs

A virtual machine (VM) is a software implementation of a computer system. It behaves like a complete computer - its own processor, memory, storage, network interfaces and operating system - but everything it appears to own is really being provided by software running on shared physical hardware. The layer of software that creates and manages the VMs is the hypervisor, and it decides which VM uses the physical processor, and when.

There are two kinds. A type 1 (bare-metal) hypervisor runs directly on the hardware with no host operating system underneath, and the guest operating systems sit on top of it; this is what data centres and cloud providers use, for example VMware ESXi or Microsoft Hyper-V. A type 2 (hosted) hypervisor is an ordinary application running on a normal operating system, with the VMs created inside it; this is what you would install on a laptop, for example VirtualBox or VMware Workstation. There is also the process virtual machine, which emulates just enough of a machine to run one program - the Java Virtual Machine is the classic case, executing compiled bytecode so that the same program runs on any hardware that has a JVM installed.

The roles are worth learning as a list, because questions often ask for examples. A VM lets one physical machine run several different operating systems at once, so a Linux server can host a Windows application. It gives a safe, isolated environment for testing software, trying a new operating system or opening a suspicious file, because damage inside the VM does not reach the host. It allows server consolidation, replacing a room of under-used physical servers with one large host running many VMs. It supports cloud computing, where a provider sells VMs rather than machines. It keeps legacy software alive by running an old operating system on modern hardware. It supports snapshots and cloning, so a system can be rolled back to a known good state in seconds, and it makes an excellent teaching and demonstration environment because a broken VM is simply reset.

BenefitsLimitations
Several operating systems, even incompatible ones, share one physical machineA VM is slower than the same software on the hardware directly, because resources are shared and some instructions must be translated or trapped
Better use of hardware: many small servers can be consolidated onto one host, saving money, space and powerThe host is a single point of failure - if it fails, every VM on it stops at once
Isolation: a crash, infection or configuration error inside one VM does not affect the host or the other VMsPerformance is unpredictable when VMs contend for the same processor, memory or disk, and over-committing resources makes it worse
Snapshots, cloning and live migration make backup, testing and maintenance quick and reversibleA security flaw in the hypervisor can expose every guest on the host, so the hypervisor must be patched and tightly controlled
A new machine can be provisioned in minutes from an image, and removed just as quicklyEach guest needs its own operating system licence, and managing many images and their updates is extra work
Legacy software can keep running on an old operating system without keeping old hardwareNot suitable for work that needs direct access to specialist hardware or guaranteed real-time response, without extra configuration
The limitation to name first is performance: a VM shares the physical processor, memory and disk, so it does not give you more of them than the host actually has.

Boolean algebra and De Morgan's laws

Boolean algebra is the algebra of two values, 0 and 1, and it is how logic circuits are described and simplified. A variable such as A is a signal that is either 0 (false, low voltage) or 1 (true, high voltage). The three operations are NOT, written as a bar over the letter or as an apostrophe (A' means NOT A), AND, written with a dot or by writing the letters together (A.B or AB), and OR, written with a plus sign (A + B). Brackets are worked out first, then NOT, then AND, then OR - so A + B.C means A + (B.C), not (A + B).C.

The laws below are the whole toolkit. You are not expected to memorise a huge list, but you are expected to use each step in a simplification and to be able to say which law you used.

  • De Morgan's first law: (A.B)' = A' + B'. The NOT of an AND is the OR of the NOTs.
  • De Morgan's second law: (A + B)' = A'.B'. The NOT of an OR is the AND of the NOTs.
  • The rule to apply it: break the bar, change the sign underneath, and invert each term. (A.B.C)' becomes A' + B' + C', and (A + B + C)' becomes A'.B'.C', for any number of terms.
  • Both laws together: (A.B + C)' = (A.B)'.C' = (A' + B').C'. Work from the outside in, one bar at a time.
  • Simplify before you expand: look for A + A' (= 1) and A.A' (= 0) first, because they collapse a whole expression in one line.
LawAND formOR form
IdentityA.1 = AA + 0 = A
Null (annulment)A.0 = 0A + 1 = 1
IdempotentA.A = AA + A = A
ComplementA.A' = 0A + A' = 1
Double negation(A')' = A(A')' = A
CommutativeA.B = B.AA + B = B + A
AssociativeA.(B.C) = (A.B).CA + (B + C) = (A + B) + C
DistributiveA.(B + C) = A.B + A.CA + (B.C) = (A + B).(A + C)
AbsorptionA.(A + B) = AA + (A.B) = A
De Morgan(A.B)' = A' + B'(A + B)' = A'.B'
One mark is usually available for the method, so write every line and name the law you used. Jumping from the question to the answer loses that mark even when the answer is right.

Logic circuits: half adders, full adders and flip-flops

A truth table lists every possible combination of inputs and the output for each. With n inputs there are 2 to the power n rows, written in binary counting order (00, 01, 10, 11) so that nothing is missed, and it helps to add intermediate columns - one for each bracket in the expression - so the final column can be checked. Gates with more than two inputs follow the same rules: a three-input AND is 1 only when all three inputs are 1, and a three-input OR is 1 when any one of them is 1, so always read the gate symbol for its number of inputs.

A half adder adds two single bits, A and B. Its Sum output is 1 when exactly one input is 1, which is the XOR function, and its Carry output is 1 only when both inputs are 1, which is AND. The truth table is short: 0+0 gives Sum 0 Carry 0; 0+1 and 1+0 both give Sum 1 Carry 0; 1+1 gives Sum 0 Carry 1, because binary 1 + 1 = 10. The limitation is in the name - it has no input for a carry arriving from a previous column, so it can only add the rightmost bits of two numbers.

A full adder adds three bits: A, B and a carry in, Cin. Its Sum is A XOR B XOR Cin, and its Carry out is A.B + Cin.(A XOR B). It can be built from two half adders and an OR gate: the first half adder adds A and B, the second adds that Sum to Cin, and the OR combines the two carries. Chaining n full adders, with each Carry out feeding the next Carry in, gives an n-bit adder - the ripple carry adder at the heart of every ALU - and the carry is what makes the delay grow with the number of bits.

  • Half adder: Sum = A XOR B, Carry = A AND B. Four rows, two gates.
  • Full adder: Sum = A XOR B XOR Cin, Cout = A.B + Cin.(A XOR B). Eight rows, five gates if built directly.
  • SR flip-flop (NOR version): two NOR gates cross-coupled, output Q taken from one and Q' from the other. S = 1, R = 0 sets Q to 1; S = 0, R = 1 resets Q to 0; S = 0, R = 0 holds the previous value; S = 1, R = 1 is invalid, because both outputs go to 0 and Q and Q' are no longer opposites.
  • SR flip-flop (NAND version): the same circuit built from NAND gates, with the inputs active low - the invalid state is S = 0, R = 0 and the hold state is S = 1, R = 1. Read the gate type before you write the table.
  • JK flip-flop: J and K replace S and R and the invalid state is removed. J = 0, K = 0 holds; J = 0, K = 1 resets to 0; J = 1, K = 0 sets to 1; J = 1, K = 1 toggles, so Q becomes Q'.
  • Why flip-flops matter: one flip-flop stores one bit and keeps it after the input is removed, so a row of them is a register, and registers, counters and the memory cells of SRAM are all built from them.
ABCinSumCout
00000
00110
01010
01101
10010
10101
11001
11111
A full adder has three inputs and a half adder has two. If a question says a circuit adds two bits plus a carry in and you give the four-row table, you have answered a different question.

Karnaugh maps: simplifying without guesswork

Algebraic simplification works, but it depends on spotting the right law at the right moment. A Karnaugh map (K-map) turns the same job into a picture. The map is a grid with one cell for every row of the truth table, and the cells are arranged so that any two adjacent cells differ in exactly one variable. That is why the column and row labels are ordered 00, 01, 11, 10 - Gray code - and not 00, 01, 10, 11: in the Gray order, 01 and 11 differ only in the first bit.

To use it: write a 1 in every cell where the output is 1. Then group the 1s into rectangles containing 1, 2, 4, 8 or 16 cells - always a power of two, never three or five - and make each group as large as possible and use as few groups as possible. Groups may overlap, which is normal and often necessary, and groups may wrap around the edges of the map, because the left and right columns and the top and bottom rows are also adjacent. Each group becomes one product term: the variables that change inside the group are eliminated, and the variables that stay the same are kept, written unbarred if they are 1 and barred if they are 0.

A group of 2 cells removes one variable, a group of 4 removes two, a group of 8 removes three, and a single ungrouped cell keeps all of them. A three-variable map with 1s in cells 0, 1, 4, 5 and 7 (reading A B C) gives two groups: cells 0, 1, 4, 5 form a block of four across both A values with B = 0 throughout, so they give B'; cells 5 and 7 share A = 1 and C = 1, so they give A.C. The simplified expression is X = B' + A.C, which needs two gates instead of the five the original sum of three minterms would have taken.

The benefit is that the map is systematic and quick, it gives a minimum sum of products for up to four variables without relying on inspiration, and fewer terms mean fewer gates: a cheaper circuit, a faster one because the signal passes through fewer stages, lower power, and less chance of a wiring error. The limitations are that maps become unmanageable beyond four or five variables, they handle XOR and XNOR patterns badly, and a careless group - three cells, a diagonal, or a group that does not actually cover the 1s - gives a wrong expression that still looks tidy.

Row A, column BC00011110
01100
11110
Group size decides how many variables disappear. Before you write a term, count the cells in the group: 4 cells means two variables dropped, so a four-cell group in a three-variable map has a one-variable term.

Key terms you must be able to define

RISC
Reduced Instruction Set Computer. A processor with a small set of simple, fixed-length instructions, few addressing modes, a load/store architecture and many general-purpose registers, designed so that most instructions complete in one clock cycle and the processor can be pipelined easily.
CISC
Complex Instruction Set Computer. A processor with a large set of variable-length instructions, many addressing modes and fewer registers, in which a single instruction may do several operations and take several clock cycles, usually with a microprogrammed control unit.
Interrupt
A signal from hardware or software telling the processor that an event needs attention. It is checked at the end of the current instruction; the processor then saves its state, runs the interrupt service routine, restores the state and resumes.
Pipelining
Overlapping the stages of the fetch-decode-execute cycle so that several instructions are in the processor at once, each at a different stage. It increases throughput - after filling, one instruction completes per clock cycle - but does not shorten the time taken by a single instruction.
Register
A small, very fast storage location inside the processor, built from flip-flops, holding one word. Registers hold the program counter, the current instruction, addresses, operands, results and status flags, so the processor rarely has to wait for main memory.
SISD
Single Instruction, Single Data. One instruction stream working on one data stream at a time - the conventional single-processor computer.
SIMD
Single Instruction, Multiple Data. One instruction applied to many data items at the same time, as in a GPU shading every pixel of an image, or a vector processor.
MIMD
Multiple Instruction, Multiple Data. Each processor executes its own instruction stream on its own data, as in a multicore processor, a cluster or a supercomputer. The most flexible classification, and the hardest to program.
Massively parallel computer
A computer built from thousands of processors, each with its own local memory, working on different parts of one problem and communicating by message passing over a fast interconnect.
Virtual machine
A software implementation of a computer system that appears to have its own processor, memory, storage and operating system, but which in fact shares the physical hardware of the host under the control of a hypervisor.
Hypervisor
The software layer that creates and runs virtual machines and allocates the physical processor, memory and storage between them. Type 1 runs directly on the hardware; type 2 runs as an application on a host operating system.
De Morgan's laws
(A.B)' = A' + B' and (A + B)' = A'.B'. A NOT over an AND becomes an OR of the inverted terms, and a NOT over an OR becomes an AND of the inverted terms; the rule is break the bar, change the sign, invert each term.
Karnaugh map
A grid of 2 to the power n cells, labelled in Gray code, in which adjacent cells differ in one variable. Grouping the 1s into the largest possible blocks of 1, 2, 4, 8 cells and reading off the variables that do not change gives a minimum sum-of-products expression.
Flip-flop
A circuit of cross-coupled gates with two stable states that holds one bit after the input is removed. The SR version has set, reset, hold and an invalid state; the JK version replaces the invalid state with a toggle, and rows of flip-flops form registers and memory.

Applied to real systems

9618 sets its questions inside systems you already use - a phone, a school network, a supermarket till, a website, a bank. These show how to apply the theory to a context you have not seen before, then you write your own.

ARM Cortex cores in a smartphone (RISC)

Nearly every phone runs on ARM-designed RISC processors, which are licensed to manufacturers rather than sold as chips. The design is RISC because the phone has to be fast on a battery: fixed-length instructions that mostly complete in one cycle, a load/store architecture, a large register file and a deep pipeline give high throughput for very little power, and the many registers make interrupt handling and context switching quick enough for a device that is constantly responding to touches, radios and timers. The same code has to remain compatible across generations, so the instruction set is kept small and stable - the opposite trade-off from the x86 processors in desktop PCs, which keep a large CISC instruction set so that decades of software still runs.

Frontier at Oak Ridge National Laboratory (massively parallel MIMD)

Frontier is a supercomputer built from thousands of nodes, each holding a processor and several graphics processors, all joined by a high-speed network. It is MIMD: each node runs its own instructions on its own data, and the simulation is divided so that each node computes one region of the problem and exchanges the values along its boundaries with its neighbours. That boundary exchange is the communication overhead that limits how far the machine can be scaled - which is why such machines are used for problems that divide neatly, such as climate modelling, molecular dynamics for drug design and the training of large machine-learning models, and not for work that has to be done in a fixed order.

Server virtualisation in a data centre (type 1 hypervisor)

A cloud provider runs a bare-metal hypervisor such as VMware ESXi or Microsoft Hyper-V directly on each physical server and then creates dozens of virtual machines on it. Each VM has its own operating system and believes it owns the hardware, while the hypervisor schedules them onto the real processor and shares out memory and disk. This is server consolidation: hardware that would otherwise sit mostly idle is fully used, a new server can be provisioned from an image in minutes, snapshots allow a failed upgrade to be rolled back, and a VM can be moved to another host while it is still running. The risks are the ones the syllabus calls limitations - the physical host is a single point of failure, and VMs that contend for the same resources slow each other down.

The Java Virtual Machine (process virtual machine)

When Java is compiled it is not turned into the machine code of any particular processor but into bytecode for the Java Virtual Machine. The JVM is a process virtual machine: it emulates just enough of a computer to execute that bytecode, interpreting it or compiling it further for the real processor underneath. The result is portability - the same compiled class file runs on Windows, Linux, macOS or a phone - at the cost of some speed and the need for the JVM to be installed. It is the clearest example of a virtual machine whose role is to hide the real hardware rather than to share a server between operating systems.

Full adders inside the ALU

The arithmetic logic unit of a processor adds two numbers with a ripple carry adder: one full adder per bit, with the carry out of each stage wired into the carry in of the next. Each stage is the Sum = A XOR B XOR Cin and Cout = A.B + Cin.(A XOR B) circuit, built from two half adders and an OR gate. The chain is why addition of wide numbers is slower than a single gate delay - the carry has to travel through every stage - and it is why designers look for faster carry schemes in high-performance processors.

Flashcards

Click a card to flip it. Mark honestly — the tracker uses this.

Q1Give three differences between a RISC and a CISC processor.
RISC: small instruction set, fixed-length instructions, mostly one clock cycle each, few addressing modes, load/store architecture, many general-purpose registers, hardwired control unit, easily pipelined, larger programs. CISC: large instruction set, variable-length instructions, often several cycles each, many addressing modes, memory operands allowed in most instructions, fewer registers, microprogrammed control unit, harder to pipeline, shorter programs.
Q2How does pipelining improve performance, and why is a RISC processor suited to it?
Pipelining overlaps the stages of the fetch-decode-execute cycle, so while one instruction executes the next is decoded and another is fetched. After the pipeline fills, one instruction completes per clock cycle, so throughput rises (a five-stage pipeline gives close to five times), although no single instruction finishes sooner. RISC suits it because instructions are fixed length and mostly one cycle, so every stage takes the same time, the decode stage is simple, addressing is simple and many registers mean fewer memory stalls. Hazards - data, control and structural - cause stalls or flushes.
Q3Name four registers and say what each holds.
Program counter: the address of the next instruction to be fetched. Memory address register: the address currently being read or written. Memory data register: the data passing to or from memory. Current instruction register: the instruction being decoded and executed. Also: the accumulator holds arithmetic results, the status register holds the flags, the stack pointer holds the top of the stack, and the general-purpose registers hold operands and results - a RISC has many of these.
Q4Describe how a processor handles an interrupt, and say why it is quicker on RISC.
It checks for interrupts at the end of each instruction, finishes the current instruction, saves the processor state (program counter and registers, usually to a stack), loads the address of the interrupt service routine from the interrupt vector table into the program counter, runs the ISR, restores the state and resumes the program. RISC is quicker because instructions are one cycle and fixed length, so there is never a long instruction to finish - interrupt latency is short and predictable - and because the many registers, sometimes banked or shadowed, let the context be saved with few or no memory writes.
Q5Define SISD, SIMD, MISD and MIMD.
SISD: one instruction stream on one data stream - a single-processor computer. SIMD: one instruction applied to many data items at once - a GPU shading every pixel, a vector processor. MISD: several processors applying different operations to the same data - rare, used where results are checked or data flows through a chain of stages. MIMD: each processor runs its own instructions on its own data - multicore processors, clusters, supercomputers.
Q6What are the characteristics of a massively parallel computer?
Thousands or tens of thousands of processors, each with its own local memory and its own instruction stream (MIMD), joined by a very fast interconnect and communicating by message passing. The problem must divide into many independent parts. Throughput is enormous and scales with the processor count until communication and synchronisation dominate. Costs and power consumption are high and cooling is heavy, and the software must be written specifically for parallel execution. Used for climate modelling, molecular dynamics, physics simulation and machine-learning training.
Q7What is a virtual machine, and what is a hypervisor?
A virtual machine is a software implementation of a computer system - its own processor, memory, storage, network and operating system - running on shared physical hardware. The hypervisor is the layer that creates and manages the VMs and allocates processor time, memory and storage between them. Type 1 runs directly on the hardware (ESXi, Hyper-V); type 2 runs as an application on a host operating system (VirtualBox, VMware Workstation). A process VM such as the Java Virtual Machine emulates just enough of a machine to run one program.
Q8Give two benefits and two limitations of virtual machines.
Benefits: several operating systems, even incompatible ones, share one physical machine; better use of hardware through server consolidation, saving money, space and power; isolation, so a crash or infection stays inside the VM; snapshots, cloning and live migration make testing and recovery quick. Limitations: slower than running directly on the hardware, because resources are shared and some instructions are trapped; the host is a single point of failure; performance is unpredictable when VMs contend for the same resources; a hypervisor flaw exposes every guest; extra licensing and management work.
Q9Give the expressions for the outputs of a half adder and a full adder.
Half adder (inputs A, B): Sum = A XOR B; Carry = A AND B. Full adder (inputs A, B, Cin): Sum = A XOR B XOR Cin; Cout = A.B + Cin.(A XOR B). A full adder can be built from two half adders and an OR gate, and chaining full adders with each Cout feeding the next Cin gives a ripple carry adder. Sum is 1 when an odd number of inputs is 1; Cout is 1 when at least two inputs are 1.
Q10How do SR and JK flip-flops behave, and why are they used?
An SR flip-flop (two cross-coupled NOR gates) sets Q to 1 when S = 1, R = 0; resets Q to 0 when S = 0, R = 1; holds its value when S = 0, R = 0; and has an invalid state when S = 1, R = 1, because both outputs become 0. In the NAND version the inputs are active low, so the invalid state is S = 0, R = 0. The JK flip-flop removes the invalid state: J = K = 0 holds, J = 0, K = 1 resets, J = 1, K = 0 sets, J = K = 1 toggles. A flip-flop stores one bit and keeps it after the input is removed, so flip-flops are the storage elements of registers, counters and SRAM.
Q11State De Morgan's two laws and the rule for applying them.
(A.B)' = A' + B' and (A + B)' = A'.B'. Break the bar, change the sign underneath, and invert each term. So (A.B.C)' = A' + B' + C' and (A + B + C)' = A'.B'.C'. Apply them one bar at a time from the outside in: (A.B + C)' = (A.B)'.C' = (A' + B').C'.
Q12What are the rules for grouping in a Karnaugh map, and what are the benefits?
Plot a 1 in each cell where the output is 1. Group adjacent 1s in rectangles of 1, 2, 4, 8 or 16 cells, make each group as large as possible and use as few groups as possible; groups may overlap and may wrap round the edges. Variables that change within a group are eliminated, those that stay constant are kept (unbarred for 1, barred for 0). Labels run in Gray code 00, 01, 11, 10 so adjacent cells differ in one variable. Benefits: a systematic minimum sum of products, so fewer gates - cheaper, faster, lower power - with less chance of algebraic error. It becomes impractical beyond four or five variables.
0 of 12 marked as known

Exam-style questions

8 questions, 26 marks. Write your answer, then reveal the mark scheme and tick each point you actually made. Answering honestly here is what makes the rest of the site useful.

StateAO11 mark
A logic circuit has four inputs. State the number of rows needed in its truth table.

Mark scheme — tick each point you actually made

Examiner tip: One mark, one number. Do not write 8 by doubling from three inputs by accident, and do not add an extra row for the output column.
IdentifyAO12 marks
A processor is described as a RISC processor. Identify two features of its design that make it suitable for pipelining.

Mark scheme — tick each point you actually made

Examiner tip: Any two of the three. Each point needs the feature and the reason it helps the pipeline - 'fixed length' alone is a fact, 'fixed length, so every stage takes the same time' is a mark.
ExplainAO23 marks
Explain how pipelining improves the performance of a processor.

Mark scheme — tick each point you actually made

Examiner tip: The third mark is for the effect on throughput rather than on the speed of one instruction. Add that it does not shorten a single instruction's journey and you show you understand what pipelining does not do.
DescribeAO13 marks
Describe how a processor handles an interrupt.

Mark scheme — tick each point you actually made

Examiner tip: Order matters: finish, save, service, restore. A description that starts by saying the program stops, or that omits saving the state, cannot score the second or third mark.
ExplainAO24 marks
Explain why a RISC processor responds to an interrupt more quickly than a CISC processor.

Mark scheme — tick each point you actually made

Examiner tip: Four separate mechanisms, each linked to speed of response. 'RISC is faster' repeated in different words scores once.
DemonstrateAO24 marks
A logic circuit has output X where X = NOT (A OR B) OR (A AND B). Demonstrate, using Boolean algebra and De Morgan's laws, that X is the exclusive NOR (XNOR) function.

Mark scheme — tick each point you actually made

Examiner tip: Show the De Morgan step as its own line and name the law. A correct final expression with no working usually scores two of the four.
WriteAO24 marks
A logic circuit has inputs A, B and C (A is the most significant bit) and output X, which is 1 for the input combinations 000, 001, 100, 101 and 111 and 0 otherwise. Write the simplest Boolean expression for X, using a Karnaugh map.

Mark scheme — tick each point you actually made

Examiner tip: The overlap of cell 101 is deliberate and is the point of the question - a student who groups 100 with 101 and 000 with 001 separately gets three terms instead of two and loses the last mark.
DiscussAO25 marks
A company plans to replace ten under-used physical servers with one powerful server running ten virtual machines. Discuss the benefits and limitations of this change.

Mark scheme — tick each point you actually made

Examiner tip: Take a side and keep the balance: three benefits and two limitations, each with a consequence for the company. A list of six benefits with no limitation cannot reach the top of the band.

Exam technique for this topic

  • For RISC against CISC, write paired sentences rather than two lists, and finish each pair with the effect: 'RISC instructions are a fixed length, so the decode stage always takes one cycle and the pipeline never waits; CISC instructions vary in length, so decoding is slower and pipelining is harder.'
  • Describe an interrupt as a sequence in the right order: finish the current instruction, save the program counter and registers, load the ISR address from the vector table, run the ISR, restore the state, resume. Saying 'the processor stops what it is doing' throws away the mark for the first step.
  • In any truth table, count the rows first (2 to the power n) and write the inputs in binary counting order. Add a column for every intermediate expression, and label every column - an unlabelled column cannot be marked.
  • In a Boolean simplification, take one step per line and name the law you used. For De Morgan, state the rule as you use it: break the bar, change the sign, invert each term.
  • In a Karnaugh map question, draw the grid with the Gray-code labels before you plot anything, then group in powers of two, largest first, allowing overlap and wrap-around. Give the expression and, if asked, the number of gates saved.

Why students lose marks here

A student wroteA student wrote: 'RISC processors are worse than CISC processors because a program needs more instructions, so the program takes longer to run.'
Why it loses marksProgram length is being confused with execution time. A RISC program does contain more instructions, but each one is simple and mostly completes in a single clock cycle, and the processor can pipeline them, so the same job often finishes in less time. The extra instructions are a real cost in code size and compiler effort, not in speed.
The answer that scoresA RISC processor uses a small set of simple, fixed-length instructions, so a program needs more of them, which makes the code larger and puts more work on the compiler. Against that, each instruction is short and predictable: most take one clock cycle, all take the same time to decode, and the processor can overlap them in a pipeline so that one instruction completes every cycle. Fixed length and simple addressing also keep the pipeline free of stalls. A CISC processor needs fewer, longer instructions, which keeps the code small, but each may take several cycles and the varying lengths make pipelining harder. Neither is simply better: RISC wins on power and predictable speed, which is why it dominates phones and embedded systems, while CISC wins on code size and compatibility with existing software.
A student wroteA student wrote: 'When an interrupt occurs the processor stops the program it is running and immediately jumps to the interrupt routine.'
Why it loses marksTwo steps are missing and the timing is wrong. The processor only tests for interrupts at the end of an instruction, so the current instruction must be completed first, and nothing is said about saving the processor state - which is the step that makes it possible to return.
The answer that scoresThe processor checks for interrupts at the end of each fetch-decode-execute cycle. If one is pending it finishes the instruction it is executing, then saves the processor state - the program counter and the contents of the registers - usually by pushing them onto a stack. It loads the address of the interrupt service routine from the interrupt vector table into the program counter and executes that routine to service the device. When the routine ends, the saved state is restored and the original program resumes at exactly the instruction it had reached, so from the program's point of view nothing has changed except the time taken.
A student wroteAsked for the truth table of a circuit that adds two bits and a carry in, a student produced a four-row table with inputs A and B and outputs Sum and Carry.
Why it loses marksThat is a half adder. The question specified three inputs, so the table must have 2 cubed = 8 rows and a third input column for the carry in. The four-row table is not a smaller version of the answer, it is the answer to a different question.
The answer that scoresA full adder has inputs A, B and Cin and outputs Sum and Cout, and needs eight rows in binary counting order. Sum = A XOR B XOR Cin, so it is 1 when an odd number of inputs are 1; Cout = A.B + Cin.(A XOR B), so it is 1 when at least two of the three inputs are 1. For example, with A = 1, B = 1, Cin = 1 the outputs are Sum = 1 and Cout = 1, because 1 + 1 + 1 = 11 in binary. The half adder has only A and B and no carry in, which is why it cannot be used beyond the least significant column of a multi-bit addition.
A student wroteA student simplified (A.B)' as A'.B' and used that as the first line of a proof.
Why it loses marksThat is De Morgan's law applied with the sign left unchanged. The NOT of an AND is the OR of the NOTs, so the connector must change from AND to OR as well as each term being inverted. The error is easy to check with a truth table: at A = 1, B = 0, (A.B)' = 1 while A'.B' = 0.
The answer that scores(A.B)' = A' + B', and (A + B)' = A'.B'. The rule is: break the bar, change the sign underneath, and invert each term. Applying it to a longer expression works one bar at a time from the outside in, so (A.B + C)' = (A.B)'.C' = (A' + B').C'. Checking a single row of the truth table, such as A = 1, B = 0, C = 0, confirms it: the left side is (0 + 0)' = 1 and the right side is (0 + 1).1 = 1.
A student wroteIn a Karnaugh map a student ringed three adjacent 1s, ringed two 1s diagonally, and wrote the expression from those groups.
Why it loses marksGroups must contain a power of two number of cells - 1, 2, 4, 8 - and must be rectangles, so three cells and a diagonal pair are not legal groups. A diagonal pair also does not represent a single term, because the two cells differ in two variables, not one.
The answer that scoresOnly blocks of 1, 2, 4, 8 or 16 cells in a rectangle may be grouped, and each block must be as large as possible; blocks may overlap and may wrap round the edges of the map. In a three-variable map, a block of two removes one variable, a block of four removes two, and a block of eight removes all three, leaving a constant. A diagonal pair cannot be grouped, so the 1s it contains must be covered by legal blocks - enlarging a group, overlapping an existing group, or wrapping to the other side of the map - before the expression is written.
A student wroteA student wrote: 'A virtual machine gives the user more memory and a faster processor than the physical computer has.'
Why it loses marksNothing is created. The hypervisor divides the resources that exist, so each VM gets a share of the real processor, memory and disk, and running several VMs on one host means they compete for them. The VM is convenient and isolated, not more powerful.
The answer that scoresA virtual machine is a software implementation of a computer that runs on shared physical hardware under a hypervisor. Its processor time, memory and storage are allocated from the host, so a VM can never exceed the host's real resources and is usually slightly slower than running the same software directly, because some instructions have to be trapped and translated and because it competes with the other guests. What the VM does give is flexibility: several operating systems on one machine, isolation from the host, snapshots and cloning, and machines that can be created, moved or destroyed in minutes - with the trade-off that the host is a single point of failure and that a hypervisor flaw exposes every guest.