← Back to subjects
⭐ 0
OCR A-level Computer Science (H446) Β· Software and software development
Mini-Lesson

Software & software development

This mini-lesson covers OCR 1.2 β€” Software and software development: what the operating system is actually doing while your program runs, how source code becomes machine code, and how software projects are organised.

  • The operating system β€” memory management, paging and virtual memory
  • Interrupts and the interrupt service routine
  • Scheduling algorithms β€” round robin, FCFS, SJF, SRT
  • Translators and the stages of compilation
  • Methodologies β€” waterfall, agile, spiral, RAD

Work through each screen, answer the questions as you go (some are recall, some are calculations you must actually work out) and collect ⭐ stars. Press Start when you're ready.

1.2 Β· The OS

The role of the operating system

The OS sits between the hardware and the applications and hides the hardware's complexity. Its jobs:

  • Memory management β€” allocating RAM to processes, paging, segmentation and virtual memory;
  • Processor scheduling β€” deciding which process runs next;
  • Interrupt handling;
  • File management β€” directories, permissions, allocation of disk space;
  • Peripheral management via device drivers;
  • Security β€” user accounts and access rights; and providing a user interface.

Paging vs segmentation: pages are fixed-size physical divisions of memory; segments are variable-size logical divisions that correspond to actual parts of a program (a subroutine, an array). Pages are simpler for the hardware; segments map better onto how a program is really structured.

Virtual memory uses secondary storage as an extension of RAM. Pages not currently needed are swapped out. If the swapping becomes constant, the machine thrashes β€” more time is spent moving pages than executing code.

Types of OS: multi-tasking (time-slices the CPU between processes), multi-user (schedules fairly between users), distributed (spreads work across many machines), embedded (built for one task, limited resources, highly reliable), real-time (guarantees a response within a fixed deadline β€” an aircraft or a pacemaker).

Calculate

Your turn β€” paging

1A process needs 10 KB of memory. The page size is 4 KB. How many pages must be allocated to it?
pages
Hint: Pages are a fixed size and cannot be split. 10 Γ· 4 is not a whole number β€” you must round up, and the last page is only partly used.
1.2 Β· Interrupts

Interrupts and the interrupt service routine

An interrupt is a signal telling the processor that something needs attention now β€” a key pressed, a disk transfer finished, a divide-by-zero, a power failure.

At the end of each FDE cycle the processor checks the interrupt register. If an interrupt of higher priority than the current task is waiting:

  • the contents of the registers are pushed onto a stack;
  • the appropriate interrupt service routine (ISR) is loaded and run;
  • on completion the saved registers are popped back and the interrupted program resumes exactly where it left off.

Why a stack and not just a variable? Because a higher-priority interrupt can arrive while an ISR is running. The stack nests them naturally: the most recent state saved is the first restored. LIFO is not a convenience here β€” it is a necessity.

1.2 Β· Scheduling

Scheduling algorithms

The scheduler decides which process gets the CPU. It aims to maximise throughput, keep the CPU busy, and be fair.

AlgorithmHow it worksWeakness
Round robinEach process gets a fixed time slice in turnFair, but ignores urgency and priority
First come, first servedIn arrival order, run to completionOne long job blocks everything behind it (convoy effect)
Shortest job firstThe shortest total burst goes firstGives the best average wait β€” but long jobs may starve, and it needs the burst times in advance
Shortest remaining timePre-emptive: switch if a new job is shorter than what remainsBest response times; the most context switching
Multi-level feedback queuesSeveral queues of different priority; jobs move between themFlexible but complex to tune
Worked example β€” shortest job first

Burst times 6, 2, 8, 4 (all arriving at once). SJF runs them in the order 2, 4, 6, 8.

Waiting times: 0, then 2, then 2+4 = 6, then 6+6 = 12.

Average wait = (0 + 2 + 6 + 12) Γ· 4 = 20 Γ· 4 = 5

Run them first-come-first-served in the original order and the average wait is 7.5 β€” half as good again.

Calculate

Your turn β€” scheduling

2Four processes arrive together with burst times 6, 2, 8, 4. Using shortest job first, what is the average waiting time?
Hint: Put them in ascending order of burst time. The first waits 0; each later job waits for all those before it. Average the four waits.
Quick check

Scheduling

?Why can shortest job first cause starvation?
1.2 Β· Translators

Translators and the stages of compilation

CompilerInterpreterAssembler
Translates the whole program in advanceTranslates and runs one statement at a timeTranslates assembly to machine code, one-to-one
Produces an executable; runs fastProduces nothing; slow; re-translates every loop passProduces machine code
Reports all errors at the endStops at the first error β€” great for debuggingβ€”

The four stages of compilation:

  • Lexical analysis β€” strip whitespace and comments; convert the source into tokens; build the symbol table.
  • Syntax analysis β€” check the tokens against the language's grammar (its BNF); build an abstract syntax tree; report syntax errors. Some semantic checks (type mismatches, undeclared variables) also happen here.
  • Code generation β€” produce object code (machine code) from the tree.
  • Optimisation β€” make the code smaller or faster: remove unreachable code, hoist constant expressions out of loops, reuse registers.

Linkers and loaders: a linker combines your object code with the library modules it calls. Static linking copies them into the executable (bigger file, no dependencies); dynamic linking leaves them to be loaded at run time (smaller file, shared libraries, but it breaks if the library is missing). A loader puts the executable into memory and starts it.

Quick check

Stages of compilation

?At which stage of compilation are comments and whitespace removed and the source turned into tokens?
1.2 Β· Methodologies

Software development methodologies

MethodCharacterBest when…
WaterfallStrict linear stages; each is signed off before the nextRequirements are fully known and stable; heavy documentation is required (safety-critical, government)
Agile / extreme programmingShort iterations, working software each cycle, constant customer contact, pair programming, test-driven developmentRequirements are unclear or changing; the customer is available
SpiralIterative, with formal risk analysis at every loopLarge, expensive, high-risk projects
Rapid application developmentPrototype fast, get user feedback, refine, repeatThe interface matters most and the user must see it to react to it

The honest comparison: waterfall's fatal flaw is that a requirement misunderstood at the start is not discovered until testing, when it is ruinously expensive to fix. Agile's cost is thinner documentation and a scope that can drift β€” and it needs a customer who will genuinely engage. Neither is universally right: a pacemaker's firmware should not be built by iterating on user feedback in production.

Quick check

Methodologies

?A start-up is building an app whose features will be shaped by user reaction, and the client wants to see working software every fortnight. Which methodology fits?
Quick check

Interrupts

?Why are the contents of the registers pushed onto a stack when an interrupt is serviced?
Sort it

Sort the software

Tap an item, then tap the group it belongs to.

πŸ› οΈ System software

πŸ’Ό Application software

⏱️ Scheduling algorithm

Match it

Match the stage of compilation

Tap an item on the left, then its partner on the right.

What happens
Stage
Recap

The big ideas to know

OS: memory management (paging = fixed, segmentation = variable) Β· scheduling Β· interrupts Β· files Β· peripherals Β· security

Virtual memory: pages swapped to secondary storage; constant swapping = thrashing

Interrupts: checked at the end of each FDE cycle Β· registers pushed to a stack Β· ISR runs Β· state popped back

Scheduling: round robin (fair) Β· FCFS (convoy effect) Β· SJF (best average wait, risks starvation) Β· SRT (pre-emptive)

Compilation: lexical β†’ syntax β†’ code generation β†’ optimisation; then linking (static or dynamic) and loading

Methodologies: waterfall (fixed requirements) Β· agile (evolving) Β· spiral (risk-driven) Β· RAD (prototypes)

That is the whole of OCR 1.2. Press Finish to see your score.

πŸ†

Mini-lesson complete!

⭐⭐⭐

You've worked through Software & software development for OCR A-level Computer Science (H446). πŸŽ‰

Your stars: 0 / 0

Next: test yourself in the Evaluate stage Confidence Quiz, then lock it in with Verify.

πŸ“£ Smashed it? Share your score

Challenge a mate to beat your stars, or show a parent how you got on.

β†’ Back to all subjects