Dr. Hugh Melvin, Dept. of IT, NUI,G 1
Realtime Systems
Dr.Hugh MelvinRoom 406 Ext 3716
[email protected] Web resources
Dr. Hugh Melvin, Dept. of IT, NUI,G 4
Main Textbooks
• Real-Time Systems , Krisha & Shin, McGraw Hill
• Real-Time Systems Design & Analysis. Laplante, Wiley
• Programming for the Real World POSIX.4, Gallmeister, O Reilly
• Real-Time Systems & Programming Languages, Burns & Wellings, Pearson
Dr. Hugh Melvin, Dept. of IT, NUI,G 5
Course Outline
• Classification of RTS• Time Synchronisation for RTS• Scheduling for RTS• RT Programming Languages• POSIX.4 RT Extensions• RTOS• Fault Tolerance for RTS• Soft RTS
– Multimedia & Networks
Dr. Hugh Melvin, Dept. of IT, NUI,G 6
RTS
• Definition of RTS?– Difficult due to the extent and scope of RTS– System where a substantial fraction of the
design effort goes into making sure that deadlines are met (Krishna/Shin)
• Classification of RTS?– Hard – Firm – Soft
• Differ by the consequences of missed deadlines
Dr. Hugh Melvin, Dept. of IT, NUI,G 7
Dr. Hugh Melvin, Dept. of IT, NUI,G 8
Hard RTS
Teleperm ME System Overview
VAXMaintenance Management
System
I/O
CPU
I/O
CPU
I/O I/O
CPU CPU
Bin
ary
Fie
ld I
nput
sB
inar
y O
utpu
tsA
nalo
gue
Inpu
tsA
nalo
gue
Out
puts
Bin
ary
Fie
ld I
nput
sB
inar
y O
utpu
tsA
nalo
gue
Inpu
tsA
nalo
gue
Out
puts
Bin
ary
Fie
ld I
nput
sB
inar
y O
utpu
tsA
nalo
gue
Inpu
tsA
nalo
gue
Out
puts
I/O
CPU
AS101 AS133AS112 AS131AS017AS013
Boiler BMSTurbine
I/O
CPU
R30
I/O
CPU
I/O
CPU
I/O
CPU
AS231Unit Alarms System
PG750Maintenance
Computer
OS254OperationsComputer
Turbine Boiler
VDU 1 VDU 1
VDU 2
VDU 3
Operator’sKeyboard
MEC-RTData Storage Unit
Programmers VDU & Keyboard
VDU 2
VDU 3
Operator’sKeyboard
MEC-RTData Storage Unit
Programming Room Printer
Fault Log Printer
Con
trol
Roo
m
Control R
oom
LPA0
LPA1
Local Printer
VDU 1
VDU 2
Operator’sKeyboard
5 1/4”FDDStorage Unit
Alarms Printer
Annunciator
I/O
CPU
Local T
erminals
CPU
I/O
MEC-RTData Storage Unit
VDU 1
VDU 2
VDU S\E’sOffice
VDU Prog. Room
Tape DriveStorage Unit
Operators Keyboard 1
Operators Keyboard 2
S\E’s Keyboard 1
Programmers Keyboard
Annunciator
Printer 1
Printer 2
Printer Prog. Room
CS 275 Bus Bus 0 Bus 1
HW Analog Inputs
HW Binary Inputs
S\E’s VDU & Keyboard
Bus Coupler
12:45:01 23:01:97
Master Clock
Dr. Hugh Melvin, Dept. of IT, NUI,G 9
Remote OperatorStation
Control Room Unit 3 Operator Station
OIS Server IBM NetFinity 5510
Control Room Unit 1 Operator Station
Control Room Unit 2 Operator Station
Station LAN
MP002
GatewayR30 Room Gateway
Communications Room
MP001
Bus ABus B
Bus Coupler
U/I
CS275Bus 0
Synogate Interfaceto CS275
CS275Bus 1
U/I
Bus ABus B
Bus Coupler
U/I
CS275Bus 0
Synogate Interfaceto CS275
CS275Bus 1
U/I
Bus ABus B
Bus Coupler
U/I
CS275Bus 0
Synogate Interfaceto CS275
CS275Bus 1
U/I
Unit 1 Unit 2 Unit 3
Dr. Hugh Melvin, Dept. of IT, NUI,G 10
Burner Management System
CPU 2CPU 1 CPU 3
.. .. ........
2 out of 3
Non-Redundant Control Circuits
Double RedundantSafety Circuits Triple Redundant Safety Circuits
N8 N8
U/I U/I
Bus ABus B
CS275
Dr. Hugh Melvin, Dept. of IT, NUI,G 11
Other Hard RTS
• Fly-by-wire control systems
• Robotics
• Medical Devices
• ABS / Airbag Protection
Dr. Hugh Melvin, Dept. of IT, NUI,G 12
Soft RTS: Multimedia
Dr. Hugh Melvin, Dept. of IT, NUI,G 13
Firm RTS
• Somewhere in the middle ?– Eg. Private IP Network governed by SLA
(Service Level Agreement)• SLA specifies jitter/delay/loss/availability
– 99.999% Availability
• Lack of adherence results in :– Poor customer satisfaction– Penalties imposed on provider
– Consumer Devices• Mobile Phone Technology / Cameras etc…
Dr. Hugh Melvin, Dept. of IT, NUI,G 14
Time Synchronisation for RTS• Particularly critical for RTS
– Synchronising 2v3 systems– Precise data logging for distributed control system
• Clock Terminology– Accuracy , Reliability, Skew, Drift
• Synchronisation Algorithms– Network Time Protocol (NTP)
• Limitations of conventional OS Timing• Timer granularity & Time Services
Dr. Hugh Melvin, Dept. of IT, NUI,G 15
Dr. Hugh Melvin, Dept. of IT, NUI,G 16
RT Programming Languages– Consider the following Fortran Loop statement
DO 100 I=1,5<block of text>
100 Continue
– but the following is also validDO 100 I=1.5<block of text>
100 Continue– Fortran interpreted DO 100 I as a previously
undeclared variable assigned value 1.5 NASA mishap #1
– Ada is most recognised RT Prog. Lang.• Boeing 777 control written in Ada
Dr. Hugh Melvin, Dept. of IT, NUI,G 17
Boeing 777
Dr. Hugh Melvin, Dept. of IT, NUI,G 18
RTOS
Realtime Operating Systems– Windows / Unix / Linux
• Designed for time sharing of resources rather than meeting hard deadlines
• Designed for good average performance not used in Hard RTS typically
– ..but have improved Soft RT functionality
– Hard RTS• Good Average performance is of little use
– At 35000 ft when cabin pressure is lost– When a Power station at full output is suddenly disconnected from the
National Grid
– RTOS : VxWorks, QNX, Lynx, RTLinux
Dr. Hugh Melvin, Dept. of IT, NUI,G 19
Fault Tolerant TechniquesKey Characteristic of Hard RTS1. Full/Partial Fault Tolerance
– Achieved mainly through redundancy
2. Graceful degradation– Eg.1: Citreon CX
• Common hydraulic system for Steering, Brakes and Suspension• Order of failure??
– Eg. 2: Power Plant • Faulty sensor Alarm Overload AS station switch to manual
but holds its state and will still respond to safety events/manual control
3. Failsafe operation• Eg. Power Plant: Steam inlet valves spring loaded to shut on
loss of power
Dr. Hugh Melvin, Dept. of IT, NUI,G 20
Citreon CX
Dr. Hugh Melvin, Dept. of IT, NUI,G 21
Fault Tolerant Techniques
• Redundancy– Hardware Redundancy
• Voting schemes
– Software Redundancy• Eg. Code developed by different teams
– Time Redundancy• Build in time slack or roll back
– Information Redundancy • Error Detection + Correction • Note: TCP-IP based Error Detection via CRC relies on Time
Redundancy for TCP traffic. Not acceptable for UDP based MM traffic
Dr. Hugh Melvin, Dept. of IT, NUI,G 22
Fault Tolerant Techniques: Airbus
• 3 Main Flight Controllers
• 2 Backup Flight Controllers
• Software developed by different teams and on different platforms
• Seamless transfer• ..See video !
Dr. Hugh Melvin, Dept. of IT, NUI,G 23
Fault Tolerant Techniques
CPU 1 CPU 2 CPU 3
2-out-of-3 2-out-of-32-out-of-3
2-out-of-3 2-out-of-3 2-out-of-3
2-ou
t-of
-3
Inputs Outputs
Extension Units
EAVn
ZV1 ZV2 ZV3
ZV1 ZV2 ZV3
DB-In DB-In DB-InDB-Out DB-Out DB-Out
Cen
tral
Uni
tI/
O L
evel
RAMEPROM
1
RAMEPROM
2
RAMEPROM
3
Dr. Hugh Melvin, Dept. of IT, NUI,G 24
Soft RTS: MM and Networks
Real Time Communications– Best Effort Internet default service– Recent QoS Initiatives to differentiate
between traffic streams• Eg. Voice over IP
– Requires M2E delay of < 150 msec– Can tolerate higher delays if echo cancellation used– Can cope with small degree of packet loss
» More Relaxed definition of RTS
• See ITU G.1010
Dr. Hugh Melvin, Dept. of IT, NUI,G 25
Mouth-to-Ear Delays
Dr. Hugh Melvin, Dept. of IT, NUI,G 26
Real Time Communications• LAN based developments
– Switched Networks (Embedded RTOS)• Also Fast/Gigabit Ethernet : Overprovisioning?
– New difficulties for wireless environment • Access Protocols CSMA
• WAN based developments– IntServ– DiffServ – MPLS : Layer 2.5
• Also development of RTP/RTCP/RTSP Protocols for MM traffic
Dr. Hugh Melvin, Dept. of IT, NUI,G 27
Real Time Communications
• Endpoint Issues– Increased complexity in terminals– OS / Driver / Application Software / Hardware
issues • Hardware: Skew Issues = lack of synchronisation
• Other options– Token Based Networks
• Moneypoint Token Bus IEEE 802.4
Dr. Hugh Melvin, Dept. of IT, NUI,G 28
CS 275 Bus: IEEE 802.4
U/IA U/IB U/IA U/IB U/IA U/IB U/IA U/IB U/IA U/IBU/IA U/IB U/IA U/IBU/IA U/IB
101N8
AS220E
102N8
AS220E
103N8
AS220E
104N8
AS220E
105N8
AS220E
106N8
AS220E
107N8
AS220E
108N8
AS220E
U/IA U/IB U/IA U/IB U/IA U/IB U/IA U/IB U/IA U/IBU/IA U/IB
126N-BKBus 0
123N-UHRM-Clock
121N16
OS254
112N8
AS220E
111N8
AS220E
110N8
AS220E
109N8
AS220E
U/IA U/IB U/IA U/IB U/IA U/IB U/IA U/IBU/IA U/IB U/IA U/IB
160NS5NAT
PG750
133N8
AS EHF
132N8
AS EHF
131N8
AS EHF
128N8
AS231
125N16R30
141NAT-24Synogate
U/IA U/IB
127 N-BK Bus 1
Dr. Hugh Melvin, Dept. of IT, NUI,G 29
Dr. Hugh Melvin, Dept. of IT, NUI,G 30
Clock Skew : Buffer Issues
Dr. Hugh Melvin, Dept. of IT, NUI,G 31
Audio-System Clock Skew