efficient embedded runtime systems through optimization of port communication

19
© 2006 Carnegie Mellon University Efficient Embedded Runtime Systems through Optimization of Port Communication Software Engineering Institute Carnegie Mellon University Pittsburgh, PA 15213 Peter H Feiler April 2, 2008

Upload: bruno-munoz

Post on 03-Jan-2016

45 views

Category:

Documents


2 download

DESCRIPTION

Efficient Embedded Runtime Systems through Optimization of Port Communication. Software Engineering Institute Carnegie Mellon University Pittsburgh, PA 15213 Peter H Feiler April 2, 2008. Outline. The problem Buffer lifespan model Buffer optimization considerations - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Efficient Embedded Runtime Systems through Optimization of Port Communication

© 2006 Carnegie Mellon University

Efficient Embedded Runtime Systems through Optimization of Port Communication

Software Engineering InstituteCarnegie Mellon UniversityPittsburgh, PA 15213

Peter H FeilerApril 2, 2008

Page 2: Efficient Embedded Runtime Systems through Optimization of Port Communication

2Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Outline

The problem

Buffer lifespan model

Buffer optimization considerations

Property preserving transformation

Page 3: Efficient Embedded Runtime Systems through Optimization of Port Communication

3Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Shared Variable Communication

Navigation Sensor

Processing

Integrated Navigation

Guidance Processing

Flight PlanProcessing

Aircraft Performance Calculation

20Hz

10Hz

20Hz

5Hz

2Hz

From other

Partitions

Periodic I/O20Hz

To other

Partitions

Shared data area

Pr 1

Pr 2

Pr 3

Pr 4

Pr 6

Pr 9

Data flow determined by execution order of

write & read

Preemption and concurrency affect

read/write order

Page 4: Efficient Embedded Runtime Systems through Optimization of Port Communication

4Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Non-Deterministic Sampling of Data Stream

Example: Downsampling

• Desired sampling pattern 2X: n, n+2, n+4 (2,2,2,…)

• Worst-case sampling pattern: n, n+1, n+4 (1,3,…)

Timeline

Thread NavSensorProcessing

Thread IntegratedNavigation

NavSensor Processing

Integrated Navigation

20Hz 10Hz

Write

Read

Page 5: Efficient Embedded Runtime Systems through Optimization of Port Communication

5Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Port-based AADL Model

Navigation Sensor

Processing

Integrated Navigation Guidance

Processing

Flight PlanProcessing

Aircraft Performance Calculation

20Hz

10Hz 20Hz

5Hz

2Hz

From

Partitions

To

Partitions

Fuel Flow

Guidance

Nav

sensor

data

Nav signal

data

FP data

Performance

data

Nav

dataNav sensor

data

Nav data

FP data

Periodic I/O20Hz

Immediate and delayed data port connections for

deterministic sampling

Input-compute-output AADL thread semantics

Page 6: Efficient Embedded Runtime Systems through Optimization of Port Communication

6Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Outline

The problem

Buffer lifespan model

Buffer optimization considerations

Property preserving transformation

Page 7: Efficient Embedded Runtime Systems through Optimization of Port Communication

7Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

General Unqueued Port Buffer Model

MSj

MPj

Producer

Send

MRj

Xfer

MPk

Consumer/Producer

MCj

Receive

MSk

Send

Consumer

MCk

MRk

Xfer

Receive

MP: producer copy

MS: send copy

MR: receive copy

MC: consumer copy

• Send/receive with or without copy

• Transfer with or without copy

• Processing with or without copy

Page 8: Efficient Embedded Runtime Systems through Optimization of Port Communication

8Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Message Streaming Lifespan Model

MSi

MPiProducer task

Send

MRi

Xfer

MPi+1

Send buffer

MCi

Receive

MSi+1

Consumer task MCi+1

MRi+1Receive buffer

TP, Mi+1DP, Mi+1

TC, MiDC, Mi

SMi

RMi

XMi

B E

TX

Page 9: Efficient Embedded Runtime Systems through Optimization of Port Communication

9Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Message Lifespan Properties

Message operation ordering condition

SMi < XMi

< RMi

MP bounded by producer dispatches

TP, Mi BMPi

EMPi = SMi

TP, Mi+1

MC bounded by consumer dispatches

TC, Mi RMi

= BMCi EMCi

TC, Mi+1

MS bounded by sends and transfer

SMi = BMSi

X*Mi

EMSi

< SMi+1

MR bounded by transfers and receive

X**Mi

BMRi EMRi

= R***Mi

< XMi+1

* Completion of transfer

** Start of transfer

*** Latest of multiple receivers

Page 10: Efficient Embedded Runtime Systems through Optimization of Port Communication

10Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Outline

The problem

Buffer lifespan model

Buffer optimization considerations

Property preserving transformation

Page 11: Efficient Embedded Runtime Systems through Optimization of Port Communication

11Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Sequential Task Execution

TP ; TC

Collapse to single buffer

MS

MPi

MR

MCi

MPi+1

MS

MR

MCi-1

Page 12: Efficient Embedded Runtime Systems through Optimization of Port Communication

12Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Overlapping Message Instances

Overlapping message instance lifespan

Send, transfer, or receive as copy operation

Copy message between 2 buffers before BMPi+1

after EMCi-1

MS

MPi

MR

MCi

MPi+1

MS

MR

MCi-1

Page 13: Efficient Embedded Runtime Systems through Optimization of Port Communication

13Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Application-based Send and Receive (ASR)

MP

MR

MC

P P

C C

S&X

R

ASR/IMT

P - P C - C non-deterministic S/R

TP P S P DP

TC C R C DC

: actual execution start time

: actual completion time

ASR

Page 14: Efficient Embedded Runtime Systems through Optimization of Port Communication

14Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Buffer Optimization Considerations

Send and receive execution• As part of application (ASR)

• As part of task dispatch/completion (DSR)

Task execution order• Concurrent: C | P

• Atomic non-deterministic: C ≠ P

• Ordered: C ; P or P ; C

Periodic & aperiodic task dispatch

Message transfer• Immediate to consumer (IMT)

• Direct to delayed consumer (DMT)

• Period-delayed to consumer (PMT)

Page 15: Efficient Embedded Runtime Systems through Optimization of Port Communication

15Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Consumer Before Producer

C ; P consumer before producer: C,j P,j

• Non-preemption: P,j - P,j C,j - C,j =

• Deterministic S/R for ASR & DSR

• ASR

• Sj-1 < Tj < Rj < Sj < Tj+1 : Sj = SMi Rj = RMi-1

• IMT: Sj-1 = Xj-1 < Tj < Rj < Sj = Xj

• PMT: Sj-1 < Tj = Xj < Rj < Sj < Tj+1 = Xj+1

•DSR

• Sj-1 = DP,j-1 < Tj = Rj < Sj < Tj+1 : Sj = SMi Rj = RMi-1

• IMT: Sj-1 = DP,j-1 = Xj-1 < Tj = Rj < Sj = Xj

• PMT: Sj-1 < Tj = Xj = Rj < Sj < Tj+1 = Xj+1

Period delayed communication

Single buffer

Page 16: Efficient Embedded Runtime Systems through Optimization of Port Communication

16Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Periodic Task Communication Summary

Periodic Same period

ASRIMT | PMT

DSRIMT | PMT

DMT

P ; CMF:1B PD:2B

SXRPD:2B

R

PD:2BSX/R

MF:1B

C ; PPD:1B PD:1B PD:1B PD:1B PD:1B

P CND:1B PD:2B

X

PD:2BR

PD:2BX/R

ND:1B

P | CND:3B

S/XC

RC

PD:2BX

PD:2BR

PD:2BX/R

NDI:2BS/X/RC

1B: Single buffer

2B: Two buffers

3B: Three buffers

4B: Four buffers

S, X, R : data copy

S/X : IMT combined send/xfer

S/X/R : DMT combined S, X, R

X/R: DSR/PMT combined X, R

o1o2 : One operation copy

MF: Mid-Frame

PD: Period Delay

ND: Non-Deterministic

NDI: No Data Integrity

Page 17: Efficient Embedded Runtime Systems through Optimization of Port Communication

17Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

Outline

The problem

Buffer lifespan model

Buffer optimization considerations

Property preserving transformation

Page 18: Efficient Embedded Runtime Systems through Optimization of Port Communication

18Port Communication OptimizationFeiler, April 2008

© 2008 Carnegie Mellon University

AADL Communication Semantics

• Input frozen at dispatch time• Copy to input buffer at dispatch if required

• Data ports & periodic threads• Immediate connection (DMT)

• Data driven execution or offset start time

• Delayed connection (DSR/PMT)• Transfer by dispatch in runtime system

• Sampling ports • Double buffer for concurrency or down-sampling to ensure data consistency during compute

Page 19: Efficient Embedded Runtime Systems through Optimization of Port Communication

Peter H Feiler

[email protected]