Communicatin Centered Programming for Embedded Systems Sakura - - PowerPoint PPT Presentation

communicatin centered programming for embedded systems
SMART_READER_LITE
LIVE PREVIEW

Communicatin Centered Programming for Embedded Systems Sakura - - PowerPoint PPT Presentation

Communicatin Centered Programming for Embedded Systems Sakura Bhandari, Shoji Yuen (Nagoya University) Presented at SOA workshop in APSEC2007 (Dec. 2007, Nagoya) 1 Basics09 workshop( ), 10/12/2009 Motivation: Behavior descriptions


slide-1
SLIDE 1

Sakura Bhandari, Shoji Yuen (Nagoya University) Presented at SOA workshop in APSEC2007 (Dec. 2007, Nagoya)

Communicatin Centered Programming for Embedded Systems

1

slide-2
SLIDE 2

Basics09 workshop(上海), 10/12/2009

Motivation: Behavior descriptions for embedded system software

 Embedded systems in multi/many cores

Many cores are cheaper

 Control over critical components

Verification/Certification

 Low-level coding

Direct real-time device control (by interrupt)

 Time-aware behavior

Real-time constraints

2

2

slide-3
SLIDE 3

Basics09 workshop(上海), 10/12/2009

Target Overview

EPP theory of a process calculus:

System(C1,C2,C3) ~ C1’|C2’|C3’’

Does this work for embedded system software?

3

slide-4
SLIDE 4

Basics09 workshop(上海), 10/12/2009

Target Overview

EPP theory of a process calculus:

System(C1,C2,C3) ~ C1’|C2’|C3’’

Does this work for embedded system software? extension is necessary

3

slide-5
SLIDE 5

Basics09 workshop(上海), 10/12/2009

Contents

 Overview of Communication Centered

Programming

 Extension with Priority (in Home Appliance

Network)

 Concluding Remarks and Future Directions

4

slide-6
SLIDE 6

Basics09 workshop(上海), 10/12/2009

Communication Centered Programming [Carbone,Honda,Yoshida06]

Global Description:Communication between agents Local Description: Behavior at each agent Transformation from GD to LD: End-point Projection

Behavioral correctness: bisimularity Communication correctness: session type Endpoint Calculus : (A version of) typed π calculus Send message (op,v) in session s and v is stored in x at B To Ensures EPP for GD=3 type principles

5

slide-7
SLIDE 7

Basics09 workshop(上海), 10/12/2009

Communication Centered Programming for WS

CCP is successfully applied for Web Services Business Protocol/SOA for enterprise systems

CCP implements ‘Choreograpy’ in Web Services

6

slide-8
SLIDE 8

Basics09 workshop(上海), 10/12/2009

Global Description

Operational Semantics:

7

slide-9
SLIDE 9

Basics09 workshop(上海), 10/12/2009

Local Description

Behavioral semantics: Defined by π-like SOS rules

8

slide-10
SLIDE 10

Basics09 workshop(上海), 10/12/2009

Well-structuredness in Global descriptions

 Three principles for global descriptions

 Connectedness  Well-threadedness  Coherence

Well-typed in session types

(Example) I : interaction among Buyer,Seller,Shipper

9

slide-11
SLIDE 11

Basics09 workshop(上海), 10/12/2009

EPP (End Point Projection)

Theorem

  • 1. EPP preserves the session type
  • 2. EPP generates sound and complete local descriptions.

(Up to structural congruence and pruning)

10

slide-12
SLIDE 12

Basics09 workshop(上海), 10/12/2009

Application to Embedded systems

 Embedded Systems requires more properties

real-time, Priority, (and probability) Framwork for system development (not limited to embedded systems)

Extension in syntax/semantics

11

slide-13
SLIDE 13

Basics09 workshop(上海), 10/12/2009

Priority in choreography

P1 P2 P3 P1 communicates with P3 unless P2 wishes to communicate P2 communicates with P3 unless P1 wishes to communicate P3 communicates with P2 unless P1 wishes to communicate Globally: P1>P2>P3 Can the global priority be extended in local priority?

  • n the limited form of Global Descriptions (Guarded/Regular)

12

slide-14
SLIDE 14

Basics09 workshop(上海), 10/12/2009

Services in Home Network System

Due to the dynamic nature of home appliance network

Appliances export their own features to the network

No centralized server exists

SOA Based Home Network System

  • ff
  • n

small

Light

play stop

  • ff

DVD Player TV

video_on channel_on

  • ff

Appliances can be dynamically added and modified

13

slide-15
SLIDE 15

Basics09 workshop(上海), 10/12/2009

Services in Home Network System

Due to the dynamic nature of home appliance network

Appliances export their own features to the network

No centralized server exists

SOA Based Home Network System

  • ff
  • n

small

Light

play stop

  • ff

DVD Player TV

video_on channel_on

  • ff

Appliances can be dynamically added and modified

13

slide-16
SLIDE 16

Basics09 workshop(上海), 10/12/2009

Services in Home Network System

Due to the dynamic nature of home appliance network

Appliances export their own features to the network

No centralized server exists

SOA Based Home Network System

  • ff
  • n

small

Light

play stop

  • ff

DVD Player TV

video_on channel_on

  • ff

Loosely Coupled Appliances can be dynamically added and modified

13

slide-17
SLIDE 17

Basics09 workshop(上海), 10/12/2009

play video_on small

CCP for home appliances

Example of DVD play interaction

14

slide-18
SLIDE 18

Basics09 workshop(上海), 10/12/2009

USER → DVD : chDVD (νsDVD ). DVD → TV : chTV : (νtDVD ). TV → LIGHT1 : chLIGHT1 (νuDVD ). USER → DVD : sDVD<play>. DVD → TV : tDVD<video_on>. TV → LIGHT1 : uDVD<small>.0

Global Description

play video_on small

CCP for home appliances

Example of DVD play interaction

14

slide-19
SLIDE 19

Basics09 workshop(上海), 10/12/2009

USER → DVD : chDVD (νsDVD ). DVD → TV : chTV : (νtDVD ). TV → LIGHT1 : chLIGHT1 (νuDVD ). USER → DVD : sDVD<play>. DVD → TV : tDVD<video_on>. TV → LIGHT1 : uDVD<small>.0

Global Description

play video_on small

CCP for home appliances

DVD [ chDVD(νs). chTV(νs). s ▷ play. s ◁ video_on. ] TV [ !chTV(νt). chLIGHT1(νu). t ▷ video_on. u ◁ small ] LIGHT1 [ !chLIGHT1(νu). u ▷ small ]

Local Descriptions

Example of DVD play interaction

EPP

14

slide-20
SLIDE 20

Basics09 workshop(上海), 10/12/2009

Behavioral interference

An interference example between the DVD Play Interaction and the Coming Home Interaction

User plays the DVD User opens the Door The air conditioner switches on The light turns on The light turns ofg The TV is set to the video mode

15

slide-21
SLIDE 21

Basics09 workshop(上海), 10/12/2009

Behavioral interference

An interference example between the DVD Play Interaction and the Coming Home Interaction

User plays the DVD User opens the Door The air conditioner switches on The light turns on The light turns ofg The TV is set to the video mode

15

slide-22
SLIDE 22

Basics09 workshop(上海), 10/12/2009

Behavioral interference

An interference example between the DVD Play Interaction and the Coming Home Interaction

User plays the DVD User opens the Door The air conditioner switches on The light turns on The light turns ofg The TV is set to the video mode

15

slide-23
SLIDE 23

Basics09 workshop(上海), 10/12/2009

Behavioral interference

An interference example between the DVD Play Interaction and the Coming Home Interaction

User plays the DVD User opens the Door The air conditioner switches on The light turns on The light turns ofg The TV is set to the video mode

Interference

  • ccurs

15

slide-24
SLIDE 24

Basics09 workshop(上海), 10/12/2009

Behavioral interference

An interference example between the DVD Play Interaction and the Coming Home Interaction

User plays the DVD User opens the Door The air conditioner switches on The light turns on The light turns ofg The TV is set to the video mode

Interference

  • ccurs

Interference... a phenomenon where two interactions include two difgerent functions of a common appliance

15

slide-25
SLIDE 25

Basics09 workshop(上海), 10/12/2009

Behavioral interference

An interference example between the DVD Play Interaction and the Coming Home Interaction

User plays the DVD User opens the Door The air conditioner switches on The light turns on The light turns ofg The TV is set to the video mode

We assign priority to each interaction which can conflict with others

Interference

  • ccurs

Interference... a phenomenon where two interactions include two difgerent functions of a common appliance

15

slide-26
SLIDE 26

Basics09 workshop(上海), 10/12/2009

Behavioral interference

An interference example between the DVD Play Interaction and the Coming Home Interaction

User plays the DVD User opens the Door The air conditioner switches on The light turns on The light turns ofg The TV is set to the video mode

p1 p2

15

slide-27
SLIDE 27

Basics09 workshop(上海), 10/12/2009

Behavioral interference

An interference example between the DVD Play Interaction and the Coming Home Interaction

User plays the DVD User opens the Door The air conditioner switches on The light turns on The light turns ofg The TV is set to the video mode

p1 p2

15

slide-28
SLIDE 28

Basics09 workshop(上海), 10/12/2009

Behavioral interference

An interference example between the DVD Play Interaction and the Coming Home Interaction

User plays the DVD User opens the Door The air conditioner switches on The light turns on The light turns ofg The TV is set to the video mode

p1 p2

15

slide-29
SLIDE 29

Basics09 workshop(上海), 10/12/2009

Behavioral interference

An interference example between the DVD Play Interaction and the Coming Home Interaction

User plays the DVD User opens the Door The air conditioner switches on The light turns on The light turns ofg The TV is set to the video mode

p1 p2

interference will not occur !!

15

slide-30
SLIDE 30

Basics09 workshop(上海), 10/12/2009

Priority wrt CCP

To resolve interference within the Communication Centered Programming...

EPP

(End Point Projection)

Integrated Services Appliance Behavior

Local Description Global Description Global Description Global Description Global Description Local Description Local Description

16

slide-31
SLIDE 31

Basics09 workshop(上海), 10/12/2009

Priority wrt CCP

To resolve interference within the Communication Centered Programming...

EPP

(End Point Projection)

Integrated Services Appliance Behavior

Local Description Global Description Global Description Global Description Global Description Local Description Local Description

with Priority

with Priority with Priority with Priority with Priority

16

slide-32
SLIDE 32

Basics09 workshop(上海), 10/12/2009

Priority wrt CCP

To resolve interference within the Communication Centered Programming...

EPP

(End Point Projection)

Integrated Services Appliance Behavior

Local Description Global Description Global Description Global Description Global Description Local Description Local Description

with Priority

with Priority with Priority with Priority with Priority with Priority with Priority with Priority

16

slide-33
SLIDE 33

Basics09 workshop(上海), 10/12/2009

Global Description with Priority

Priority Altering Operator

...maps the priority to all interactions in the service

Σpmap P

An example for DVD Service

DVD Service[ DVD Play Interaction p1 + p3 DVD Stop Interaction ]

For a binary case where services P includes I1 and I2

I1 p1+p2 I2

pmap(I1) = p1 pmap(I2) = p2

We write as

for binary choice

17

slide-34
SLIDE 34

Basics09 workshop(上海), 10/12/2009

Global Description with Priority

Priority Altering Operator

...maps the priority to all interactions in the service

Σpmap P

An example for DVD Service

DVD Service[ DVD Play Interaction p1 + p3 DVD Stop Interaction ]

For a binary case where services P includes I1 and I2

I1 p1+p2 I2

pmap(I1) = p1 pmap(I2) = p2

We write as

for binary choice

17

slide-35
SLIDE 35

Basics09 workshop(上海), 10/12/2009

Example for Global Description

DVDSERVICE : (

USER → DVD : chDVD (νsDVD ). DVD → TV : chTV : (νtDVD ). TV → LIGHT1 : chLIGHT1 (νuDVD ). LIGHT1 → CURTAIN1 : chCURTAIN1 (νvDVD ). USER → DVD : chDVD (νs′DVD ). DVD → TV : chTV (νt′DVD ). TV → LIGHT1 : chLIGHT1 (νu′DVD ). LIGHT1 → CURTAIN1 : chCURTAIN1 (νv′DVD ). recX.( USER → DVD : sDVD<play>. DVD → TV : tDVD<video_on>. TV → LIGHT1 : uDVD<small>. LIGHT1 → CURTAIN1 : vDVD<down>.X p1 + p3 USER → DVD : s′DVD<stop>. DVD → TV : t′DVD<channel on>. TV → LIGHT1 : u′DVD<on>. LIGHT1 → CURTAIN1 : v′DVD<up>.X ) )

I1: DVD Play I2: DVD Stop DVD Service

18

slide-36
SLIDE 36

Basics09 workshop(上海), 10/12/2009

Example for Global Description

DVDSERVICE : (

USER → DVD : chDVD (νsDVD ). DVD → TV : chTV : (νtDVD ). TV → LIGHT1 : chLIGHT1 (νuDVD ). LIGHT1 → CURTAIN1 : chCURTAIN1 (νvDVD ). USER → DVD : chDVD (νs′DVD ). DVD → TV : chTV (νt′DVD ). TV → LIGHT1 : chLIGHT1 (νu′DVD ). LIGHT1 → CURTAIN1 : chCURTAIN1 (νv′DVD ). recX.( USER → DVD : sDVD<play>. DVD → TV : tDVD<video_on>. TV → LIGHT1 : uDVD<small>. LIGHT1 → CURTAIN1 : vDVD<down>.X p1 + p3 USER → DVD : s′DVD<stop>. DVD → TV : t′DVD<channel on>. TV → LIGHT1 : u′DVD<on>. LIGHT1 → CURTAIN1 : v′DVD<up>.X ) )

session initialization I1: DVD Play I2: DVD Stop DVD Service

18

slide-37
SLIDE 37

Basics09 workshop(上海), 10/12/2009

Example for Global Description

DVDSERVICE : (

USER → DVD : chDVD (νsDVD ). DVD → TV : chTV : (νtDVD ). TV → LIGHT1 : chLIGHT1 (νuDVD ). LIGHT1 → CURTAIN1 : chCURTAIN1 (νvDVD ). USER → DVD : chDVD (νs′DVD ). DVD → TV : chTV (νt′DVD ). TV → LIGHT1 : chLIGHT1 (νu′DVD ). LIGHT1 → CURTAIN1 : chCURTAIN1 (νv′DVD ). recX.( USER → DVD : sDVD<play>. DVD → TV : tDVD<video_on>. TV → LIGHT1 : uDVD<small>. LIGHT1 → CURTAIN1 : vDVD<down>.X p1 + p3 USER → DVD : s′DVD<stop>. DVD → TV : t′DVD<channel on>. TV → LIGHT1 : u′DVD<on>. LIGHT1 → CURTAIN1 : v′DVD<up>.X ) )

description for DVD play interaction description for DVD stop interaction I1: DVD Play I2: DVD Stop DVD Service

18

slide-38
SLIDE 38

Basics09 workshop(上海), 10/12/2009

Example for Global Description

DVDSERVICE : (

USER → DVD : chDVD (νsDVD ). DVD → TV : chTV : (νtDVD ). TV → LIGHT1 : chLIGHT1 (νuDVD ). LIGHT1 → CURTAIN1 : chCURTAIN1 (νvDVD ). USER → DVD : chDVD (νs′DVD ). DVD → TV : chTV (νt′DVD ). TV → LIGHT1 : chLIGHT1 (νu′DVD ). LIGHT1 → CURTAIN1 : chCURTAIN1 (νv′DVD ). recX.( USER → DVD : sDVD<play>. DVD → TV : tDVD<video_on>. TV → LIGHT1 : uDVD<small>. LIGHT1 → CURTAIN1 : vDVD<down>.X p1 + p3 USER → DVD : s′DVD<stop>. DVD → TV : t′DVD<channel on>. TV → LIGHT1 : u′DVD<on>. LIGHT1 → CURTAIN1 : v′DVD<up>.X ) )

description for DVD play interaction description for DVD stop interaction I1: DVD Play I2: DVD Stop DVD Service

18

slide-39
SLIDE 39

Basics09 workshop(上海), 10/12/2009

Example for Global Description

DVDSERVICE : (

USER → DVD : chDVD (νsDVD ). DVD → TV : chTV : (νtDVD ). TV → LIGHT1 : chLIGHT1 (νuDVD ). LIGHT1 → CURTAIN1 : chCURTAIN1 (νvDVD ). USER → DVD : chDVD (νs′DVD ). DVD → TV : chTV (νt′DVD ). TV → LIGHT1 : chLIGHT1 (νu′DVD ). LIGHT1 → CURTAIN1 : chCURTAIN1 (νv′DVD ). recX.( USER → DVD : sDVD<play>. DVD → TV : tDVD<video_on>. TV → LIGHT1 : uDVD<small>. LIGHT1 → CURTAIN1 : vDVD<down>.X p1 + p3 USER → DVD : s′DVD<stop>. DVD → TV : t′DVD<channel on>. TV → LIGHT1 : u′DVD<on>. LIGHT1 → CURTAIN1 : v′DVD<up>.X ) )

description for DVD play interaction description for DVD stop interaction I1: DVD Play I2: DVD Stop DVD Service

18

slide-40
SLIDE 40

Basics09 workshop(上海), 10/12/2009

Local Description with Priority

Priority Guard

...an idea borrowed from CPG(CCS with priority guards) by Phillips[P’01]

A priority guard is written as U : a , where U is a set

  • f sessions and operations

communication “a” can be executed if no operator in U is executed at that time

19

slide-41
SLIDE 41

Basics09 workshop(上海), 10/12/2009

Example for Local Description

LIGHT1[

chLIGHT1 (uDVD, TV). chCURTAIN1 (vDVD, LIGHT1). vDVD ◁ ack. uDVD ▹ ack. chLIGHT1 (u′DVD, TV). chCURTAIN1 (v′DVD, LIGHT1). v′DVD ◁ ack. u′DVD ▹ ack. chLIGHT1 (uIO, AIR_CON). chPHONE (vIO, LIGHT1). vIO ◁ ack. uIO ▹ ack. chLIGHT1 (t′DAY, LIGHTG). chLIGHT2 (u′DAY, LIGHT1). u′ DAY ◁ ack. t′DAY ▹ ack. recX.( uDVD ◁ smallplay .vDVD ▹ downplay .vDVD ◁ ack. uDVD ▹ ack. X + u′ DVD ◁ onstop .v′DVD ▹ upstop .v′DVD ◁ ack. u′DVD ▹ ack. X + (uDVD , smallplay ) : uIO ◁ onin .vIO ▹ onin .vIO ◁ ack. uIO ▹ ack. X + (uDVD , smallplay ) : t′DAY ◁ oneven .u′DAY ▹ oneven . u′DAY ◁ ack. t′DAY ▹ ack. X )

20

slide-42
SLIDE 42

Basics09 workshop(上海), 10/12/2009

Example for Local Description

LIGHT1[

chLIGHT1 (uDVD, TV). chCURTAIN1 (vDVD, LIGHT1). vDVD ◁ ack. uDVD ▹ ack. chLIGHT1 (u′DVD, TV). chCURTAIN1 (v′DVD, LIGHT1). v′DVD ◁ ack. u′DVD ▹ ack. chLIGHT1 (uIO, AIR_CON). chPHONE (vIO, LIGHT1). vIO ◁ ack. uIO ▹ ack. chLIGHT1 (t′DAY, LIGHTG). chLIGHT2 (u′DAY, LIGHT1). u′ DAY ◁ ack. t′DAY ▹ ack. recX.( uDVD ◁ smallplay .vDVD ▹ downplay .vDVD ◁ ack. uDVD ▹ ack. X + u′ DVD ◁ onstop .v′DVD ▹ upstop .v′DVD ◁ ack. u′DVD ▹ ack. X + (uDVD , smallplay ) : uIO ◁ onin .vIO ▹ onin .vIO ◁ ack. uIO ▹ ack. X + (uDVD , smallplay ) : t′DAY ◁ oneven .u′DAY ▹ oneven . u′DAY ◁ ack. t′DAY ▹ ack. X )

session initialization

20

slide-43
SLIDE 43

Basics09 workshop(上海), 10/12/2009

Example for Local Description

LIGHT1[

chLIGHT1 (uDVD, TV). chCURTAIN1 (vDVD, LIGHT1). vDVD ◁ ack. uDVD ▹ ack. chLIGHT1 (u′DVD, TV). chCURTAIN1 (v′DVD, LIGHT1). v′DVD ◁ ack. u′DVD ▹ ack. chLIGHT1 (uIO, AIR_CON). chPHONE (vIO, LIGHT1). vIO ◁ ack. uIO ▹ ack. chLIGHT1 (t′DAY, LIGHTG). chLIGHT2 (u′DAY, LIGHT1). u′ DAY ◁ ack. t′DAY ▹ ack. recX.( uDVD ◁ smallplay .vDVD ▹ downplay .vDVD ◁ ack. uDVD ▹ ack. X + u′ DVD ◁ onstop .v′DVD ▹ upstop .v′DVD ◁ ack. u′DVD ▹ ack. X + (uDVD , smallplay ) : uIO ◁ onin .vIO ▹ onin .vIO ◁ ack. uIO ▹ ack. X + (uDVD , smallplay ) : t′DAY ◁ oneven .u′DAY ▹ oneven . u′DAY ◁ ack. t′DAY ▹ ack. X ) DVD Play Interaction DVD Stop Interaction Coming Home Interaction Evening Interaction

20

slide-44
SLIDE 44

Basics09 workshop(上海), 10/12/2009

Example for Local Description

LIGHT1[

chLIGHT1 (uDVD, TV). chCURTAIN1 (vDVD, LIGHT1). vDVD ◁ ack. uDVD ▹ ack. chLIGHT1 (u′DVD, TV). chCURTAIN1 (v′DVD, LIGHT1). v′DVD ◁ ack. u′DVD ▹ ack. chLIGHT1 (uIO, AIR_CON). chPHONE (vIO, LIGHT1). vIO ◁ ack. uIO ▹ ack. chLIGHT1 (t′DAY, LIGHTG). chLIGHT2 (u′DAY, LIGHT1). u′ DAY ◁ ack. t′DAY ▹ ack. recX.( uDVD ◁ smallplay .vDVD ▹ downplay .vDVD ◁ ack. uDVD ▹ ack. X + u′ DVD ◁ onstop .v′DVD ▹ upstop .v′DVD ◁ ack. u′DVD ▹ ack. X + (uDVD , smallplay ) : uIO ◁ onin .vIO ▹ onin .vIO ◁ ack. uIO ▹ ack. X + (uDVD , smallplay ) : t′DAY ◁ oneven .u′DAY ▹ oneven . u′DAY ◁ ack. t′DAY ▹ ack. X ) DVD Play Interaction DVD Stop Interaction Coming Home Interaction Evening Interaction

Priority Guard

LIGHT1 can execute the coming home interaction only if the

  • perator smallplay in the priority guard is not executing at that time

20

slide-45
SLIDE 45

Basics09 workshop(上海), 10/12/2009

EPP with Priority

Several examples of interactions

Based the equivalence of global and local descriptions EPP fits with the descriptions with priority

21

slide-46
SLIDE 46

Basics09 workshop(上海), 10/12/2009

EPP with Priority

Several examples of interactions

Global Description with priority

EPP with priority

Local Description with priority Local Description with priority Local Description with priority

Each step of the global description corresponds to that of the local descriptions derived from the global descriptions

Global Description with priority’

EPP with priority

Local Description with priority Local Description with priority Local Description with priority

Based the equivalence of global and local descriptions EPP fits with the descriptions with priority

21

slide-47
SLIDE 47

Basics09 workshop(上海), 10/12/2009

Remarks

 Fine-grained controls by communication with priority → extend the existing framework for web services  EPP as a foundation for compositional development for distributed systems  Application to home appliance network with priority  Global description is simple (Guraded/Regular)

22

slide-48
SLIDE 48

Basics09 workshop(上海), 10/12/2009

Future Directions

  • Timed process calculi with EPP
  • Application to larger examples

(Automotive software)

  • General theory of EPP with time/priority
  • Interrupts / Exceptions

23