Real-Time scheduling under uncertainty : challenges and solutions G. Lipari EDIS 2017, 17-18 December 2017 1 RIStAL Centre de Recherche en Informatique, Signal et Automatique de Lille
Outline 1 Plan of the talk 2 Introduction to Real-Time Systems 3 Temporal isolation 4 Multicore systems 5 Conclusions 2
1 Plan of the talk 2 Introduction to Real-Time Systems 3 Temporal isolation 4 Multicore systems 5 Conclusions 3
Summary of the talk 1 General introduction to real-time scheduling Real-time systems Scheduling and scheduling analysis 2 Worst-case execution time How to compute WCET sources of variability Modern multi-core processors 3 Temporal isolation Soft and hard real-time tasks How to isolate tasks A real-time scheduler in Linux 4 Multicore Systems Additional variability how to isolate on multicore 4
1 Plan of the talk 2 Introduction to Real-Time Systems 3 Temporal isolation 4 Multicore systems 5 Conclusions 5
What is an embedded cyber-physical system ? From “Wikipedia” : An embedded system is a special-purpose computer system designed to perform one or a few dedicated functions, sometimes with real-time computing constraints . It is usually embedded as part of a complete device including hardware and mechanical parts. Interaction with physical process 6 sensors, actuators → timing constraints (latency, jitters)
What is a real-time system ? In real-time systems, the correct behaviour of a system depends, not only on the values of results that are produced, but also on the time at which they are produced. John Stankovic. Misconceptions about real-time computing . IEEE Computer, October 1988 Predictable system : we want to know a-priori if the system will respect its timing constraints Real-time systems are predictable (and not necessarily fast) 7
Examples Modern cars : ABS, Power Train, Intelligent braking system, etc. 8
Real-time Software Set of concurrent real-time tasks simple periodic structure void * PeriodicTask( void *arg) { <initialization>; <start periodic timer, period = T>; while (cond) { <read sensors>; <update outputs>; <update state variables>; <wait next activation>; } } 9
Graphical representation charts Example : two periodic control tasks 10 Task 1 : controls gas injection in engine, period 6 msec Tasks’ execution is graphically represented with GANNT Task 2 : controls cooling system, period 10 msec τ 1 τ 2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Graphical representation charts Example : two periodic control tasks 10 Task 1 : controls gas injection in engine, period 6 msec Tasks’ execution is graphically represented with GANNT Task 2 : controls cooling system, period 10 msec τ 1 τ 2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Graphical representation charts Example : two periodic control tasks 10 Task 1 : controls gas injection in engine, period 6 msec Tasks’ execution is graphically represented with GANNT Task 2 : controls cooling system, period 10 msec τ 1 τ 2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Graphical representation charts Example : two periodic control tasks 10 Task 1 : controls gas injection in engine, period 6 msec Tasks’ execution is graphically represented with GANNT Task 2 : controls cooling system, period 10 msec τ 1 τ 2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Graphical representation charts Example : two periodic control tasks 10 Task 1 : controls gas injection in engine, period 6 msec Tasks’ execution is graphically represented with GANNT Task 2 : controls cooling system, period 10 msec τ 1 τ 2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Graphical representation charts Example : two periodic control tasks 10 Task 1 : controls gas injection in engine, period 6 msec Tasks’ execution is graphically represented with GANNT Task 2 : controls cooling system, period 10 msec τ 1 τ 2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Graphical representation charts Example : two periodic control tasks 10 Task 1 : controls gas injection in engine, period 6 msec Tasks’ execution is graphically represented with GANNT Task 2 : controls cooling system, period 10 msec τ 1 τ 2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Graphical representation charts Example : two periodic control tasks 10 Task 1 : controls gas injection in engine, period 6 msec Tasks’ execution is graphically represented with GANNT Task 2 : controls cooling system, period 10 msec τ 1 τ 2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Graphical representation charts Example : two periodic control tasks 10 Task 1 : controls gas injection in engine, period 6 msec Tasks’ execution is graphically represented with GANNT Task 2 : controls cooling system, period 10 msec τ 1 τ 2 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30
Hard vs. Soft A task is said hard real-time if all its deadlines must be we have to guarantee a-priori (before the system runs) that all deadlines will be respected under all possible conditions ; In a soft real-time task, nothing catastrophic happens if a deadline is missed ; Some deadline can be missed with little or no consequences on the correctness of the system ; However, the number of missed deadline must be kept under control, because the quality of the results depend upon on the number of deadline missed ; 11 respected, otherwise a critical failure occurs in the system
Scheduling Fixed priority scheduling : Orders all active tasks according to their priority the active task with the highest priority is scheduled. priorities are integer numbers : the higher the number, the higher the priority ; Scheduling analysis Given a set of concurrent tasks with their priorities, check if all task will meet their deadlines 12 every task τ i is assigned a fjxed priority p i ;
Scheduling analysis Given a task set, how can we guarantee if it is schedulable of not ? The fjrst possibility is to simulate the system to check that no deadline is missed ; For periodic tasks, simulate until the hyperperiod (least common multiple of all periods) Exercise Compare the hyperperiod of these two task sets : 13 T 1 = 8, T 2 = 12, T 3 = 24 T 1 = 7, T 2 = 12, T 3 = 25
Scheduling analysis Given a task set, how can we guarantee if it is schedulable of not ? The fjrst possibility is to simulate the system to check that no deadline is missed ; For periodic tasks, simulate until the hyperperiod (least common multiple of all periods) Exercise Compare the hyperperiod of these two task sets : 13 T 1 = 8, T 2 = 12, T 3 = 24 ⇒ H = 24 T 1 = 7, T 2 = 12, T 3 = 25
Scheduling analysis Given a task set, how can we guarantee if it is schedulable of not ? The fjrst possibility is to simulate the system to check that no deadline is missed ; For periodic tasks, simulate until the hyperperiod (least common multiple of all periods) Exercise Compare the hyperperiod of these two task sets : 13 T 1 = 8, T 2 = 12, T 3 = 24 ⇒ H = 24 T 1 = 7, T 2 = 12, T 3 = 25 ⇒ H = 2100
Execution time and load Every task is characterized by a Worst-Case Execution it is the largest execution time experienced by the task Each task is characterised by a period T i T i it is the fraction of the processor that is needed by the task Example (Utilisation) Total utilisation : the sum of the utilisations of all tasks An easier test if the total utilization is less than or equal to the utilization least upper bound , then it is schedulable 14 Time C i The utilisation of a task is computed as C i A task with execution time C i = 4 msec and period T i = 10 msec, has an utilisation of U i = 0 . 4 → 40 % .
Execution time and load Every task is characterized by a Worst-Case Execution it is the largest execution time experienced by the task Each task is characterised by a period T i T i it is the fraction of the processor that is needed by the task Example (Utilisation) Total utilisation : the sum of the utilisations of all tasks An easier test if the total utilization is less than or equal to the utilization least upper bound , then it is schedulable 14 Time C i The utilisation of a task is computed as C i A task with execution time C i = 4 msec and period T i = 10 msec, has an utilisation of U i = 0 . 4 → 40 % .
Utilization bound for RM 8 … 11 0.734 6 0.717 10 0.743 5 0.720 9 0.756 4 0.724 0.779 Theorem (Liu and Layland, 1973) 3 0.728 7 0.828 2 U lub n U lub n Then, to periods, whose priorities are assigned in Rate Monotonic order. Consider n periodic (or sporadic) tasks with relative deadline equal 15 U lub = n ( 2 1 / n − 1 )
Earliest Deadline First An important class of scheduling algorithms is the class of dynamic priority algorithms the priority of a task can change during its execution The most important (and analyzed) dynamic priority algorithm is Earliest Deadline First (EDF) The priority of a job is inversely proportional to its absolute deadline ; the highest priority job is the one with the earliest deadline ; If two tasks have the same absolute deadlines, chose one of the two at random ( ties can be broken arbitrarily ) 16
Recommend
More recommend