NivaarExam PrepOfficial exam papers ↗

25-Comp-A6 Software Engineering · May 2015

Question 6 of 8: Real-Time Systems

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer)

Notes on this paper

National Exams — May 2015 — 98-Comp-A6 Software Engineering. Three-hour, closed-book exam, no calculator permitted. Format: eight questions, candidates answer any five (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 eight questions are solved below for completeness.

Reference texts: Sommerville, Software Engineering (10th ed., Pearson) — software process models, function-oriented and object-oriented design, software testing, distributed software engineering, real-time software engineering, reliability engineering, verification and validation; Pressman, Software Engineering: A Practitioner's Approach (9th ed.) — supplementary process/testing coverage; Coulouris, Dollimore, Kindberg & Blair, Distributed Systems: Concepts and Design — scalability, distributed objects, client-server architectures.

Question 6: Real-Time Systems (a) 5, (b) 2, (c) 3, (d) 10 — 20 marks

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) Definition of a Real-Time Software System

A real-time software system is one whose correctness depends not only on the logical correctness of the results it produces, but on the time at which those results are produced: the system must respond to stimuli from its environment within a specified, bounded time, and a logically-correct response delivered too late is considered a failure of the system, not merely a delayed success.

(b) Soft vs. Hard Real-Time Systems

In a hard real-time system, missing a deadline is a system failure with potentially catastrophic consequences (e.g. an airbag control system deploying too late to protect the occupant). In a soft real-time system, missing an occasional deadline degrades the quality of service but does not constitute outright system failure (e.g. a video-streaming player occasionally delivering a frame late causes a visible stutter, not a safety incident).

(c) Three Real-Time System Examples

SystemStimuliControls / Monitors
Anti-lock braking system (ABS)Wheel-speed sensor signals at each wheelControls the brake-fluid solenoid valves at each wheel to prevent lock-up
Patient infusion pumpInfusion-rate/pressure sensor readings; programmed dosage rateControls the pump motor delivering medication; monitors line-occlusion and air-in-line conditions
Elevator control systemFloor call buttons, in-car floor-select buttons, car-position and door sensorsControls the hoist motor and door actuators; monitors car position and overload condition

(d) State Machine Model of the Coffee-Vending Machine

Reading the narrative as a trace through the machine's states gives four states connected by the sequence of user actions it describes: the machine idles until a coin is deposited, then waits for the selection (coffee, with an optional milk/sugar choice), then outputs the cup, then waits for the user to trigger hot-water dispensing before returning to idle.

IdleAwaitingSelectionDispensingCupDispensingWatercoin insertedbutton pressed (coffee +/- milk/sugar)cup placed under tap, water button pressedhot water dispensed → cup removed
Fig. Q6(d) — state machine for the coffee-vending-machine control software.

Idle is the machine's rest state, awaiting a coin. On coinInserted it transitions to AwaitingSelection, in which the machine accepts the button press encoding the drink type and the milk/sugar options (the question's "with and without milk and sugar" is modelled as a parameter of the single selectionMade event, not as separate states, since it changes what is dispensed but not the control sequence). On selectionMade the machine transitions to DispensingCup, outputs a cup with the selected powdered mix, and waits in that state for the user to place the cup under the tap and press the water button. On waterButtonPressed it transitions to DispensingWater, dispenses hot water, and on completion returns automatically to Idle to await the next customer.

Check — assumptions
The machine is assumed to have no cancel/refund path (not described in the narrative) and no timeout back to Idle if the user never places the cup under the tap; both are reasonable real-world extensions but are outside what the question specifies, so they are omitted here to keep the model an exact reflection of the given narrative.