Some notes for Software Engineering --
Real-Time
by Herbert J. Bernstein
© Copyright Herbert J. Bernstein, 2002
Real-Time
The design of real-time systems can be fundamentally different from
the design of ordinary applications. When so-called real-time
demands do not crowd push resource limits, then ordinary software
engineering approaches may work. However, when the applications
proposed push available pools of time, space or other resources,
the handling of those constraints can dominate the design
leading to approaches that would never be considered in projects
less demanding of resources.
- Real-Time
- Systems that in which the time to respond is a significant constraint
- Operatings systems, device drivers, data acquisition systems are
examples
- Interactive systems have such constraints (e.g. 1/2 second response)
- Data communications and network design raise real-time issues
- Embedded systems often have such constraints
- Weapons control systems, avionics, etc. raise real-time issues
- Hard Real-Time -- mandatory time constraints
- Soft Real-Time -- desirable time constraints
- Quality and reliability particularly important
- Types of Real-Time constraints
- Event driven
- Periodic events for which response must be completed before
the next event arrives
- Periodic events for which response must be completed within
some given time from event arrival
- Periodic events for which response must be completed
sufficiently rapidly to avoid resource exhaustion
- Sporadic events for which response must be completed before
the next event arrives
- Sporadic events for which response must be completed within
some given time from event arrival
- Sporadic events for which response must be completed
sufficiently rapidly to avoid resource exhaustion
- Intrinsic
- Tasks that must be completed sufficiently rapidly avoid
resource exhaustion or to leave the machine ready for some expected
event (e.g. garbage collection, file system management, etc.)
- Approaches to real-time software design
- Polling
- Interrupts
- Threads
- Threaded code (has nothing to do with threads)
- Hardware support
- Intelligent controllers
- Hardware clocks
- Memory management hardware
- Hardware event silos
- ...
- Issues in real-time design
- Dead-time (inability to respond to events for some period of time)
- Buffer overflows, overruns
- Interlocks
- Synchronization
- Shared data structures
- Error recovery
- Stack overflows
- Disk I/O delays
- DMA lockouts and bus overloads
- Maintainable system
- ...
- Approaches to real-time design
- Queuing Theory
- Model based on customers, servers and queueing discipline
- Qualitative behavior derived from M/M/1 queues
- Service rate must be signficantly faster than customer arrival
rate
- Graph theory
- Network (graph with flows) models
- State trabsition tables, graphs
- Object-oriented design (often with processor(s) for each object)
- Design in Ada or java, implement in C++/C/Fortran/assembler
- Approaches to real-time implementation
- Throw hardware at it and pray -- works well for soft real-time
- Use efficient languages (C, assembler)
- Design a real-time monitor or executive
- Manage time
- Manage interrupts
- Premeptive scheduling
- Polling
- Schedule tasks
- Allocate resources
- Design an operating-system free application
- Avoid disk I/O