Real-Time scheduling under uncertainty: challenges and solutions - - PowerPoint PPT Presentation

real time scheduling under uncertainty challenges and
SMART_READER_LITE
LIVE PREVIEW

Real-Time scheduling under uncertainty: challenges and solutions - - PowerPoint PPT Presentation

Real-Time scheduling under uncertainty: challenges and solutions Giuseppe Lipari CRIStAL meraude May 17, 2016 Giuseppe Lipari (CRIStAL meraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 1 / 50


slide-1
SLIDE 1

Real-Time scheduling under uncertainty: challenges and solutions

Giuseppe Lipari

CRIStAL – Émeraude

May 17, 2016

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 1 / 50

slide-2
SLIDE 2

Outline

1

Introduction to RT Systemes

2

Unpredictability

3

Resource Reservations

4

Multicore systems

5

Soft real-time and control systems

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 2 / 50

slide-3
SLIDE 3

Outline

1

Introduction to RT Systemes

2

Unpredictability

3

Resource Reservations

4

Multicore systems

5

Soft real-time and control systems

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 3 / 50

slide-4
SLIDE 4

Real-Time Systems

Most real-time systems are concurrent

need to handle many events with different temporal characteristics

Periodic events

In control systems, periodic sampling, computation of the control algorithm, actuation Different events may have different periods

Aperiodic events

May be triggered by the external environment Examples: a sensor triggers an interrupt, a packet arrives from the network

Different events are handled by different tasks that run concurrently Constraints: each task instance must complete before a certain instant (deadline) Scheduling problem: how to interleave tasks executions so that each task instance meets its deadline

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 4 / 50

slide-5
SLIDE 5

Task model

A periodic task τi = (Ci, Di, Ti) consists of a (infinite) sequence of jobs Ji,k = {ai,k, ci,k, di,k} k = 0, 1, 2, . . ., with: ai,0 = 0 ∀k > 0 ai,k = ai,k−1 + Ti ∀k ≥ 0 di,k = ai,k + Di Ci = max{k ≥ 0|ci,k} Pseudo-code for a periodic task:

void * PeriodicTask(void *arg) { <initialization>; <start periodic timer, period = T>; while (cond) { <read sensors>; <update outputs>; <update state variables>; <wait next activation>; } }

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 5 / 50

slide-6
SLIDE 6

Example of schedule

Every task τi is assigned a fixed priority pi; the active task with the highest priority is executed on the processor

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 6 / 50

slide-7
SLIDE 7

Scheduling analysis

Theorem (Liu and Layland, 1973)

Consider n periodic (or sporadic) tasks with relative deadline equal to periods, whose priorities are assigned in Rate Monotonic order. Then, U =

N

  • i=1

Ci Ti ≤ Ulub = n(21/n − 1) Ulub is a decreasing function of n; For large n: Ulub → 0.69

n Ulub n Ulub 2 0.828 7 0.728 3 0.779 8 0.724 4 0.756 9 0.720 5 0.743 10 0.717 6 0.734 11 . . .

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 7 / 50

slide-8
SLIDE 8

Dynamic priority

The most important (and analysed) dynamic priority algorithm is Earliest Deadline First (EDF)

The priority of a job (instance) is inversely proportional to its absolute deadline;

Example with U = 23

24

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 8 / 50

slide-9
SLIDE 9

Scheduling analysis

Theorem (Optimality, Dertouzos ’73)

If a set of jobs J is schedulable by an algorithm A, then it is schedulable by EDF.

Theorem (Liu & Layland ’71)

Given a task set of periodic or sporadic tasks, with relative deadlines equal to periods, the task set is schedulable by EDF if and only if U =

N

  • i=1

Ci Ti ≤ 1

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 9 / 50

slide-10
SLIDE 10

Domino effect

In case of overhead (U > 1), in EDF we have the domino effect: it means that all tasks miss their deadlines. An example of domino effect is the following:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 10 / 50

slide-11
SLIDE 11

Domino effect

In case of overhead (U > 1), in EDF we have the domino effect: it means that all tasks miss their deadlines. An example of domino effect is the following:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 10 / 50

slide-12
SLIDE 12

Domino effect

In case of overhead (U > 1), in EDF we have the domino effect: it means that all tasks miss their deadlines. An example of domino effect is the following:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 10 / 50

slide-13
SLIDE 13

Domino effect

In case of overhead (U > 1), in EDF we have the domino effect: it means that all tasks miss their deadlines. An example of domino effect is the following:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 10 / 50

slide-14
SLIDE 14

Domino effect

In case of overhead (U > 1), in EDF we have the domino effect: it means that all tasks miss their deadlines. An example of domino effect is the following:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 10 / 50

slide-15
SLIDE 15

Domino effect

In case of overhead (U > 1), in EDF we have the domino effect: it means that all tasks miss their deadlines. An example of domino effect is the following:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 10 / 50

slide-16
SLIDE 16

Domino effect

In case of overhead (U > 1), in EDF we have the domino effect: it means that all tasks miss their deadlines. An example of domino effect is the following:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 10 / 50

slide-17
SLIDE 17

Domino effect

In case of overhead (U > 1), in EDF we have the domino effect: it means that all tasks miss their deadlines. An example of domino effect is the following:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 10 / 50

slide-18
SLIDE 18

Domino effect

In case of overhead (U > 1), in EDF we have the domino effect: it means that all tasks miss their deadlines. An example of domino effect is the following:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 10 / 50

slide-19
SLIDE 19

Domino effect

In case of overhead (U > 1), in EDF we have the domino effect: it means that all tasks miss their deadlines. An example of domino effect is the following:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 10 / 50

slide-20
SLIDE 20

Domino effect

In case of overhead (U > 1), in EDF we have the domino effect: it means that all tasks miss their deadlines. An example of domino effect is the following:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 10 / 50

slide-21
SLIDE 21

Domino effect

In case of overhead (U > 1), in EDF we have the domino effect: it means that all tasks miss their deadlines. An example of domino effect is the following:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 10 / 50

slide-22
SLIDE 22

Domino effect and fixed priority

FP is more predictable: only lower priority tasks miss their deadlines! In the previous example, if we use FP:

2 4 6 8 10 12 14 16 18 20 22 24

τ1 τ2 τ3 τ4

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 11 / 50

slide-23
SLIDE 23

Outline

1

Introduction to RT Systemes

2

Unpredictability

3

Resource Reservations

4

Multicore systems

5

Soft real-time and control systems

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 12 / 50

slide-24
SLIDE 24

Execution time and schedulability

The analysis depends on the worst-case execution time Ci of each task As we have seen in the previous slides, a wrong estimate may lead to a deadline miss How to compute the WCET of tasks ?

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 13 / 50

slide-25
SLIDE 25

WCET estimation

Execution time of a task varies with

The input The state of the system The processor architecture Interference from other threads

How to compute

By timing analysis (by using appropriate tools) we can obtain a (safe) upper bound, but sometimes too pessimistic By testing we can only obtain an unsafe lower bound

Problem

A wrong estimate may lead to a wrong analysis

Courtesy of Peter Puschner Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 14 / 50

slide-26
SLIDE 26

Execution time variability: example

Tasks can have variable execution times between different jobs

while (cond) { if (a > 10) { // long computation } else { // short computation } a = getInput(); }

We have two sources of variability:

the value of variable a influences which computation is performed (long

  • r short);

the value of cond influences the number of times the loop body is executed.

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 15 / 50

slide-27
SLIDE 27

Impact of processor architecture

With recent processor architectures, the difference between BCET and WCET became larger and larger

Figure : Courtesy of AbsInt

Impact of cache and shared resources Situation even worse on multi-core systems

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 16 / 50

slide-28
SLIDE 28

Example

Which one of these two loops is faster?

int steps = 256 * 1024 * 1024; int[] a = new int[2]; // Loop 1 for (int i=0; i<steps; i++) { a[0]++; a[0]++; } // Loop 2 for (int i=0; i<steps; i++) { a[0]++; a[1]++; }

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 17 / 50

slide-29
SLIDE 29

Example

Which one of these two loops is faster?

int steps = 256 * 1024 * 1024; int[] a = new int[2]; // Loop 1 for (int i=0; i<steps; i++) { a[0]++; a[0]++; } // Loop 2 for (int i=0; i<steps; i++) { a[0]++; a[1]++; }

Pipeline for the first loop: Pipeline for the second loop:

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 17 / 50

slide-30
SLIDE 30

Impact of interference

WCET Analysis

it is difficult to estimate a tight upper bound of WCET when the task executes in isolation

Preemption:

preempting tasks could evict cache lines next time the task executes the data is not in the cache anymore

while (i < 10) { data = getInput(); // ... // possible preemption function(data); // is data in cache ? }

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 18 / 50

slide-31
SLIDE 31

Impact of interference

WCET Analysis

it is difficult to estimate a tight upper bound of WCET when the task executes in isolation

Preemption:

preempting tasks could evict cache lines next time the task executes the data is not in the cache anymore

while (i < 10) { data = getInput(); // ... // possible preemption function(data); // is data in cache ? }

Some (partial) solution is available

avoid (or limit) preemption → additional blocking time for higher priority tasks lock cache to some task try to minimise cache conflicts by properly placing tasks in memory

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 18 / 50

slide-32
SLIDE 32

Multicore systems

In multicore systems

a task running on another core could evict cache lines from a common cache need to coordinate task execution to minimize cache eviction while a task is executing

Conflicts on shared bus:

different cores may need to access memory at the same time, further delaying memory access instructions

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 19 / 50

slide-33
SLIDE 33

Summary of the problem

WCET estimation

can only provide an estimation of the upper bound

  • ften much superior to the true WCET

suffer from interference of other tasks on shared resources very complex problem

Schedulability analysis:

it considers the computation time of each instance of the task as constantly equal to the WCET Even if the execution time sometimes exceeds the estimated WCET, this does not automatically imply a deadline miss Very pessimistic Additionally, deadline miss can happen to any task (no isolation)

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 20 / 50

slide-34
SLIDE 34

Outline

1

Introduction to RT Systemes

2

Unpredictability

3

Resource Reservations

4

Multicore systems

5

Soft real-time and control systems

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 21 / 50

slide-35
SLIDE 35

Single cores

Resource Reservation is a technique to provide temporal isolation to tasks

we assign a execution budget to each task job executes less than the budget → OK job does not complete before within the budget → EXCEPTION

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 22 / 50

slide-36
SLIDE 36

Single cores

Resource Reservation is a technique to provide temporal isolation to tasks

we assign a execution budget to each task job executes less than the budget → OK job does not complete before within the budget → EXCEPTION

In case of exception we can

abort (skip) the instance execute the instance in background (with minimum priority) suspend the instance until sometime in the future (when the budget is recharged)

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 22 / 50

slide-37
SLIDE 37

Single cores

Resource Reservation is a technique to provide temporal isolation to tasks

we assign a execution budget to each task job executes less than the budget → OK job does not complete before within the budget → EXCEPTION

In case of exception we can

abort (skip) the instance execute the instance in background (with minimum priority) suspend the instance until sometime in the future (when the budget is recharged)

Temporal isolation property

the ability of a task to meet its deadline only depends on the value of the budget and of the execution time

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 22 / 50

slide-38
SLIDE 38

Notable algorithms

For Fixed Priority

Polling Server (the simplest one) Sporadic Server (available in the POSIX Standard)

For EDF

Constant Bandwidth Server (available on Linux starting from version 3.16)

Many RTOS implement some modified version of the Sporadic Server

e.g. QNX, VxWorks, etc.

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 23 / 50

slide-39
SLIDE 39

Example - I

Consider τ1 = (1, 4), τ2 = (2, 5), τ3 = (2, 6) U = 0, 983 < 1 ⇒ schedulable

2 4 6 8 10 12 14 16 18 20

τ1 τ2 τ3

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 24 / 50

slide-40
SLIDE 40

Example - II

Consider τ1 = (1, 4), τ2 = (2, 5), τ3 = (2, 6) What happens if τ1 executes for 2 for the first 3 instances ?

2 4 6 8 10 12 14 16 18 20

τ1 τ2 τ3 τ2 and τ3 miss their deadlines They could be critical tasks, we need to protect them

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 25 / 50

slide-41
SLIDE 41

Example III

Consider τ1 = (1, 4), τ2 = (2, 5), τ3 = (2, 6) Assign τ1 a server S1 = (1, 4) (budget = 1)

2 4 6 8 10 12 14 16 18 20

τ1 τ2 τ3 τ2 and τ3 are not influenced

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 26 / 50

slide-42
SLIDE 42

Example III

Consider τ1 = (1, 4), τ2 = (2, 5), τ3 = (2, 6) Assign τ1 a server S1 = (1, 4) (budget = 1)

2 4 6 8 10 12 14 16 18 20

τ1 τ2 τ3 τ2 and τ3 are not influenced

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 26 / 50

slide-43
SLIDE 43

Example III

Consider τ1 = (1, 4), τ2 = (2, 5), τ3 = (2, 6) Assign τ1 a server S1 = (1, 4) (budget = 1)

2 4 6 8 10 12 14 16 18 20

τ1 τ2 τ3 τ2 and τ3 are not influenced

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 26 / 50

slide-44
SLIDE 44

Example III

Consider τ1 = (1, 4), τ2 = (2, 5), τ3 = (2, 6) Assign τ1 a server S1 = (1, 4) (budget = 1)

2 4 6 8 10 12 14 16 18 20

τ1 τ2 τ3 τ2 and τ3 are not influenced

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 26 / 50

slide-45
SLIDE 45

Example III

Consider τ1 = (1, 4), τ2 = (2, 5), τ3 = (2, 6) Assign τ1 a server S1 = (1, 4) (budget = 1)

2 4 6 8 10 12 14 16 18 20

τ1 τ2 τ3 τ2 and τ3 are not influenced

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 26 / 50

slide-46
SLIDE 46

Example III

Consider τ1 = (1, 4), τ2 = (2, 5), τ3 = (2, 6) Assign τ1 a server S1 = (1, 4) (budget = 1)

2 4 6 8 10 12 14 16 18 20

τ1 τ2 τ3 τ2 and τ3 are not influenced

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 26 / 50

slide-47
SLIDE 47

Example III

Consider τ1 = (1, 4), τ2 = (2, 5), τ3 = (2, 6) Assign τ1 a server S1 = (1, 4) (budget = 1)

2 4 6 8 10 12 14 16 18 20

τ1 τ2 τ3 τ2 and τ3 are not influenced

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 26 / 50

slide-48
SLIDE 48

CBS algorithm

Two dynamic variables

q: remaining budget (init to Q, decreases while executing) d: scheduling deadline

Idle Idle Active Ahead

q = Q , d = t + P if q < (d − t)Q/P i f q ≥ ( d − t ) Q / P when q = (d − t)Q/P

Q = 4, P = 12

2 4 6 8 10 12 14 16

τ1

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 27 / 50

slide-49
SLIDE 49

CBS algorithm

Two dynamic variables

q: remaining budget (init to Q, decreases while executing) d: scheduling deadline

Idle Active Active Ahead

q = Q , d = t + P q = Q , d = t + P if q < (d − t)Q/P if q ≥ (d − t)Q/P when q = (d − t)Q/P

Q = 4, P = 12

2 4 6 8 10 12 14 16

τ1 t = 0: q ← 4, d ← 12

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 27 / 50

slide-50
SLIDE 50

CBS algorithm

Two dynamic variables

q: remaining budget (init to Q, decreases while executing) d: scheduling deadline

Idle Active Active Ahead

q = Q , d = t + P if q < (d − t)Q/P if q ≥ (d − t)Q/P when q = (d − t)Q/P

Q = 4, P = 12

2 4 6 8 10 12 14 16

τ1 t = 0: q ← 4, d ← 12 t = 4: q ← 2

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 27 / 50

slide-51
SLIDE 51

CBS algorithm

Two dynamic variables

q: remaining budget (init to Q, decreases while executing) d: scheduling deadline

Idle Active Ahead Ahead

q = Q, d = t + P if q < (d − t)Q/P if q < (d − t)Q/P i f q ≥ ( d − t ) Q / P when q = (d − t)Q/P

Q = 4, P = 12

2 4 6 8 10 12 14 16

τ1 t = 0: q ← 4, d ← 12 t = 4: q ← 2 t = 7: q ← 1

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 27 / 50

slide-52
SLIDE 52

CBS algorithm

Two dynamic variables

q: remaining budget (init to Q, decreases while executing) d: scheduling deadline

Idle Idle Active Ahead

q = Q , d = t + P if q < (d − t)Q/P i f q ≥ ( d − t ) Q / P when q = (d − t)Q/P when q = (d − t)Q/P

Q = 4, P = 12

2 4 6 8 10 12 14 16

τ1 t = 0: q ← 4, d ← 12 t = 4: q ← 2 t = 7: q ← 1 t = 9: zero lag time

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 27 / 50

slide-53
SLIDE 53

CBS algorithm: early arrival

Idle Idle Active Ahead

q = Q , d = t + P if q < (d − t)Q/P i f q ≥ ( d − t ) Q / P when q = (d − t)Q/P

Q = 4, P = 12

2 4 6 8 10 12 14 16

τ1

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 28 / 50

slide-54
SLIDE 54

CBS algorithm: early arrival

Idle Active Active Ahead

q = Q , d = t + P q = Q , d = t + P if q < (d − t)Q/P if q ≥ (d − t)Q/P when q = (d − t)Q/P

Q = 4, P = 12

2 4 6 8 10 12 14 16

τ1 t = 0: q ← 4, d ← 12

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 28 / 50

slide-55
SLIDE 55

CBS algorithm: early arrival

Idle Active Active Ahead

q = Q , d = t + P if q < (d − t)Q/P if q ≥ (d − t)Q/P when q = (d − t)Q/P

Q = 4, P = 12

2 4 6 8 10 12 14 16

τ1 t = 0: q ← 4, d ← 12 t = 2: q ← 2

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 28 / 50

slide-56
SLIDE 56

CBS algorithm: early arrival

Idle Active Ahead Ahead

q = Q, d = t + P if q < (d − t)Q/P if q < (d − t)Q/P i f q ≥ ( d − t ) Q / P when q = (d − t)Q/P

Q = 4, P = 12

2 4 6 8 10 12 14 16

τ1 t = 0: q ← 4, d ← 12 t = 2: q ← 2 t = 5: q ← 1

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 28 / 50

slide-57
SLIDE 57

CBS algorithm: early arrival

Idle Active Active Ahead

q = Q , d = t + P if q < (d − t)Q/P if q ≥ (d − t)Q/P when q = (d − t)Q/P

Q = 4, P = 12

2 4 6 8 10 12 14 16

τ1 t = 0: q ← 4, d ← 12 t = 2: q ← 2 t = 5: q ← 1 t = 8 < 9: reuse the same q = 1 and d = 12

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 28 / 50

slide-58
SLIDE 58

CBS algorithm: early arrival

Idle Active Active Ahead

q = Q , d = t + P if q < (d − t)Q/P if q ≥ (d − t)Q/P when q = (d − t)Q/P

Q = 4, P = 12

2 4 6 8 10 12 14 16

τ1 t = 0: q ← 4, d ← 12 t = 2: q ← 2 t = 5: q ← 1 t = 8 < 9: reuse the same q = 1 and d = 12 t = 9: q = 0, so q ← 4 and d ← 24

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 28 / 50

slide-59
SLIDE 59

Analysis

Setting the budget

the Hard Schedulability Property tells us that, to meet all deadlines, Qi ≥ Ci and Pi ≤ Ti If we allow some deadline to be missed, we can set the budget between the average value and the worst case value of the execution time We need some sort of probabilistic characterization of the execution time

Probability of deadline miss

For a periodic task, given the stochastic process of the execution time, the probability of missing a deadline can be computed under different conditions

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 29 / 50

slide-60
SLIDE 60

Probability of finishing time

When the budget is exhausted, the CBS will postpone the deadline by Pi

If the exceeding job is allowed to continue its execution, it will consume budget of future instances Future instance may also miss their deadlines

Markov chain model [Abeni and Buttazzo, 1999]

if the execution time is a IID stochastic variable, we can build a Markov Chain to compute the probability of finishing within Pi, 2Pi, . . . , kPi, . . .

Refinement [Palopoli, Fontanelli, Abeni, Villalba Frias, 2015]

Efficient numerical methods Closed form solution

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 30 / 50

slide-61
SLIDE 61

Hierarchical systems

Similar techniques are used for timing partition of applications (group

  • f tasks)

T3 T4 T5 T7 T6 Global Scheduler Server S1 Server S2 Server S3 Local Scheduler

RM

Local Scheduler

POSIX

T2 T1 Local Scheduler

EDF

Application A2 Application A3 Application A1

Used mainly in IMA (Integrated Modular Avionics – ARINC 653)

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 31 / 50

slide-62
SLIDE 62

Hierarchical scheduling

Two levels of scheduling

A global scheduler selects the components to execute, regardless of their internal structure When a component is selected by the global scheduler, a local scheduler decides which of the tasks is executing

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 32 / 50

slide-63
SLIDE 63

Hierarchical scheduling

Two levels of scheduling

A global scheduler selects the components to execute, regardless of their internal structure When a component is selected by the global scheduler, a local scheduler decides which of the tasks is executing

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 32 / 50

slide-64
SLIDE 64

Hierarchical scheduling - example

2 4 6 8 10 12 14 16 18 20 22 24 26

A(2,4) B(3,6) τ A

1 (2, 8)

τ A

2 (2, 12)

τ B

1 (2, 9)

τ B

2 (3, 16) Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 33 / 50

slide-65
SLIDE 65

Hierarchical scheduling - example

2 4 6 8 10 12 14 16 18 20 22 24 26

A(2,4) B(3,6) τ A

1 (2, 8)

τ A

2 (2, 12)

τ B

1 (2, 9)

τ B

2 (3, 16) Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 33 / 50

slide-66
SLIDE 66

Hierarchical scheduling - example

2 4 6 8 10 12 14 16 18 20 22 24 26

A(2,4) B(3,6) τ A

1 (2, 8)

τ A

2 (2, 12)

τ B

1 (2, 9)

τ B

2 (3, 16) Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 33 / 50

slide-67
SLIDE 67

Hierarchical scheduling - example

2 4 6 8 10 12 14 16 18 20 22 24 26

A(2,4) B(3,6) τ A

1 (2, 8)

τ A

2 (2, 12)

τ B

1 (2, 9)

τ B

2 (3, 16) Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 33 / 50

slide-68
SLIDE 68

Hierarchical scheduling - example

2 4 6 8 10 12 14 16 18 20 22 24 26

A(2,4) B(3,6) τ A

1 (2, 8)

τ A

2 (2, 12)

τ B

1 (2, 9)

τ B

2 (3, 16) Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 33 / 50

slide-69
SLIDE 69

Hierarchical scheduling - example

2 4 6 8 10 12 14 16 18 20 22 24 26

A(2,4) B(3,6) τ A

1 (2, 8)

τ A

2 (2, 12)

τ B

1 (2, 9)

τ B

2 (3, 16) Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 33 / 50

slide-70
SLIDE 70

Hierarchical scheduling - example

2 4 6 8 10 12 14 16 18 20 22 24 26

A(2,4) B(3,6) τ A

1 (2, 8)

τ A

2 (2, 12)

τ B

1 (2, 9)

τ B

2 (3, 16) Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 33 / 50

slide-71
SLIDE 71

Hierarchical scheduling - example

2 4 6 8 10 12 14 16 18 20 22 24 26

A(2,4) B(3,6) τ A

1 (2, 8)

τ A

2 (2, 12)

τ B

1 (2, 9)

τ B

2 (3, 16) Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 33 / 50

slide-72
SLIDE 72

Hierarchical scheduling - example

2 4 6 8 10 12 14 16 18 20 22 24 26

A(2,4) B(3,6) τ A

1 (2, 8)

τ A

2 (2, 12)

τ B

1 (2, 9)

τ B

2 (3, 16) Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 33 / 50

slide-73
SLIDE 73

Hierarchical scheduling - example

2 4 6 8 10 12 14 16 18 20 22 24 26

A(2,4) B(3,6) τ A

1 (2, 8)

τ A

2 (2, 12)

τ B

1 (2, 9)

τ B

2 (3, 16) Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 33 / 50

slide-74
SLIDE 74

Hierarchical scheduling - example

2 4 6 8 10 12 14 16 18 20 22 24 26

A(2,4) B(3,6) τ A

1 (2, 8)

τ A

2 (2, 12)

τ B

1 (2, 9)

τ B

2 (3, 16) Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 33 / 50

slide-75
SLIDE 75

Hierarchical scheduling - example

2 4 6 8 10 12 14 16 18 20 22 24 26

A(2,4) B(3,6) τ A

1 (2, 8)

τ A

2 (2, 12)

τ B

1 (2, 9)

τ B

2 (3, 16) Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 33 / 50

slide-76
SLIDE 76

Outline

1

Introduction to RT Systemes

2

Unpredictability

3

Resource Reservations

4

Multicore systems

5

Soft real-time and control systems

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 34 / 50

slide-77
SLIDE 77

Typical multicore platform

Automotive systems are now turning to multicore Freescale Qorivva 32-bit MCU

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 35 / 50

slide-78
SLIDE 78

Isolation

One of the main drivers of multi-core technology

possibility to integrate different applications in the same ECU thus reducing the number of ECUs and the lenght of the network cables

It is important to isolate one application from another

Applications can have different level of criticalities But they share the same memory, bus, etc. They are developed by different companies / teams

Isolation:

Memory protection via MMU Time Triggered Access to bus Separate caches, cache colouring or cache locking

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 36 / 50

slide-79
SLIDE 79

Single core equivalence

It uses a technique called MemGuard for sharing the bus

it’s the equivalent of resource reservation for memory Can be implemented in software on all architectures At the OS level: the task is blocked after a certain number of cache misses [Pellizzoni, Caccamo] @ University of Illinois at Urbana Champaign

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 37 / 50

slide-80
SLIDE 80

Fault tolerance

One requirement of safety critical software is tolerance to faults Technology scaling sensitizes electronic devices to external disturbs

Soft errors: lower energy particles (such as alpha particles) cause temporary bit-flipping in memory and logic circuits

Two ways to implement fault-tolerance

hardware replication (spatial redundancy) software replication (temporal redundancy)

We focus on lock-step (hardware replication)

each involved processor executes the same code at the same time (i.e., step by step), every result is compared, instantly revealing differences in operands or result of each single instruction To simplify the circuitry one idea is to reduce the comparison points, for example considering only I/O operations

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 38 / 50

slide-81
SLIDE 81

Fault-silent and fault-tolerance

Fault-silent system

faults are detected but not corrected can be implemented using 2 cores

Fault-tolerant system

faults are completely masked and corrected needs at least 2 cores and a voting mechanism

Problem:

fault-silent: the available computational power is reduced by half fault-tolerant: the available computational power is reduced by 1/3 (with 3 cores) or more

Observation: not all tasks require the same level of fault protection !

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 39 / 50

slide-82
SLIDE 82

Applications

In general, applications consist of a mixture of fault-tolerant, fail-silent and non-fault-tolerant tasks Main idea: a reconfigurable system where

fault-tolerant, fault-silent, and non-fault-tolerant tasks

can live together the system reconfigures itself when executing a particular class of tasks Single-fault assumption

  • ne fault at a time

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 40 / 50

slide-83
SLIDE 83

Hardware platform

The checker can change on-line its internal configuration 3 configurations:

FT mode: all 4 cores in redundant lock-step

  • ne FT channel

FS mode: each pair of cores in coupled lock-step

two FS channels

NF mode: each core work in parallel with the others

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 41 / 50

slide-84
SLIDE 84

Reconfiguration

The checker periodically reconfigures the platform going from one mode to the other

the checker must be synchronized with the scheduler

2 4 6 8 10 12 14 16 18 20 22 24

Core 1 Core 2 Core 3 Core 4 FT FS NF FT FS NF Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 42 / 50

slide-85
SLIDE 85

Analysis

We use hierarchical scheduling

Tasks are grouped by their fault-tolerance mode (FT, FS, NF) The scheduler periodically switches between modes the scheduler choose the highest priority task in the current mode

We performed the analysis

guarantee that a certain set of tasks is schedulable in the corresponding mode compute the optimal switching period and the budgets for guaranteeing schedulability and minimise overhead

Open questions

Is the fault model realistic? Can this technique be implemented?

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 43 / 50

slide-86
SLIDE 86

Outline

1

Introduction to RT Systemes

2

Unpredictability

3

Resource Reservations

4

Multicore systems

5

Soft real-time and control systems

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 44 / 50

slide-87
SLIDE 87

Variable computation

For certain applications, execution time may vary considerably

Visual Servoing

The image processing task exhibits a distribution with a long tail Design based on the worst-case would be very expensive

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 45 / 50

slide-88
SLIDE 88

The Continuous Stream MoC

Adaptive Control 1

Set the period of the reservation P as a submultiple of the task period blue circle represents input from sensors green circle represents output to actuators the next job is activated when the previous one has finished (and never before) Jobs that are too late are discarded

Example: T = 8, P = 4, Q = 2

2 4 6 8 10 12 14 16 18 20 τ1

  • 1D. Fontanelli, L. Greco, and L. Palopoli, "Soft Real–Time Scheduling for Embedded

Control Systems," Automatica, vol. 49, pp. 2330–2338, July 2013.

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 46 / 50

slide-89
SLIDE 89

The Continuous Stream MoC

Adaptive Control 1

Set the period of the reservation P as a submultiple of the task period blue circle represents input from sensors green circle represents output to actuators the next job is activated when the previous one has finished (and never before) Jobs that are too late are discarded

Example: T = 8, P = 4, Q = 2

2 4 6 8 10 12 14 16 18 20 τ1

  • 1D. Fontanelli, L. Greco, and L. Palopoli, "Soft Real–Time Scheduling for Embedded

Control Systems," Automatica, vol. 49, pp. 2330–2338, July 2013.

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 46 / 50

slide-90
SLIDE 90

The Continuous Stream MoC

Adaptive Control 1

Set the period of the reservation P as a submultiple of the task period blue circle represents input from sensors green circle represents output to actuators the next job is activated when the previous one has finished (and never before) Jobs that are too late are discarded

Example: T = 8, P = 4, Q = 2

2 4 6 8 10 12 14 16 18 20 τ1

  • 1D. Fontanelli, L. Greco, and L. Palopoli, "Soft Real–Time Scheduling for Embedded

Control Systems," Automatica, vol. 49, pp. 2330–2338, July 2013.

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 46 / 50

slide-91
SLIDE 91

The Continuous Stream MoC

Adaptive Control 1

Set the period of the reservation P as a submultiple of the task period blue circle represents input from sensors green circle represents output to actuators the next job is activated when the previous one has finished (and never before) Jobs that are too late are discarded

Example: T = 8, P = 4, Q = 2

2 4 6 8 10 12 14 16 18 20 τ1

  • 1D. Fontanelli, L. Greco, and L. Palopoli, "Soft Real–Time Scheduling for Embedded

Control Systems," Automatica, vol. 49, pp. 2330–2338, July 2013.

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 46 / 50

slide-92
SLIDE 92

The Continuous Stream MoC

Adaptive Control 1

Set the period of the reservation P as a submultiple of the task period blue circle represents input from sensors green circle represents output to actuators the next job is activated when the previous one has finished (and never before) Jobs that are too late are discarded

Example: T = 8, P = 4, Q = 2

2 4 6 8 10 12 14 16 18 20 τ1

  • 1D. Fontanelli, L. Greco, and L. Palopoli, "Soft Real–Time Scheduling for Embedded

Control Systems," Automatica, vol. 49, pp. 2330–2338, July 2013.

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 46 / 50

slide-93
SLIDE 93

The Continuous Stream MoC

Adaptive Control 1

Set the period of the reservation P as a submultiple of the task period blue circle represents input from sensors green circle represents output to actuators the next job is activated when the previous one has finished (and never before) Jobs that are too late are discarded

Example: T = 8, P = 4, Q = 2

2 4 6 8 10 12 14 16 18 20 τ1

  • 1D. Fontanelli, L. Greco, and L. Palopoli, "Soft Real–Time Scheduling for Embedded

Control Systems," Automatica, vol. 49, pp. 2330–2338, July 2013.

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 46 / 50

slide-94
SLIDE 94

The Continuous Stream MoC

Adaptive Control 1

Set the period of the reservation P as a submultiple of the task period blue circle represents input from sensors green circle represents output to actuators the next job is activated when the previous one has finished (and never before) Jobs that are too late are discarded

Example: T = 8, P = 4, Q = 2

2 4 6 8 10 12 14 16 18 20 τ1

  • 1D. Fontanelli, L. Greco, and L. Palopoli, "Soft Real–Time Scheduling for Embedded

Control Systems," Automatica, vol. 49, pp. 2330–2338, July 2013.

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 46 / 50

slide-95
SLIDE 95

Experiment: robotic example

Straight path following problem for a unicycle-like vehicle LQG Feedback Controller on the linearized system Vision-based control with a high frame-rate camera Beagle Board system

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 47 / 50

slide-96
SLIDE 96

Results

Evolutions of delays

Figure : SRT MoC Figure : CS MoC

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 48 / 50

slide-97
SLIDE 97

Accuracy

Accuracy of tracking

Figure : SRT MoC Figure : CS MoC

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 49 / 50

slide-98
SLIDE 98

Conclusion

Various techniques have been developed to cope with variable execution

Resource Reservations:

Temporal isolation is necessary to support applications with highly variable execution times

Hierarchical scheduling for IMA MemGuard for isolation at the memory level Adaptive control

Still much work to do in multicore systems

to reduce variability to support fault-tolerarance

Giuseppe Lipari (CRIStAL – Émeraude) Real-Time scheduling under uncertainty: challenges and solutions May 17, 2016 50 / 50