25-Comp-A6 Software Engineering · May 2014
Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)
National Exams — May 2014 — 98-Comp-A6 Software Engineering. Three-hour, closed-book exam, no calculator permitted. Format: nine questions, candidates answer any five of the nine (all questions equal weight — each of the five counted questions is worth 20%; only the first five questions as they appear in the answer book are marked). All nine questions are solved below for completeness.
Reference texts: Sommerville, Software Engineering (10th ed., Pearson) — software process models, object-oriented design, formal methods, real-time systems, software testing, project management, critical/dependable systems, software quality, distributed systems; Pressman, Software Engineering: A Practitioner's Approach (9th ed.) — supplementary process/testing/quality coverage; IEEE 12207 — software life-cycle processes; SWEBOK — body-of-knowledge cross-reference.
Question text not reproduced: the examination questions are © Engineers and Geoscientists BC. Open the official past paper (linked at the top of this page) to read the question, then follow the worked solution below.
A real-time software system is a system whose correctness depends not only on the logical result it produces but on the time at which that result is produced — the system must respond to events from its environment within a bounded, application-defined deadline, and a logically correct answer delivered too late is a system failure, not merely a late success.
A real-time system typically has to service multiple independent streams of stimuli from its environment simultaneously — each with its own arrival pattern and its own deadline — and these streams do not politely wait for one another. A single sequential process can only be doing one thing at a time, so if it is in the middle of servicing a slow stimulus when a second, urgent stimulus arrives, the second one is either delayed past its deadline or the first must be interrupted mid-computation; neither option is expressible cleanly in a purely sequential program. Structuring the system as a set of concurrent processes (or tasks), one per logically independent stimulus/response pair, each with an assigned priority reflecting its deadline urgency, lets a scheduler make the interruption decision explicitly and correctly rather than accidentally. For example, in an aircraft's autopilot, a process reading the attitude sensors and adjusting the control surfaces must run on a hard, very short period regardless of what else is happening, while a process logging flight data to a display can be pre-empted whenever the attitude-control process needs to run; only a concurrent structure lets the high-priority task pre-empt the low-priority one on demand. A second, related reason is that many real-time systems are naturally decomposed into logically independent sub-systems (sensor polling, local hazard detection, communication with a remote computer) that would otherwise have to be awkwardly interleaved by hand inside one function if written sequentially; concurrency lets each be programmed, reasoned about, and scheduled independently.
The system decomposes cleanly along the boundary the question itself draws: sensors are grouped into 100 neighborhoods, alarm decisions are local to a neighborhood, and only summary reporting is centralized. This suggests a three-tier concurrent process architecture: one lightweight periodic process per sensor group performing the interrogation and local threshold check, running under a central computer that aggregates and reports.
Sizing the design against the numbers given: 5,000 sensors organized into 100 neighborhoods puts 50 sensors in each neighborhood; each sensor is interrogated 4 times per second; the alarm threshold is more than 30% of a neighborhood's sensors reporting below-acceptable air quality; and the central computer's report period is 15 minutes.
The resulting architecture places the deadline-critical work (poll a sensor 4 times a second and react to a local threshold) inside 100 small, independent, high-priority periodic processes, one per neighborhood, each with a hard 250 ms period. This isolates the warning-light response time from anything the central computer is doing, satisfying the safety-relevant part of the requirement even if the central link is briefly slow or the report generation is running. The Central Computer runs a lower-priority periodic process (period 15 minutes) that simply collects the running counts/summaries already computed by each neighborhood process and formats the city-wide report; because the local alarm decision is made entirely within the neighborhood process, the warning lights never wait on the central computer at all.
| Quantity | Value |
|---|---|
| Sensors per neighborhood | 50 |
| Poll rate per neighborhood process | 200 reads/s |
| System-wide poll rate | 20,000 reads/s |
| Local alarm threshold (sensor count) | > 15 of 50 (i.e. ≥16) |
| Central report period | 900 s (15 min) |
| Readings per sensor per report cycle | 3,600 |