Analysable Real-Time Systems Programmed in Ada Alan Burns and Andy Wellings University of York ‘The Fights of Alan Burs and Andy Welling o he enti 3 utes of his work have ton asec to thom ia aordance wth the Copyright Design and Patents Act 198K All ight ate eserve. No prt of dis publication may he repo stored in a revival ‘ye or remit in any form oe by any cums, cletrnic, mechanical, photocopying ‘rowed or atherwse, without rive permsoko of Alan Burns and Andy Welings ‘Materialia the book hasbeen updated and extended from Real-Time Systems and Programming Languages ‘Ada, Rel: Toe av sn Coal Time POSIX, Fourth Faltion, Addison Wesley 208 (©iAlan Burns and Andy Welings, 2016 ISRN-15: 97H 1530065503 ISHN-10- 1530265509) Contents Preface 1 INTRODUCTION 1 Introduction to real-time systems 1.1 Denton of a eal time system 12. xample of realtime systems 13. Characteristics of ream systems 14 Development yet or atime systems Summary 2 Reabtime principles 21 Spovlving timing requirements 22 Temporal scopes 2.3 Specifying temporal scopes and a 24 realtime programming model Summary ‘Reliability and fault tolerance AL Reb, alread fas 32. Failure modes 413. Fauk prevention and ful okrance AA Nsersio programming 415. Sofware dynamic rodundancy 1.6 The recovery lock approach to sware ful wolerance 47 Dynamic redundancy and exceptions 3.8 Fault wolerance andthe real-time programming model 119. Measuring and predicting thereby of oltre 3.10 Safety reliability and dependability ‘Summary xi IL SCHEDULING THEORY FOR REAL-TIME SYSTEMS, 4 Scheduling real-time systems SH Theeyelicexceutve approach 42 Task hse schealing 43 ate monotone pricy asignment 44 Uiiivation hase schedtaiity texts for PS Summary ‘5 Response-Time Analysis for Fixed Priority Scheduling (FPS) 5.1" Independent periodic tasks 5.2. Sporadic and spi tsks 5.3 Tusk ystems with consrained deadlines (D <7) S54 Task imerctons and blcking 35. Privity ceiling protcols Summiry (6 Rarlest Deadline Fest (EDF) Scheduling 61 Uniization base school tet or EDE (62 Uniiation-bo bodily tet or LLP 63, Prec demand rteris for EDF G4 THeQPA La 63" ooking and EDF {66 Deadline Neve prot (67 Apeindie tasks and ED cxceution time server Summary 7 Advanced analysis techniques TAL Release jitse 12 Arbitrary datines 13 Cooperative ncholing 24 Faultokrance 73 Incorporating fics 7.6. Prony asignment 2.7 eaceuton-time serves 78 Scheduling for powee-aware systems 29 _Incnporating spsem overheads Sommary 8 Mixed criticality, multiprocessor and open systems 1 Misc erica systems (MCS) 2 Malipocesse systems 3nd ad ploha placement BE Schodaling the network 5 Mutual exclusion on multiprocessor pla 6 Opensysens 1st i bs 1s 1a 1 my Summary 6 IIL DEVELOPING REAL-TIME SYSTEMS IN ADA 9 9 The Ada programming language 1s 9.1 Languages for programming real-time systems 12 9.2 Anintrodution o Ada 155 9.3 Overview of Ads 136 9.4 Programming inthe lr 0 9.5. Aspocts and atbuts 7 Summary i 10 Concurrent programm 1 Metivation 10.2 Processes and tikatieadh 10.3 Concurrent exceution 10.4 Task representation 10S Concurrent execution in Ada 16 Mtiprocesso and distribute systems 209 107 simple embedded system 213 148 Language-supported vests operating system supported concurency || 219, Summary 20 1 Shared variable-based synchronization and communication ns ‘Mutua exclusion and condition synchronization ae ‘Coordinated stony as Busy waiting nr Suspend and resume a Semaphores a Conon rial regions au Monitor 202 Protected objets ia Ada 2s 1.9 Share memery multiprocessors 200 1.10Simpleembedde! ystems ested 262 Summary os 12 Resource control 267 IZ Resource management 268 122 Expressive power and ease of use 268 12.3 The requeve facility 7 124 Real-time sotions to the resouree contol pablem 2s 125 Resource control and security ans 126 Resource usage ons 127 Deadlock 286 Summary 287 13 Rate faites TR The mon of ime 132 Actens tou chk 133 Detaying tank 15.4 Programming ious Summary 14 Programming real-time abstractions LT Reabtime tasks 14.2 Programming perioc activites 14.3 Programming aperidic and spac ati 11.4 The leo wal time ovens and thi andlor 145 Controle np nd output jer 1146 The Ravens profi 11.7 Simple embod system eve Summary Programming schedulable systems 151 Programming cy executives 152 Programming precmpsive pron basd ys 15. Ads and ted pronty schatling 15.4 Dynamic prirtics andor Ada fii 1555 Programming EDF systems 156 Mined schooling 5.7. Schedling andthe Ravenscar pois 15 Simple embod sem revised Summary 16 Low-level programming 1.1 Marware inpuvutput mechanisms 162 Language equirements 163 Programming devices in Ada 16 Scheduling device drivers 165 Memory managerent Summary 17 Exceptions and exception handling 17.1 Exception handling in older ret. ime languages 172. Modern exception hang 17.3 txcopion handling in Ads 17 Recovery Blocks und excspions ime impt of exceptin hing 1 Atomic actions, concurrent processes and reliability WR Atom ae 12. Atomic a 18. Recovorale atomic setons 183. Asynchronous notation in Ada 186 Atomic actions and scheling analysis Summary 19 olerating timing fats 191 Dynamic redundancy and ining fauls 19.2 Deadline miss detection 193 Over of worst-case exscuton time 19.4 Overan of sporadic events 19.5 Overrun of source usage 19.6 Damage coninement 19.7 Error asconery Summary IV CONCLUSIONS 20 Mine control case study 20.1 Mine drainage 202 The HREHOOD design method 203 ‘The lpia architecture design 2044 ‘The pyscal archicture design 205 Translation to Ada 206 Fault wolrance and distribution Summary 21 Comctsions 21.1 Future challenges References Index 493 oF 497 503 List of Programs 10 Theada 102 The aga 103 The sys os The sy: ‘Theaaa, Theaaa, 1A Theaaa, 132 Theaga Mt Theags, 151 The ads. 132 The Aaa, 153 The Aas. 161 The ads. 162 The Ads. 163 The syst 17 The sta 172 Treads, -Taak_Ident fication package ‘ak_Terminat ion package em. Multiprocessors package com: Mult sprocessor Dispatching. Domains package ‘synchronous Task_Cont col packape. Synchronous Barriers package Calendar package RealTime package Real_Time. Timing, pons package Dynamic. Priceit ses package Asynchronous Task Control package Dispatching. BOF package, Interrupts package Trnverrupt Names package en. storage Pools package nda pace. ‘Except cone pacakge 19. Am abvidged version ofthe Ada. Execut Lon_Time package. 192 Tease 193 Theda 194 The Asa 195 The Asa TExecut Lon_time. Timers package Execution Time.interrupt package "execut Lon_time package's support for imtrrps ‘Eyecut ion_Time.Group_Buagets package