design and analysis of time-critical systems...design and analysis of time-critical systems...

18
Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland university

Upload: others

Post on 21-Jun-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

Design and Analysis of Time-Critical Systems Introduction

Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy

computer science

saarlanduniversity

Page 2: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

2

Structure of this Course

?+

Dependence on Initial Cache States and

Cache-Independent Side-Channel Analysis

Jan Reineke

Saarland University, Saarbrucken, Germany

April 11, 2013

|=

1

1. What are real-time systems?

3. How to verify the real-time constraints?

Our Vision: PRET Machines

PREcision-Timed processors: Performance & Predicability

+ = PRET

(Image: John Harrison’s H4, first clock to solve longitude problem)

Precision-Timed (PRET) Machines – p. 11/19

4. How to design timing-predictable

microarchitectures?

2. How are they implemented? (briefly)

Page 3: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

3

1. What are Real-time Systems?

In a real-time system, correctness not only depends on the logical results but also on the time at which results are produced.

l  Typical misconception: •  Real-time computing ≠ compute things as fast as possible •  Real-time computing = compute as fast as necessary,

but also not too fast

Page 4: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

4

1. What are Real-Time Systems?

¢  Real-time systems are often embedded control systems ¢  Timing requirements often dictated by interaction with

physical environment: l  Examples in automotives:

•  ABS: Anti-lock braking systems •  ESP: Electronic stability control •  Airbag controllers

l  Many more examples in trains, avionics, and robotics…

Page 5: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

5

Classification of Real-time Systems Hard and Soft

“A real-time constraint is called hard, if not meeting that constraint could result in a catastrophe” [Kopetz, 1997]

è Safety-critical real-time systems è Main focus of this course

All other time constraints are called soft.

“A guaranteed system response has to be explained without statistical arguments” [Kopetz, 1997].

è Focus is on safe, static methods

Page 6: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

6

2. How are they implemented?

Typical structure of control systems: A very basic approach to program such a system:

Controller

Physical Plant S

enso

rs

Act

uato

rs

initialize state; every clock tick do read inputs; compute outputs and next state; emit outputs end-do

Can be modeled by automaton. How to describe such automata? à Synchronous Languages

Page 7: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

7

Basic Approach: Advantages

¢  Perfect match for sampled-data control theory ¢  Easy to implement, even on “bare” machine ¢  Timing analysis is comparably “simple”:

è Need to make sure that: Worst-case execution time (WCET) < Period

0 1 2 3 4time

Page 8: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

8

2. How are they implemented? Preemptive Scheduling

What if different computations need to be performed at different periods?

Preemptive scheduling:

Non-preemptive execution of two periodic tasks:

0 1 2 3 4

T1

T2

time

Page 9: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

9

2. How are they implemented? Preemptive Scheduling

What if different computations need to be performed at different periods?

Preemptive scheduling:

Preemptive execution of the two tasks:

0 1 2 3 4

T1

T2

time

Page 10: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

10

2. How are they implemented? Multiprocessor Scheduling

What if we have a multi-core at our disposal?

Multiprocessor scheduling:

0 1 2 3 4

T1

T2

time

T3

Page 11: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

11

3. How to verify the real-time constraints? Timing Analysis

Traditional separation into two phases: 1.  Worst-case Execution Time (WCET) Analysis

determines bounds on the execution time of a task when run in isolation

2.  Response-time Analysis determines bounds on tasks’ response times given WCET bounds, accounting for interference due to scheduling decisions

Page 12: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

12

3. How to verify the real-time constraints? WCET Analysis

Worst-case execution time = maximum execution time of a program on a given microarchitecture

+

Our Vision: PRET Machines

PREcision-Timed processors: Performance & Predicability

+ = PRET

(Image: John Harrison’s H4, first clock to solve longitude problem)

Precision-Timed (PRET) Machines – p. 11/19

Page 13: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

13

computer science

saarlanduniversityWhat does the execution time depend on?

1 The input, determining which path is taken through the program.2 The state of the hardware platform:

I Due to caches, pipelines, speculation, etc.3 Interferences from the environment:

I External interferences as seen from the analyzed task on sharedbusses, caches, memory.

Simple CPU

Memory

Jan Reineke Timing Analysis and Timing Predictability 11. Februar 2013 6 / 38

What does the execution time depend on?

¢  The input, determining which path is taken through the program.

Challenge: How to determine feasible paths through a given program?

Page 14: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

14

computer science

saarlanduniversityWhat does the execution time depend on?

1 The input, determining which path is taken through the program.2 The state of the hardware platform:

I Due to caches, pipelines, speculation, etc.3 Interferences from the environment:

I External interferences as seen from the analyzed task on sharedbusses, caches, memory.

Complex CPU(out-of-order execution,

branch prediction, etc.)

MainMemory

L1 Cache

Jan Reineke Timing Analysis and Timing Predictability 11. Februar 2013 6 / 38

What does the execution time depend on?

¢  The input, determining which path is taken through the program.

¢  The state of the hardware platform: l  Due to caches, pipelining, speculation, etc.

Challenge: How to determine feasible „microarchitectural paths“ through a given program?

Page 15: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

15

PowerPC 755 “flies” in Airbus planes

Reineke et al., Berkeley 5

Example of Influence of

Microarchitectural State computer science

saarlanduniversityAccess Time

x=a+b;LOAD r2, _aLOAD r1, _bADD r3,r2,r1

MPC5xx PPC755

Reinhard Wilhelm Timing Analysis and Timing Predictability Tutorial ISCA 2010 5 / 63

computer science

saarlanduniversityAccess Time

x=a+b;LOAD r2, _aLOAD r1, _bADD r3,r2,r1

MPC5xx PPC755

Reinhard Wilhelm Timing Analysis and Timing Predictability Tutorial ISCA 2010 5 / 63

Motorola PowerPC 755

Courtesy of Reinhard Wilhelm.

Reineke et al., Berkeley 5

Example of Influence of

Microarchitectural State computer science

saarlanduniversityAccess Time

x=a+b;LOAD r2, _aLOAD r1, _bADD r3,r2,r1

MPC5xx PPC755

Reinhard Wilhelm Timing Analysis and Timing Predictability Tutorial ISCA 2010 5 / 63

computer science

saarlanduniversityAccess Time

x=a+b;LOAD r2, _aLOAD r1, _bADD r3,r2,r1

MPC5xx PPC755

Reinhard Wilhelm Timing Analysis and Timing Predictability Tutorial ISCA 2010 5 / 63

Motorola PowerPC 755

Courtesy of Reinhard Wilhelm.

Challenge 1a: How to precisely and efficiently analyze cache behavior?

Challenge 2: How to design caches and memory hierarchy to enable precise and efficient analysis?

Challenge 1b: How to account for cache-related preemption delays?

Preemptions are not free!

Example of Influence of Microarchitectural State: Caches

Page 16: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

16

computer science

saarlanduniversityWhat does the execution time depend on?

1 The input, determining which path is taken through the program.2 The state of the hardware platform:

I Due to caches, pipelines, speculation, etc.3 Interferences from the environment:

I External interferences as seen from the analyzed task on sharedbusses, caches, memory.

Simple CPU

Memory

Jan Reineke Timing Analysis and Timing Predictability 11. Februar 2013 6 / 38

computer science

saarlanduniversityWhat does the execution time depend on?

1 The input, determining which path is taken through the program.2 The state of the hardware platform:

I Due to caches, pipelines, speculation, etc.3 Interferences from the environment:

I External interferences as seen from the analyzed task on sharedbusses, caches, memory.

Complex CPU(out-of-order execution,

branch prediction, etc.)

MainMemory

L1 Cache

Jan Reineke Timing Analysis and Timing Predictability 11. Februar 2013 6 / 38

computer science

saarlanduniversityWhat does the execution time depend on?

1 The input, determining which path is taken through the program.2 The state of the hardware platform:

I Due to caches, pipelines, speculation, etc.3 Interferences from the environment:

I External interferences as seen from the analyzed task on sharedbusses, caches, memory.

Complex CPU

L1 Cache

Complex CPU

L1 Cache

...L2

CacheMain

Memory

Jan Reineke Timing Analysis and Timing Predictability 11. Februar 2013 6 / 38

What does the execution time depend on?

¢  The input, determining which path is taken through the program.

¢  The state of the hardware platform: l  Due to caches, pipelining, speculation, etc.

¢  Interference from the environment: l  External interference as seen from the analyzed

task on shared busses, caches, memory.

Page 17: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

17

Example of Influence of Corunning Tasks in Multicores

Radojkovic et al. (ACM TACO, 2012) on Intel Atom and Intel Core 2 Quad:

up to 14x slow-down due to interference on shared L2 cache and memory controller

Challenge 1: How to manage shared resources in a multicore?

Challenge 2: How to structure timing analysis (WCET + response-time analysis) in the presence of interference on shared resources?

Page 18: Design and Analysis of Time-Critical Systems...Design and Analysis of Time-Critical Systems Introduction Jan Reineke @ ACACES Summer School 2017 Fiuggi, Italy computer science saarland

18

Overview of Remainder of this Course

l  WCET/Low-level Analysis •  Basic Structure of Modern WCET Analyzers •  Static Cache Analysis + Cache Predictability

l  Response-time Analysis with a Focus on Shared Resources •  Single Cores with Cache-related Preemption Overheads •  Multi Cores with Shared Resources

l  Design for Timing Predictability •  Predictability and Analyzability •  Case Studies:

•  Academic: Precision-Timed ARM (PTARM) •  Industrial: Kalray MPPA-256