Introduction To Rts
Introduction To Rts
Introduction
Characteristics of RTS Hardware (CPU, I/O device etc)
Real Time Programming Language
a clock!
Language support, e.g. Ada tasking
Real Time Operating Systems (RTOS)
System support: scheduling, resource handling
A real time OS (function as standard OS, with predictable
Design and Analysis of RT Application Software
Modeling and analysis behavior and well-defined functionality)
Reliability and Fault-Tolerance
Fault tolerant, failure recovery, exception handling
Distributed real time systems A collection of RT tasks/processes (share resourses,
Real Time Communication: TTCAN communicate/synchronize with each other and the
environment)
1 2
Components of RT Systems
Characteristics of a RTS
Large and complex — vary from a few hundred lines
Other Computers
Comm. Network of assembler or C to 20 million lines of Ada estimated
for the Space Station Freedom
Actuators Real Time Software Concurrent control of separate system components
— devices operate in parallel in the real-world; better
to model this parallelism by concurrent entities in the
Real Time OS program
e.g. Facilities to interact with special purpose hardware —
Cars, need to be able to program devices in a reliable and
trains Task Task abstract way
Sensors Task
Mixture of Hardware/Software: some modules
implemented in hardware, even whole systems, SoC
Physical World
3 4
Reactive Systems
which they operate; failure to control can Must react to the environment in time:
result in loss of life, damage to environment Time-sensitive systems
5 6
1
Terminology (ctn.) Real-time Programming Languages
It often deals with continuous variables e.g. Assembly languages
temperature, speed, etc (hybrid systems, dynamics Sequential programming languages — e.g. Pascal, C.
systems) Both normally require operating system support.
RT system may consist of many processes running on High-level concurrent languages e.g. Concurrent
single processor (concurrent/multi-task systems) Pascal, Ada, Modula-2, Java.
tightly-coupled processors (parallel systems), No/less operating system support!
multicores, MPSoC We will consider:
loosely-coupled processors connected by a
Ada 95 and C
network (distributed systems)
7 8
Real real-time — systems which are hard real-time and in which the
response times are very short. E.g. Missile guidance system.
9 10
11 12
2
Programming the car controller (1) Any problem?
Process Speed: Process ABS We don’t know if the deadlines are met!
Loop Loop
next := get-time + 0.02 next:=get-time + 0.04 We need to know the execution times
read sensor,compute,display... Read sensor, compute, react We need to do schedulability analysis
sleep until next sleep until next We need to construct a schedule
End loop End loop We need to implement/buy an RT operating system
Run-time system (in programming language design)
Process Fuel Soft RT Processes
Loop Loop
next:=get-time + 0.08 read temperature
read data, compute, inject ... elevator, stereo
sleep until next ....
End loop End loop
15 16
3
Main desirable properties of RT Systems (2) Predictability: the most important one
Maintainability: modular structure to ease system The system behaviour is known before it is
modification put into operation!
Robustness: must not collapse when subject to peak
e.g. Response times, deadlock freedom etc
19 20
System calls: difficult to know the worst execution times Difficult to calculate the worst case execution time for
(theoretically impossible, halting problem) tasks (theoretically impossible, halting problem)
Cache (hit ratio, never exact), pipelines ... Avoid dynamic data structures
DMA stealing CPU memory cycle (when CPU running a hard Avoid recursion
task) Bounded loops e.g. For-loops only
Interrupt handling may introduce unbounded delays Complex synchronization patterns between tasks:
Priority inversion (low-prority tasks blocking high-prior taskts) potential deadlocks (formal verification)
Memory management (static allocation may not be enough,
dynamic data structures e.g. Queue), no virtual memory
Communication delays in a distributed environment
21 22
687 meters
23