24
courseware Scheduling of Distributed Real-Time Systems Jan Madsen Informatics and Mathematical Modelling Technical University of Denmark Richard Petersens Plads, Building 321 DK2800 Lyngby, Denmark [email protected]

Scheduling of Distributed Real-Time Systems

Embed Size (px)

DESCRIPTION

Scheduling of Distributed Real-Time Systems. Jan Madsen Informatics and Mathematical Modelling Technical University of Denmark Richard Petersens Plads, Building 321 DK2800 Lyngby, Denmark [email protected]. 1. 3. 2. 1. 2. 4. 3. 4. os. os. scheduling. a. b. mem. a. b. mem. - PowerPoint PPT Presentation

Citation preview

Page 1: Scheduling of Distributed Real-Time Systems

courseware

Scheduling of Distributed Real-Time Systems

Jan Madsen

Informatics and Mathematical ModellingTechnical University of Denmark

Richard Petersens Plads, Building 321DK2800 Lyngby, Denmark

[email protected]

Page 2: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 2SoC-MOBINET courseware

Multi-processor scheduling

1

34

2

a memb

b

os

3

4

mema

os

2

1

scheduling

Page 3: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 4SoC-MOBINET courseware

Characteristics to be handled

Processes: preemptive and non-preemptive periodic and aperidoic processes with multiple levels of importance group of processes with single deadline

Constraints and requirements: end-to-end timing precedence relations communication shared resources placement hard and soft deadlines fault tolerance

Page 4: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 5SoC-MOBINET courseware

Handling interfaces between

CPU scheduling and resource allocation IO scheduling and CPU scheduling CPU scheduling and communication scheduling Local and distributed scheduling Static scheduling of critical processes and dynamic

scheduling of other processes

Comprehensive results will not exist for many years!

Page 5: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 6SoC-MOBINET courseware

Phases of real-time distributed systems scheduling

Allocation assigning processes and resources to processors in the

system Scheduling

Ordering the execution of processes and communications to meet timing and resource constraints

Dispatching Executing the processes in conformance with the

scheduler’s decisions

Page 6: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 7SoC-MOBINET courseware

Approaches to embedded system scheduling

deterministic (static) scheduling Allocating and static scheduling all periodic processes

off-line Allocate time-slots for handling non-periodic processes

Distributed scheduling Each CPU runs its own scheduler Set of processes is distributed, statically allocated but

dynamically activated

Page 7: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 8SoC-MOBINET courseware

Static distributed scheduling

Typical approach

– Construct a comprehensive graph containing all process instances that executes in an interval of length T (T is the least common multiple of all process periods)

– Cluster communicating processes– Allocate clusters of processes to PEs

and schedule processes and communications

Page 8: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 9SoC-MOBINET courseware

ArchitectureSpecification

Characterization Scheduling

A Simple Example

t1

t3t2

PE1 PE2

bus

t1

t2

t3

PE1 PE2 PE1

PE2

Page 9: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 10SoC-MOBINET courseware

First solution

t1

t3t2

PE1 PE2

bus

ArchitectureSpecification

Characterization Scheduling

t1

t2

t3

PE1 PE2 PE1

PE215 15

10 20

5 -

t1 t2

t3

20

Page 10: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 11SoC-MOBINET courseware

Introducing communication

t1

t3t2

PE1 PE2

bus

ArchitectureSpecification

Characterization Scheduling

t1

t2

t3

PE1 PE2 PE1

PE215 15

10 20

5 -

50 10

t1 t2

t3

25

bus

Can transfer2 data unitsper time unit

5

Page 11: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 12SoC-MOBINET courseware

Introducing interfaces

t1

t3t2

PE1 PE2

bus

ArchitectureSpecification

Characterization Scheduling

t1

t2

t3

PE1 PE2 PE1

PE215 15

10 20

5 -

50 10

i1 i2

t1 t2

t3

27

bus

i1

i2

Can buffer10 data unitsper time unit

Page 12: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 13SoC-MOBINET courseware

PE

Memory?

t1

Memory contributions:program

data

data to be transferred

Memory utilization:

time

Me

mor

y si

zePE t1

Page 13: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 14SoC-MOBINET courseware

Introducing memory

t1

t3t2

PE1 PE2

bus

ArchitectureSpecification

Characterization Scheduling

t1

t2

t3

PE1 PE2 PE1

15 5,5 15 10,5

10 5,5 20 10,5

5 10,2 -

50 10

i1 i2

t1 t2 Peak memory

1052

50

10 = 77

Page 14: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 15SoC-MOBINET courseware

Dynamic multi-processor scheduling

Primary objective is to ensure that all timing constraints are met

Serious difficulties in validating hard timing constraints

Assumptions: Each processor has its own scheduler The scheduler uses a uni-processor scheduling

algorithm Schedulers on different processors need not use the

same algorithm

Page 15: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 16SoC-MOBINET courseware

Multi-processor scheduling

Task assignment Most real-time systems are static, tasks are partitioned

and statically bound to processors

Inter-processor synchronization Ensuring that precedence constraints of tasks on

different processors are always satisfied

Page 16: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 17SoC-MOBINET courseware

Task assignment

Often done off-line NP-hard problem Assignment based on:

Execution times Resource requirements Data dependencies Timing constraints Communication cost ...

b

os

a

os

3

42

1

Page 17: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 18SoC-MOBINET courseware

Task assignment - RMFF

1

34

2Assume zero communication overhead

Scheduling based on fixed priorities

A synchronization signal makes sure that is released as soon as has completed

3 2

Example:

1 a

i k i

k

Rate-Monotonic First-Fit algorithm:1. Sort tasks in increasing order according to their period

2. Assign tasks one by one is assigned to is assigned to if the total utilization of and the tasks

already assigned to < URM

Page 18: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 19SoC-MOBINET courseware

Example

1

34

2

ri Ti ei

0 4 2

0 6 2+2

4 6 3

1

2

4

3

b

os

4

a

os

1

2

3

Page 19: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 20SoC-MOBINET courseware

Dynamic scheduling

b

os

4

a

os

1

2

3

0 4 6 8 102 14 1612

1

2a

0 4 6 8 102 14 1612

3

4b

RM RM

Page 20: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 21SoC-MOBINET courseware

Changing synchronization protocol

0 4 6 8 102

0 4 6 8 102

14 1612

14 1612

b

os

4

a

os

1

2

31

3

2

4

a

b

RM EDF

Page 21: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 22SoC-MOBINET courseware

Multi-processing anomalies

Assume a set of tasks optimally scheduled on a multiprocessor system with: fixed number of processors fixed execution times (ei)

precedence constraints Then

changing the priority list increasing the number of processor reducing execution times weakening the precedence constraints

May increase the scheduling length!

Page 22: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 23SoC-MOBINET courseware

Example of anomalies

1

3

2

4 5

1

3

2

4 5

Reduce e1 of task 1

a

b

a

b

Task 2 and 4 are sharing a resource, i.e. mutually exclusion

1 3

42

5

Page 23: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 24SoC-MOBINET courseware

Consequences of anomalies

Tasks may complete before their WCETs So most on-line scheduling algorithms are

subject to experience anomalies Simple but inefficient solution:

Have tasks completing early idle

Page 24: Scheduling of Distributed Real-Time Systems

(c) Jan Madsen 25SoC-MOBINET courseware

Summary

Introduction to classical uni-processor multi-task scheduling

illustration of multi-processor scheduling Not covered:

Priority inversion when having shared resources Context switching and cache overhead Overload conditions Low power scheduling,

Increasing idle periods on processors Voltage scaling

Communication