190 likes | 321 Views
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
E N D
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 Property preserving transformation
Shared Variable Communication Pr 1 20Hz Periodic I/O 20Hz Pr 2 To other Partitions Navigation Sensor Processing From other Partitions Shared data area Pr 3 10Hz Integrated Navigation 20Hz Pr 4 Guidance Processing Data flow determined by execution order of write & read 5Hz Pr 6 Flight Plan Processing 2Hz Pr 9 Aircraft Performance Calculation Preemption and concurrency affect read/write order
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,…) 20Hz 10Hz NavSensor Processing Integrated Navigation Thread IntegratedNavigation Read Write Thread NavSensorProcessing Timeline
Port-based AADL Model 20Hz Periodic I/O 20Hz To Partitions Navigation Sensor Processing Nav signal data Nav sensor data From Partitions 10Hz Integrated Navigation 20Hz Guidance Processing Nav data Nav sensor data Guidance Input-compute-output AADL thread semantics 5Hz FP data Flight Plan Processing FP data Immediate and delayed data port connections for deterministic sampling 2Hz Aircraft Performance Calculation Performance data Nav data Fuel Flow
Outline The problem Buffer lifespan model Buffer optimization considerations Property preserving transformation
General Unqueued Port Buffer Model Consumer Producer Consumer/Producer MPj MCj MCk MPk Send Receive Send Receive Xfer Xfer MRj MSj MSk MRk • Send/receive with or without copy • Transfer with or without copy • Processing with or without copy MP: producer copy MS: send copy MR: receive copy MC: consumer copy
Message Streaming Lifespan Model TP, Mi+1 DP, Mi+1 B E Producer task MPi MPi+1 SMi Send Send buffer MSi MSi+1 XMi Xfer MRi MRi+1 Receive buffer RMi Receive MCi MCi+1 Consumer task TC, Mi DC, Mi TX
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
Outline The problem Buffer lifespan model Buffer optimization considerations Property preserving transformation
Sequential Task Execution TP ;TC Collapse to single buffer MPi MPi+1 MS MS MR MR MCi MCi-1
MPi MPi+1 MS MS MR MR MCi MCi-1 Overlapping Message Instances Overlapping message instance lifespan Send, transfer, or receive as copy operation Copy message between 2 buffersbefore BMPi+1 after EMCi-1
Application-based Send and Receive (ASR) ASR TP P SP DP TC C RCDC MP P P S&X • : actual execution start time : actual completion time MR C C R MC • ASR/IMT • P - P C - C non-deterministic S/R
Buffer Optimization Considerations Periodic & aperiodic task dispatch • 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 • Message transfer • Immediate to consumer (IMT) • Direct to delayed consumer (DMT) • Period-delayed to consumer (PMT)
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
Periodic Task Communication Summary 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 1B: Single buffer 2B: Two buffers 3B: Three buffers 4B: Four buffers
Outline The problem Buffer lifespan model Buffer optimization considerations Property preserving transformation
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
Peter H Feiler phf@sei.cmu.edu