IB COMPUTER SCIENCE | A1

COMPUTER FUNDAMENTALS REVISION

Connect hardware, data representation, logic and operating systems through worked revision. Add the labelled HL material, then select flashcards to build your revision list.

Selections are retained, including cards hidden by filters. All selected cards remain in your revision list.

YOUR A1 REVISION ROUTE

Revise in four connected passes: explain the hardware, represent and process data, describe OS management, then add HL translation. Cover the explanation, recreate a worked example and test recall before checking.

Use the SL/HL switch above to hide HL-only additions. The common material is needed at both levels. Flashcards have subsection filters and a personal revision list; selections remain available while this page is open.

A1.1 | CPU COMPONENTS WORK AS A SYSTEM

The control unit coordinates instruction execution and issues control signals. The ALU performs arithmetic and logical operations. Registers are very small, fast storage locations used during execution; each named register has a particular role rather than simply being another general store.

The address bus identifies the memory or device location involved; the data bus transfers values; the control bus carries signals such as read and write. In a simplified memory transaction the CPU supplies an address, asserts the required operation and transfers data over the data bus.

ComponentPurposeCheck your distinction
PCAddress of the next instruction to fetchAn address, not the instruction itself
MARAddress involved in the current memory accessMay hold a data address or instruction address
MDRData transferred to or from memoryThe value, not its location
IRInstruction currently being decoded/executedOften called CIR in other courses
AccumulatorHolds intermediate arithmetic/logic results in the modelNot every CPU uses one accumulator design
CU / ALUCoordinate operations / perform calculationsControl and calculation are distinct roles

A1.1 | RECONSTRUCT FETCH, DECODE AND EXECUTE

Assume PC = 120 and the instruction there is a fictional LOAD 500. Fetch copies the instruction address to MAR. A memory-read operation returns the instruction via the data bus into MDR, then the instruction is copied to IR. PC advances to the next instruction address under the model’s instruction-length rule.

The CU decodes the operation. Executing this LOAD then accesses data address 500: MAR receives 500 and another read brings that location’s value into MDR. It can then be placed in the accumulator. The instruction fetch and the data read are separate memory accesses.

Not every instruction performs the same execute steps. An arithmetic instruction may use the ALU; a store writes memory; a branch changes PC. The example is a conceptual register trace, not a claim that every modern processor uses exactly this physical implementation.

StageAddress roleTransferred value
FetchMAR gets instruction address 120The encoded LOAD instruction
DecodeIR supplies the instruction to the CUOperation and operand are interpreted
Execute LOADMAR gets data address 500The data value stored at 500

A1.1 | PRIMARY MEMORY AND THE PERFORMANCE CHAIN

Registers supply immediate execution state. Cache holds copies of selected instructions or data close to the core. RAM holds active programs and data. ROM or related non-volatile firmware storage retains startup/control code. Main working RAM is normally volatile; persistent storage is needed for retained files.

A cache hit finds the requested item at the cache level checked; a miss requires checking another level or memory. A miss at L1 does not necessarily mean going all the way to RAM. Locality can make caching effective, but not every access will hit.

StorageTypical roleComparison
RegistersCurrent operands, addresses and execution stateVery small and fast
L1 cacheClosest cache level to a coreUsually smaller and faster than later levels
L2 / L3 cacheLarger backing cache levelsSharing and layout depend on the processor
RAMWorking memory for active softwareLarger; slower access than on-chip storage
ROM / firmware storageRetained startup or device-control codeNon-volatile; implementations can allow controlled updates

A1.1 | GPU USES AND CO-PROCESSING

A GPU is designed to achieve high throughput on suitable parallel workloads. Many execution resources can perform similar operations on large collections of data, making GPUs useful for rendering pixels, matrix operations in machine learning and suitable simulations.

A CPU generally coordinates the program and submits appropriate GPU work; a GPU is not a universal replacement for the CPU. Transfer costs, workload size, dependencies and available software influence whether GPU acceleration helps. A co-processor specialises in work alongside the main processor.

A1.1 | CPU VERSUS GPU: COMPARE THE WORKLOAD HL ONLY

A CPU emphasises flexible control and low latency for varied instruction flows, with sophisticated cores and support for branching and caches. A GPU emphasises throughput across many parallel operations. Core counts across these designs are not directly comparable measures of general performance.

A large uniform matrix calculation can use a GPU efficiently, while a short serial task with many dependencies may not. Divergent execution paths and irregular memory access can reduce GPU efficiency. Power efficiency depends on the task: “GPU always uses less power” is not a valid general conclusion.

In a combined application, the CPU manages sequencing and submits suitable kernels; data must be available to the GPU, and synchronisation ensures results are ready before use. Different systems use separate or shared memory arrangements.

A1.1 | PIPELINING AND MULTIPLE CORES HL ONLY

Pipelining overlaps stages of different instructions. While one instruction executes, another can decode and another can fetch. It improves potential throughput; it does not mean each instruction’s complete latency is divided by the number of stages.

In an ideal four-stage fetch/decode/execute/write-back model, three instructions take six stage intervals: the first completes after four, then another can complete each interval. Without overlap, three instructions would take twelve such intervals. This assumes equal stages and no stalls.

Data dependencies, branches and resource conflicts can force stalls or other corrective work. Multiple cores can each run instruction streams and pipelines in parallel, but adding cores does not automatically accelerate a wholly serial workload.

IntervalFetchDecodeExecuteWrite back
1I1Not activeNot activeNot active
2I2I1Not activeNot active
3I3I2I1Not active
4Not activeI3I2I1
5Not activeNot activeI3I2
6Not activeNot activeNot activeI3

A1.1 | CHOOSE SECONDARY STORAGE FOR A PURPOSE

Secondary storage retains data beyond a program run. Internal and external describe connection or placement, not different storage physics: an SSD or HDD can be internal or external. Capacity, access performance, durability, cost, portability and connectivity affect the choice.

TypeMechanism / example useRelevant limitation
HDDMagnetic platters; bulk local storageMechanical access and sensitivity to shocks
SSDFlash-based storage; fast application/file accessCost, write endurance and controller quality vary
eMMCEmbedded flash with a controller; compact devicesPerformance and serviceability differ from many SSDs
Optical mediaLaser-read/written discs; distribution or retained copiesCapacity, speed and drive availability
Flash drive / memory cardPortable flash storage; transfer or camera recordingLoss, quality and write-life concerns
NASNetwork-accessed storage applianceAccess depends on network, permissions and availability

A storage device is not automatically a backup. A separate recoverable copy and suitable protection are still needed. NAS is a way of providing storage over a network; it is not another name for RAM or a guarantee of cloud storage.

A1.1 | LOSSLESS, LOSSY AND WORKED COMPRESSION

Lossless compression preserves enough information to reconstruct the original exactly. Lossy compression discards selected information to reduce size, so decompression cannot in general restore the exact original. Appropriate choice depends on whether approximation is acceptable.

Run-length encoding stores repeated values with their counts. AAAAABBCC can be represented as (A,5),(B,2),(C,2). It uses three runs; actual space saved depends on how each symbol and count is encoded. Alternating data may expand instead of compressing.

Transform coding expresses data in another representation, such as frequency-like coefficients. In a lossy image scheme, quantisation can coarsen or discard less significant coefficients. The transform by itself is not the step that necessarily loses information.

Compression can reduce storage and transfer requirements, but encoding/decoding costs time and resources. Do not assume every compressed file is smaller or that a lossless method is always best for every use.

A1.1 | CLOUD SERVICES: WHO MANAGES WHAT?

ServiceCustomer mainly uses / managesSuitable scenario
SaaSA provider’s application; user data, access and configurationUse a hosted document editor
PaaSOwn application and data on a managed platformDeploy an app without administering the underlying OS
IaaSVirtual computing resources, with customer control of OS and deployed softwareConfigure a server environment with greater flexibility

Moving from SaaS towards IaaS generally gives more control and more management responsibility. The provider still manages underlying infrastructure; the customer still has responsibilities appropriate to the service, including access and data choices.

A virtual server does not make availability unlimited. Network access, service limits, cost, security configuration, backups and provider outages remain relevant. Choose the model from the required control and maintenance effort.

A1.2 | NUMBER SYSTEMS: CONVERT AND CHECK

Binary uses base 2 and hexadecimal base 16. For 8-bit unsigned binary, place values are 128,64,32,16,8,4,2,1. Hexadecimal digits A to F represent decimal 10 to 15.

For 1010 1101₂, add 128 + 32 + 8 + 4 + 1 = 173₁₀. Split into four-bit groups: 1010 is A and 1101 is D, so the same value is AD₁₆. Check: 10 × 16 + 13 = 173.

For decimal to binary, select powers of two or repeatedly divide by two and read remainders in reverse order. Decimal 45 is 32 + 8 + 4 + 1 = 0010 1101₂ = 2D₁₆. Leading zeros do not change an unsigned value.

Group binary from the right when converting an integer to hex. One hex digit corresponds to four bits because 16 = 2⁴. Do not group into threes or read A as decimal 1.

Hex place16³16²16¹16⁰
Decimal weight4096256161
Example 1A3₁₆01 × 25610 × 163 × 1

Thus 1A3₁₆ = 419₁₀. State the base when the digit string could be ambiguous, and do not treat a hexadecimal representation as inherently encrypted.

A1.2 | BITS NEED AN ENCODING RULE

Bits have no built-in meaning. The same pattern can represent an unsigned integer, a signed value, a character or part of an image, depending on the agreed encoding and context. Storage and retrieval require both the bits and the rules needed to interpret them.

Character encodings map characters or code points to bit sequences. ASCII has 128 code values in its original 7-bit scheme. Unicode is a repertoire of characters and code points; UTF-8 is one encoding of Unicode using variable-length byte sequences. Do not assume every character occupies one byte.

A string is an organised sequence of encoded characters. Metadata or a file format identifies details such as dimensions, encoding or channel count, so a decoder knows how to reconstruct the intended data.

Images use pixel values or indices into a palette. Audio uses sampled values over time. Video adds sequences of frames and timing, often with audio and compression. Compressed size is not obtained merely by multiplying raw dimensions.

A1.2 | REPRESENTATION CALCULATIONS

For a simple uncompressed bitmap: bits = width × height × bits per pixel. A 320 × 200 image at 8 bits per pixel needs 512,000 bits = 64,000 bytes for its pixel data. Headers, padding and a palette can add storage.

For uncompressed sampled audio: bits = sample rate × sample depth × duration × channels. Ten seconds at 8,000 samples/s, 16 bits/sample and two channels needs 2,560,000 bits = 320,000 bytes, excluding extra format data.

Sample rate concerns measurements per second, while sample depth concerns possible values per measurement. Image dimensions concern pixel count, while colour depth concerns the information per pixel. For n bits there are 2ⁿ possible patterns, not n².

A raw fixed-format video estimate multiplies frame pixel data by frame count, adding audio and relevant overhead. Real compressed video can exploit similarities within and between frames, so a raw estimate is not a promise of final file size.

A1.2 | ALL SEVEN GATE FUNCTIONS

ABANDORNANDNORXORXNOR
00001101
01011010
10011010
11110001

NOT has one input: 0 becomes 1 and 1 becomes 0. The other gates in this table have two inputs. OR is inclusive; XOR is true when the two inputs differ; XNOR is true when they are equal, including both zero.

An output bubble means inversion. NAND is NOT of the whole AND result, not simply AND with its first input inverted. Gate shapes and connections carry meaning; decorative colour does not determine the function.

A1.2 | BUILD A TRUTH TABLE WITH INTERMEDIATE COLUMNS

For X = (A OR B) AND NOT C, create P = A OR B and Q = NOT C, then calculate X = P AND Q. Three independent inputs need 2³ = 8 rows; P and Q do not add independent input combinations.

ABCPQX
000010
001000
010111
011100
100111
101100
110111
111100

X is 1 for 010,100,110: C must be 0 and at least one of A or B must be 1. A = 1 does not guarantee X = 1; 101 is a counterexample.

A diagram for the expression uses OR on A,B, NOT on C, then AND on the two intermediate outputs. To check a diagram, read each gate’s result back into an expression. Clearly mark intended junctions and keep separate output signals separate.

A1.2 | SIMPLIFY WITH BOOLEAN ALGEBRA

Here + means OR, juxtaposition or · means AND, and ¬ means NOT. These are Boolean operators, so A + A = A rather than ordinary arithmetic doubling.

RuleBoolean identity
IdentityA + 0 = A; A · 1 = A
DominationA + 1 = 1; A · 0 = 0
IdempotentA + A = A; A · A = A
ComplementA + ¬A = 1; A · ¬A = 0
Double negation¬(¬A) = A
AbsorptionA + A·B = A
DistributiveA·(B + C) = A·B + A·C
De Morgan¬(A·B) = ¬A + ¬B; ¬(A + B) = ¬A·¬B

Worked example: A·B + A·¬B = A·(B + ¬B) = A·1 = A. The simplified circuit needs only the A signal for its output. Both forms give the same output for all A,B input combinations.

For A + A·B, factor A: A·(1 + B) = A·1 = A. An algebraic transformation must preserve all input cases; checking only one row cannot establish equivalence.

A1.2 | KARNAUGH MAPS: GROUP ADJACENT ONES

A Karnaugh map arranges truth-table values so adjacent cells differ in one input bit. For a three-input map, use A for rows and BC columns in Gray order 00,01,11,10. Ordinary 00,01,10,11 order would break the intended adjacency.

This map is 1 for 101,110,111 and 0 elsewhere. Group the bottom-row cells at BC = 01,11: A stays 1 and C stays 1, while B changes, giving A·C. Group BC = 11,10: A and B stay 1, giving A·B.

A \ BC00011110
00000
10111

Groups: bottom row 01–11 gives A·C; bottom row 11–10 gives A·B. The 11 cell belongs to both groups.

The simplified result is X = A·B + A·C = A·(B + C). Groups are rectangular powers of two: 1,2,4,8 and so on. They may overlap and can wrap across opposite edges, but diagonals are not adjacent. Never include a zero in a group of ones.

Choose useful large groups that cover all ones; variables that change within a group disappear from its term. For example, bottom-row BC = 00 and 10 are adjacent across the edges and would give A·¬C if both were 1. Check the final expression against the original table.

A1.3 | ROLE AND NINE FUNCTIONS OF AN OS

An OS abstracts hardware complexity, manages resources and provides common services. A document editor decides how to format a report; OS file services manage access to its stored bytes; hardware performs the physical operations.

The GUI is one interface, not the whole OS. Drivers support device communication. Process isolation and access controls help maintain system integrity while applications and background services run, but do not guarantee that failures or attacks are impossible.

FunctionPurpose / example
Memory managementAllocate, map, protect and reclaim working memory
File systemOrganise persistent files, directories and metadata
Device managementCoordinate I/O, drivers, buffers and queues
SchedulingSelect runnable work for cores
SecurityEnforce identity-related access and privilege rules
AccountingRecord resource use such as CPU time
GUIPresent visual ways to request operations
VirtualizationSupport virtual environments using appropriate virtualization software
NetworkingProvide protocol facilities and communication interfaces

A1.3 | SCHEDULING: COMPARE THE SAME CRITERION

FCFS uses ready arrival order and is non-preemptive in the basic model. RR rotates runnable tasks using a quantum. Priority selects by importance; it may be preemptive or non-preemptive. Multilevel queues classify tasks and need rules both within and between queues. Fixed classes do not imply automatic feedback-based movement.

Use A = 8, B = 3, C = 1 CPU units, all ready at time 0 in A,B,C order. FCFS runs A 0–8, B 8–11, C 11–12. RR at quantum 2 runs A 0–2, B 2–4, C 4–5, A 5–7, B 7–8, A 8–10, A 10–12.

C starts at 4 rather than 11 under RR, but A completes at 12 rather than 8. RR improves C’s initial response here without improving every result for every task. Switching overhead is excluded from those numbers.

Response is arrival to first CPU execution in this model; turnaround is arrival to completion; waiting is total ready-queue delay. With no I/O and all arrivals at 0, B’s RR waiting is completion 8 − burst 3 = 5. Shorter quanta can increase switching costs; strict priorities can starve lower-priority work.

A1.3 | POLLING VERSUS INTERRUPT HANDLING

Polling checks status; interrupts request attention when an event occurs. Busy polling repeatedly checks in an active loop; periodic polling can leave time for other work or sleep. Interrupt handling still has delivery, entry, processing and return costs.

If checks occur at 0,10,20 ms and a retained event occurs at 13, detection is at 20: delay 7 ms. For reliable periodic checks and retained events, the maximum detection gap is approximately the interval. Average delay alone is insufficient for a hard deadline.

For rare unpredictable events on a battery device, wake-capable interrupts can avoid empty checks and allow sleep. For sustained high event rates, batching or a notification-plus-polling hybrid can reduce repeated interrupt overhead.

Evaluate event frequency, CPU overhead, power source, predictability, controlled latency and security. Interrupt storms can disrupt progress; polling is not automatically secure. Short pulses need appropriate retention or detection, and neither method guarantees no lost events.

A1.3 | MULTITASKING, CONTENTION AND DEADLOCK HL ONLY

On one core, interleaving lets several tasks make progress over overlapping periods. Multiple cores can execute tasks in parallel, but still share memory, I/O and locks. A blocked task waits for an event; a ready task can execute if selected.

Contention is competition for a limited resource. Ordinary waiting may resolve as another task finishes. Deadlock occurs when dependencies prevent a set of tasks proceeding without intervention, such as A holding R1 and waiting for R2 while B holds R2 and waits for R1.

The resource model has mutual exclusion, hold-and-wait, no safe resource preemption and circular wait. CPU preemption does not safely release an arbitrary lock. Consistent lock order prevents the demonstrated circular wait; detection and recovery may involve cancellation or rollback with lost work.

Starvation differs: a task can be repeatedly passed over while others progress. Aging can help unfair priority waiting but does not automatically break a lock cycle. The OS supplies management and synchronisation facilities; applications must use them correctly.

A1.3 | CONTROL COMPONENTS AND FEEDBACK HL ONLY

A sensor measures; a controller executes a control algorithm; an actuator causes physical change. Sensors and actuators can be input and output transducers, so those categories overlap rather than requiring three separate devices.

The setpoint is the desired quantity, the measured value is the reported estimate and the control signal is the command. A command is not proof of the actual outcome. In closed loop, measured outcome information influences later action; in open loop, that feedback does not adjust the command.

For heating, define error = setpoint − reading. Target 22 and reading 19 gives +3. A hysteresis rule turns on below 21.5, off above 22.5 and retains its previous state within the band. At 22, its action therefore depends on previous state.

Feedback can respond to disturbances such as an open window, but biased measurements, delays or insufficient heater power can prevent the intended actual result. Not every sensor input is feedback about the final controlled output.

A1.3 | EIGHT REAL-WORLD CONTROL APPLICATIONS HL ONLY

ApplicationExplain the chain
Autonomous vehicleRelevant sensing → estimates and motion targets → steering/propulsion/braking → measured motion; operating limits remain
Home thermostatTemperature reading → heating rule → heater → later temperature feedback
ElevatorFloor request and position → movement sequence → drive/brake; door-lock confirmation is an interlock
Washing machineStage, level, temperature and speed inputs → programme logic → valves, heater, drum and pump
Traffic signalsPlan or detector demand → constrained phase logic → lamps; traffic feedback differs from merely a request
IrrigationMoisture reading → watering rule → valve/pump → later soil measurement
Home securityArmed mode and zone event → delay/authorisation rule → alarm/notification; door contact is not siren-output feedback
Automatic doorApproach request and safety inputs → state logic → motor; position reports completion

Explain a particular function and boundary. A washing machine can mix timed actions and feedback loops; a security event rule is not automatically a regulator of its siren output. For each case, connect information to a decision and consequence.

A1.4 | TRANSLATION PATHS: COMPILING AND INTERPRETING HL ONLY

A compiler translates a source representation into another target representation before that target is executed. The target may be native machine code or an intermediate form such as bytecode. Compilation is not defined by the promise that every program error is found.

An interpreter executes a representation through runtime software rather than requiring all of it to be supplied as a separate native executable first. It need not read one source line at a time: an implementation can parse or compile source to an internal representation before interpretation.

Bytecode targets a virtual-machine instruction set. A compatible runtime can interpret it, while a JIT compiler can compile selected bytecode or other intermediate code to native instructions during execution. Systems can combine these approaches.

Do not say a language is inherently only compiled or only interpreted. The translation and execution strategy belongs to its implementation and toolchain.

A1.4 | EVALUATE ERRORS, TIME, PERFORMANCE AND PORTABILITY HL ONLY

CriterionAhead-of-time native compilationInterpretation / bytecode with runtime
PreparationTranslation occurs before the produced native code runsParsing or bytecode preparation may still be needed
ExecutionCan use pre-generated optimised codeRuntime decoding may cost work; JIT can reduce repeated interpretation
ErrorsCan reject invalid syntax and other detectable issues before executionMay detect some issues before running; dynamic errors arise when relevant execution occurs
PortabilityNative output depends on target architecture, OS and interfacesIntermediate code needs a compatible runtime and dependencies
DistributionCan distribute native build rather than sourceRepresentation and runtime requirements vary by implementation

JIT trades runtime compilation and warm-up costs for potential later speed. A short-lived program may not benefit in the same way as a long-running hot loop. Neither native compilation nor interpretation guarantees correctness, secrecy or best performance.

Rapid development can favour an interactive runtime and short edit-run cycles. Performance-critical work can favour suitable optimised native compilation or a mature JIT, supported by measurement. Cross-platform work can favour bytecode plus compatible runtimes, but libraries, OS services and architecture assumptions still limit portability.

For evaluate, reach a context-based judgement. “Compilation is always faster” ignores translation time, startup, runtime optimisation and workload differences.

COMMON MISTAKES | CORE MATERIAL

ConfusionCorrect distinction
PC versus IRPC is an address; IR holds the instruction
Cache versus permanent storageCache accelerates selected accesses; it is not a file backup
GPU versus universal speed-upBenefit depends on parallelism, data access and overhead
Lossless versus lossyExact reconstruction versus selected irreversible information loss
Hex versus encryptionA representation is not secrecy
UTF-8 versus UnicodeAn encoding versus the character/code-point system
OR versus XORBoth true is included only by inclusive OR
Truth-table columns versus independent inputsIntermediate results do not double the row count
K-map adjacencyGray ordering, edge wrap and powers-of-two groups; no diagonal grouping
Accounting versus schedulingRecord usage versus choose execution
Interrupt versus instant completionRequest, handler start and finished response are different times

COMMON MISTAKES | HL ADDITIONS HL ONLY

Pipelining improves potential throughput, not necessarily single-instruction latency. Multitasking does not require multiple cores. Contention is not automatically deadlock. A blocked task is not automatically starved.

A sensor request is not automatically outcome feedback. An actuator command is not confirmation of the result. A closed loop does not remove physical limits or sensor error.

A compiler need not target native code, and an interpreter need not execute directly from source lines. Bytecode still needs a suitable runtime; JIT includes runtime translation overhead. Compiler error checks do not prove logical correctness.

RETRIEVE, CHECK AND CHOOSE YOUR NEXT STEP

Without looking, trace a fetch and a data read; convert 173 between all three bases; reconstruct the seven-gate table; simplify A·B + A·¬B; group the Karnaugh map; compare RR with FCFS using one criterion; and justify polling or interrupts for a stated device.

Reveal core checkpoints

Fetch uses the instruction address; a later data read can use an operand address. 173₁₀ = AD₁₆ = 1010 1101₂. A·B + A·¬B = A. The worked three-variable map gives A·B + A·C. RR can offer earlier turns at switching cost; choose a quantum and workload before making a numerical claim. Event strategy depends on timing, frequency, power and handling overhead.

HL checkpoint: explain the two-lock deadlock, distinguish feedback from an interlock, and evaluate a bytecode/JIT approach for a long-running cross-platform application.

Reveal HL checkpoints

Each task holds what the other needs, so extra CPU time does not break the lock dependency. Feedback reports an outcome used to adjust action; an interlock permits or prevents an action under a condition. Bytecode can support portability through compatible runtimes, while JIT may optimise repeated work but incurs warm-up/compilation costs and does not remove dependency constraints.

Use the flashcards to select uncertain ideas and return to their lesson. The end-of-topic review is the separate assessment checkpoint; this revision page supports recall and understanding.

End of topic review