embedded system design framework for minimizing code size and guaranteeing real-time requirements...

33
Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USA CSE, SNU, KOREA

Post on 22-Dec-2015

217 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

Embedded System Design Framework for

Minimizing Code Size and

Guaranteeing Real-Time Requirements

Insik Shin, Insup Lee, & Sang Lyul Min

CIS, Penn, USA CSE, SNU, KOREA

Page 2: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

2

Agenda

Background

Period Calibration Method (PCM)

Code size reduction technique

Design framework overview

Optimization problem formulation

Heuristic solutions and evaluations

Conclusion

Page 3: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

3

Period Calibration Method (PCM)

Design methodology that transforms real-time system requirements into real-time task scheduling parameters

Example

Drawback : it may not generate schedulable solutions

R. Gerber et al. “Guaranteeing End-to-End Timing Constraints by Calibrating Intermediate Processes”, RTSS ’94.

Page 4: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

4

Code Size Reduction Technique

Code size is a critical design factor for many embedded systems.

Reduced bit-width instructions

ARM microprocessor normal mode : 32-bit instruction set

Thumb mode : 16-bit instruction set

code size can be reduced by 30%, while # of instructions can increase by 40%.

Page 5: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

5

Code Size vs Execution Time Tradeoff

A program contains both 16/32 bit instructions in functions or basic blocks.

Compile-time tradeoff between code size (s) and execution time (e) of a task

s

e

Page 6: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

6

Tradeoff Function

Tradeoff function for each task i

s = fi(e) (linear or discrete)

s

e

A

B

Page 7: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

7

Embedded Real-Time System Design

Problem: design a system satisfying real-time system requirements while minimizing the total code size of the task system

Task 1 Task 2 Task n…

X1

X2Y1

1

2

d1 3

d2 4

F(Y1|X1)=30, F(Y1|X2)=25, C(Y1|X1,X2) = 4,

u(Y1)=40, l(Y1)=30

Real-time System Requirements Tradeoff

Page 8: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

8

Design Framework

Goal : deriving task code size and scheduling parameters while minimizing the system code size and guaranteeing real-time requirements

X1

X2Y1

1

2

d1 3

d2 4

F(Y1|X1)=30, F(Y1|X2)=25, C(Y1|X1,X2) = 4,

u(Y1)=40, l(Y1)=30

Real-time System Requirements

PCM

0 5 10

Task Scheduling Parameters

0 5 10Task 1 Task 2 Task n

Tradeoff

Design Framework

Page 9: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

9

Design Framework Overview

Real-Time System Requirements

Task Code Size

Feasibility Constraints

Task Exec. Time

Min. Task Exec. Time

PCMTask Scheduling

Parameters

Task Tradeoff

FeasibilityAnalysis

Optimization Framework

Design Framework

Task Code Size & Scheduling Parameters

Page 10: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

10

Design Framework Overview

Real-Time System Requirements

Task Code Size

Feasibility Constraints

Task Exec. Time

Min. Task Exec. Time

PCMTask Scheduling

Parameters

Task Tradeoff

FeasibilityAnalysis

Optimization Framework

Design Framework

Task Code Size & Scheduling Parameters

Page 11: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

11

Optimization Problem Formulation Given linear or discrete tradeoff functions and

task scheduling parameters, determine task execution time solving the following optimization problem:

Optimization problem: objective: minimizing

constraint: feasibility

n

i

ii

n

i

i efs1

)(

1

Page 12: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

12

Feasibility Analysis Task model : asynchronous periodic tasks with

pre-period deadlines under EDF scheduling For the task model, an exact feasibility

condition is

for all , where is the number of jobs of task that must be completely scheduled in [t1, t2).

Feasibility Analysis is NP-hard [Baruah ’90].

n

i

ii ttett1

221 1),(

max21 20 OTtt LCM ),( 21 ttii

Page 13: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

13

Feasibility Analysis Our contribution: another exact feasibility

condition that can be more efficiently evaluated.

for all (t1, t2) ODALL , where ODALL is a set of

possible pair of (offset, deadline) between 0 and 2TLCM + Omax.

n

i

ii ttett1

221 1),(

Page 14: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

14

Optimization Framework Optimization Problem

Objective : minimizing Constraint :

for all (t1, t2) ODALL .

Complexity of optimization problem Linear tradeoff : the optimization problem can

be solved through linear programming. Discrete tradeoff: we prove the problem is

NP-hard and present three heuristics.

n

i

ii ttett1

221 1),(

n

i

ii

n

i

i efs1

)(

1

Page 15: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

15

Heuristic Algorithms Consider the following three tasks

1 2 3

Ti 9 7 5

ei 2 1 2

1

2

30 5 10 15 20

Page 16: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

16

Heuristic Algorithms Each job can increase its execution time if there

is an empty slot in its execution window

1

2

30 5 10 15 20

0 5 10 15 20

EDF Schedule

Page 17: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

17

Heuristic Algorithms Each job can increase its execution time if there

is an empty slot in its execution window

1

2

30 5 10 15 20

0 5 10 15 20

EDF Schedule

Page 18: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

18

Heuristic Algorithms Each job can increase its execution time if there

is an empty slot in its execution window Cumulative amount of execution time each job can

increase

1

2

30 5 10 15 20

Page 19: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

19

Heuristic Algorithms Each job can increase its execution time if there

is an empty slot in its execution window The maximum amount of execution time a task can

increase is the maximum amount of execution time all of its jobs can increase together.

1

2

30 5 10 15 20

Page 20: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

20

Heuristic Algorithms Highest Best Reduction-Ratio First (HBRF)

reduction ratio

choose a task with the highest reduction ratio

1

20 5 10 15 20

ei i

i

iiiii efef

)()(

Page 21: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

21

Heuristic Algorithms Longest Period First (LPF)

choose a task with the longest period. In general, increasing the execution time of

this task has the least impact on the schedulability of task set

1

20 5 10 15 20

T1

T2

Page 22: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

22

Heuristic Algorithms Highest Best Weighted-Reduction-Ratio First (HBWF)

Weighted reduction ratio

choose a task with the highest weighted reduction ratio

1

20 5 10 15 20

ei i

i

iiiii

LCM

i efef

T

T

)()(

T1

T2

Page 23: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

23

Evaluation of Heuristic Algorithms Closeness to OPT

S(init) – initial system code size S(alg) – system code size obtained with

an heuristic algorithm S(opt) – optimal system code size Closeness to OPT

)()(

)()(

optSinitS

algSinitS

Page 24: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

24

Performance of algorithms with 8 tasks

0

0.2

0.4

0.6

0.8

1

60 70 80 90 100

Den

sity

BEST

HBRF

HBWF

LPF

Closeness to OPT (%)

Page 25: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

25

Performance of BEST with various task numbers

0

0.2

0.4

0.6

0.8

1

60 70 80 90 100

Den

sity 4 tasks

6 tasks

8 tasks

10 tasks

12 tasks

Closeness to OPT (%)

Page 26: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

26

Conclusion Design framework taking advantage of

the code size vs. execution time tradeoff Future work

Energy consumption is another critical design factor of embedded systems.

Extends this framework so as to utilize tradeoffs among code size, execution time, and energy consumption.

Page 27: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

27

Real-Time System Requirements

Task graph

dataflow & task precedence

End-to-end timing constraints

freshness from input to output

input correlation

output separation

Page 28: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

28

Task Graph

Dataflow & task precedence

X1

X2

Y11

2

d1

d2

4

X3 3 d3

d45

Y26

Page 29: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

29

End-to-end timing Constraints

Freshness from input to output: F(Y1|X1)

Input correlation : C(Y1|X1,X2)

Output separation : u(Y1), l(Y1)

X1

X2

Y11

2

d1

d2

4

Page 30: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

30

Example – System Requirements

X1

X2

Y11

2

d1

d2

4

X3 3 d3

d45

Y26

F(Y1|X1)=30, F(Y1|X2)=30, F(Y2|X2)=20, F(Y2|X3)=15

C(Y1|X1,X2)=3, C(Y2|X2,X3)=4

l(Y1)=21, u(Y1)=32, l(Y2)=29, u(Y2)=41

e1=2, e2=2, e3=1, e4=3,e5=2, e6=3

Page 31: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

31

Example – Solution Process

1. deriving the period of each task

minimizing utilization ( )

2. deriving the offset and deadline of each task

3. deriving the fixed priority of each task

i

i

T

e

Page 32: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

32

Example – Task Scheduling Parameters

1 2 3 4 5 6

period 26 13 39 26 39 39

offset 0 0 0 21 0 13

deadline 21 12 13 26 13 15

priority 1 2 3 4 5 6

Page 33: Embedded System Design Framework for Minimizing Code Size and Guaranteeing Real-Time Requirements Insik Shin, Insup Lee, & Sang Lyul Min CIS, Penn, USACSE,

33

Real-Time Task Scheduling Parameters

Period (Ti)

Offset (Oi)

Deadline (Di)

Fixed priority

Execution time (ei)