- Year not given · 5 marks
Designing software for real-time environments
Short answer
Design must identify stimuli and responses, timing constraints, and use concurrent processes with priority-based scheduling. Avoid unpredictable features like dynamic memory and paging; include state modelling, inter-process communication, and fault tolerance. The process: identify stimuli, timing, aggregate into processes, design algorithms, scheduling, integrate with RTOS.
What specific considerations are to be made while designing typical software to be operated in real time environment? Explain.
Software for a real-time environment must give correct results within time limits, so its design focuses on stimuli, responses, timing and concurrency, not only on functions. The main considerations are:
- Stimulus–response model – identify every stimulus the system must handle and the response it must give. Stimuli are periodic (e.g. read a sensor every 50 ms) or aperiodic (e.g. an alarm interrupt).
- Timing constraints – for each stimulus–response pair, fix the deadline, the frequency of the stimulus and the allowed execution time. Do a timing (worst-case) analysis to make sure all deadlines can be met together, not just on average.
- Concurrency – group stimulus processing into concurrent processes (sensor processes, computation processes, actuator processes), because the system must deal with many events at once.
- Scheduling and priority – choose a priority-based, pre-emptive scheduling policy; give the most time-critical processes the highest priority and handle priority inversion.
- Hardware–software partitioning – decide which functions go to special hardware (for speed) and which stay in software; choose a suitable RTOS and processor early.
- State modelling – describe behaviour with state machine models, since the response depends on the current state of the system.
- Predictability – avoid features with unbounded or unpredictable time, such as dynamic memory allocation, garbage collection, virtual memory paging and unbounded loops.
- Inter-process communication and synchronisation – use buffers, semaphores or monitors so shared data is not corrupted (e.g. producer–consumer with a circular buffer).
- Reliability and fault tolerance – include watchdog timers, redundancy, exception handling and safe-state shutdown, since many real-time systems are safety-critical.
- Resource limits – embedded systems have little memory and power, so the code must be compact and efficient.
- Language and tools – use languages and run-times that support real-time work (C, Ada, Real-Time Java) and timing analysis tools.
Typical real-time design process (Sommerville):
- Identify stimuli and their responses.
- Identify timing constraints for each.
- Aggregate stimulus and response processing into concurrent processes.
- Design algorithms for each process to meet its timing needs.
- Design a scheduling system that starts processes in time.
- Integrate with a real-time operating system.
Example: in a burglar alarm system, a door sensor stimulus must trigger the alarm and call the police within a few seconds, so the sensor process gets high priority while logging runs in the background.
✓ Answer checked by Claude Sonnet 5.5
Related questions
- Real-time versus ordinary software and OS; data acquisition · Software Engineering, chapter 4
- Real-time system and real-time OS components · Software Engineering, chapter 4
- General OS versus real-time OS · Software Engineering, chapter 4
- CASE, CASE environment and CASE tools · Software Engineering, chapter 10
- Software characteristics and software crisis · Software Engineering, chapter 1
- Embedded real-time software; model for project · Instrumentation II, chapter 9
- Increasing reliability of embedded real-time software · Instrumentation II, chapter 9
- Software testing time paradox · Instrumentation II, chapter 9
- Basic functions of real-time kernel · Embedded System, chapter 6 · asked 2×