Session Types in a Nutshell Session Types structure a series of - - PowerPoint PPT Presentation

session types in a nutshell
SMART_READER_LITE
LIVE PREVIEW

Session Types in a Nutshell Session Types structure a series of - - PowerPoint PPT Presentation

Session Types in a Nutshell Session Types structure a series of interactions in a simple and concise syntax and ensure type safe communication . A Protocol Protocol: Buyer-Seller Alice Seller title Description: Alice buying a


slide-1
SLIDE 1
slide-2
SLIDE 2
slide-3
SLIDE 3
slide-4
SLIDE 4
slide-5
SLIDE 5

Session Types in a Nutshell

“…Session Types structure a series of interactions in a simple and concise syntax and ensure type safe communication.”

slide-6
SLIDE 6

A Protocol

Alice Seller title quote Address Date

  • k

quit

Protocol: Buyer-Seller Description: Alice buying a book

slide-7
SLIDE 7

Are we compatible?

slide-8
SLIDE 8

Are we compatible?

slide-9
SLIDE 9
  • No communication mismatch

Communication safety

  • Communications follow the desired protocol

Session Fidelity

  • No deadlock/stuck in a session

Progress

What is a type safe communication ?

slide-10
SLIDE 10
slide-11
SLIDE 11
slide-12
SLIDE 12
slide-13
SLIDE 13
slide-14
SLIDE 14
slide-15
SLIDE 15

Session‐based Distributed Programming in Java

Raymond Hu, Nobuko Yoshida Kohei Honda

slide-16
SLIDE 16

Implementing Customer (4)

protocol p { begin. ![ !<String>. ?(int) ]* !{ ACCEPT: { !<Address>. ?(Date) }, REJECT: { } } } SJSocket s = SJSocket.create(p, …); s.request(); s.outwhile(…) { s.send(”PARIS/EUROSTAR”); cost = s.receive(); } if (…) { s.outbranch(ACCEPT) { s.send(…); date = s.receive(); } } else { s.outbranch(REJECT) { } }

38 Raymond Hu, Nobuko Yoshida, Kohei Honda

slide-17
SLIDE 17

: ⇥⇤⌅⇧⌃ ⌥⌃'⌃⌃ " ⌦⇧↵ ⌦ ✏ ⌦⌃⇣

⌘ ✓⌃↵↵⇤ ◆⌃↵ BCD;,# ?✓⌫CD;9E

  • ⇠⇥ ⌃# )⇤ ⌦ ⌦ 6⇤↵$⌦ 2⇤ ⌃⌦ ⇡⇢ ⇡✓⌧: 3<44<7
  • 1⇤⇣ ⇥↵ ⇤ ⇤ ⇡⇢ ⇡✓⌧: B?✓⌫CD48E
  • ✓✏⌥⌥⇥⌃

◆⌃✏$ ⇤⇥⇤⌅

AA

slide-18
SLIDE 18

⇥ ⇤⌅⇥⇧ ⌃⇥⌥ ⌦↵ ✏⇣⌘ ↵ ✓◆◆

slide-19
SLIDE 19
slide-20
SLIDE 20

↵⌅⌥⌫ ⇠⇡ ⇢ ⌫⌧⇡⇥⇧ ⌅ ✏⌅↵⌅

⌃↵ ⌅⇥⇧ ⌧⌧↵⌥ ⇧!⌧ "⌦#$%&' ()⌦%&*+

  • ,↵ ⇥' -⌥ ⌅ ⌅ .⌥⌧⇣↵⌅ /⌥↵ 012 032$ ✓◆◆✓⌘
  • 4⌥⇥⌅↵⌧⌅⇡↵⌥ ⌥5 012 032$ "()⌦%◆+
  • ✏⇥↵⇠⇠ ⌅⇡

✏⇣ ⌥⌥⇧

  • ,⌫⇡↵!⌅⇥⇡⇧ ⌧⌧↵⌥ ⇧!⌧ "⌦)⌦$%◆*+
  • 61
slide-21
SLIDE 21

↵⌅⌥⌫ ⇠⇡ ⇢ ⌫⌧⇡⇥⇧ ⌅ ✏⌅↵⌅

⌃↵ ⌅⇥⇧ ⌧⌧↵⌥ ⇧!⌧ "⌦#$%&' ()⌦%&*+

  • ,↵ ⇥' -⌥ ⌅ ⌅ .⌥⌧⇣↵⌅ /⌥↵ 012 032$ ✓◆◆✓⌘
  • 4⌥⇥⌅↵⌧⌅⇡↵⌥ ⌥5 012 032$ "()⌦%◆+
  • ✏⇥↵⇠⇠ ⌅⇡

✏⇣ ⌥⌥⇧

  • ,⌫⇡↵!⌅⇥⇡⇧ ⌧⌧↵⌥ ⇧!⌧ "⌦)⌦$%◆*+
  • 6
slide-22
SLIDE 22
slide-23
SLIDE 23
slide-24
SLIDE 24
slide-25
SLIDE 25
slide-26
SLIDE 26
slide-27
SLIDE 27
slide-28
SLIDE 28
slide-29
SLIDE 29

http://mrg.doc.ic.ac.uk/

Us ∈ Mobility Research Group

slide-30
SLIDE 30

⇥⇤ ⌅ ⇧⌃⇤⌥/ ⌥⌦⇤⌃ "⌅⌦⌦ ⌦/⇤

↵ 01 ⌥ 2⇤⇥ 3,445# - 6⇤ ⌥⌃7 ⇧✏⌦⇣⌘ ⇥✓⇧⇤⌥⌦⌅◆⌥ ⌃⌥✏⇥✏⌥⇤ ◆ ⌥

⇧⌃⇤⌥/⌦⌅ ⇥⇤ ⌅⌃ ⌥ ✏⌅⌘ ⌅⌘ ⇧⇤✓ ⌅⌘&

⇤ ⇣⌫⌦⇠⇤ ⌃⇤⌅⌃ ⌥ ⌘ ⇥ ⌅⌃ ⌅⇣✓ ⇥ ⇠⌦⌅ ◆⌥ ⇠ ⇧ $ ◆◆⌫⌃$ ⌥⇤ ⌅⌘

⌅⌫⌃$ ⌥⇤ 3⇤&& ⇧✏ ✓⌃# ⌃✏⇧⇠ ⌥⌦⌅⇤⌃# ✏⌅⌘⇤⌥⌫' ⇤⌥ ⇥ ⇠⇤⌥ ⌃# ⌃ ⇤⇣⇣⌦⇤⌃7# ⌥ ⌅⌃⇠⌦⇤⌘ /⌦ $⌦$⌫⌃⇤⇤⌘ ⌅⇤' ⌥⇡⌃&

8

slide-31
SLIDE 31
slide-32
SLIDE 32

⇥⇤ ⌅ ⇧⌃⇤⌥/ ⌥⌦⇤⌃ "⌅⌦⌦ ⌦/⇤

9

slide-33
SLIDE 33
slide-34
SLIDE 34

OOI agent negotiation 1/5

I https://confluence.oceanobservatories.org/display/syseng/

CIAD+COI+OV+Negotiate+Protocol

11 / 42

slide-35
SLIDE 35

OOI agent negotiation 2/5

type <yml> "SAPDoc1" from "SAPDoc1.yml" as SAP; global protocol Negotiate(role Consumer as C, role Producer as P) { }

12 / 42

slide-36
SLIDE 36

OOI agent negotiation 3/5 (choice)

type <yml> "SAPDoc1" from "SAPDoc1.yml" as SAP; global protocol Negotiate(role Consumer as C, role Producer as P) { propose(SAP) from C to P; choice at P { accept() from P to C; confirm() from C to P; } or { reject() from P to C; } or { propose(SAP) from P to C; } }

13 / 42

slide-37
SLIDE 37

OOI agent negotiation 4/5

type <yml> "SAPDoc1" from "SAPDoc1.yml" as SAP; global protocol Negotiate(role Consumer as C, role Producer as P) { propose(SAP) from C to P; choice at P { accept() from P to C; confirm() from C to P; } or { reject() from P to C; } or { propose(SAP) from P to C; choice at C { accept() from C to P; confirm() from P to C; } or { reject() from C to P; } or { propose(SAP) from C to P; } } }

14 / 42

slide-38
SLIDE 38

OOI agent negotiation 5/5 (recursion)

type <yml> "SAPDoc1" from "SAPDoc1.yml" as SAP; global protocol Negotiate(role Consumer as C, role Producer as P) { propose(SAP) from C to P; rec X { choice at P { accept() from P to C; confirm() from C to P; } or { reject() from P to C; } or { propose(SAP) from P to C; choice at C { accept() from C to P; confirm() from P to C; } or { reject() from C to P; } or { propose(SAP) from C to P; continue X; } }

15 / 42

slide-39
SLIDE 39

Local protocol projection (Negotiation Consumer)

// Global propose(SAP) from C to P; rec START { choice at P { accept() from P to C; confirm() from C to P; } or { reject() from P to C; } or { propose(SAP) from P to C; choice at C { accept() from C to P; confirm() from P to C; } or { reject() from C to P; } or { propose(SAP) from C to P; continue START; } } }

19 / 42

// Projection for Consumer propose(SAP) to P; rec START { choice at P { accept() from P; confirm() to P; } or { reject() from P; } or { propose(SAP) from P; choice at C { accept() to P; confirm() from P; } or { reject() to P; } or { propose(SAP) to P; continue START; } } }

slide-40
SLIDE 40

FSM generation (Negotiation Consumer)

20 / 42

slide-41
SLIDE 41
slide-42
SLIDE 42
slide-43
SLIDE 43

Dynamic Monitoring

[RV’13, COORDINATION’14, FMSD’15, LMCS’17, CC’17]

slide-44
SLIDE 44

Type Checking

[OOPSLA’15, ECOOP’16, ECOOP’17, COORDINATION’17]

slide-45
SLIDE 45

Code Generation

[CC’15, FASE’16, FASE’17]

slide-46
SLIDE 46

Synthesis

[ICALP’13, POPL’15, CONCUR’15, TACAS’16, CC’16]

slide-47
SLIDE 47
slide-48
SLIDE 48
slide-49
SLIDE 49
slide-50
SLIDE 50
slide-51
SLIDE 51
slide-52
SLIDE 52
slide-53
SLIDE 53

Scribble – Proving a distributed design

slide-54
SLIDE 54
slide-55
SLIDE 55

Background: session subtyping

(ESOP’99) (ESOP’09) (PPDP’14)

3

slide-56
SLIDE 56

Background: session subtyping

(ESOP’99) (ESOP’09) (PPDP’14)

3

slide-57
SLIDE 57

Background: session subtyping

(ESOP’99) (ESOP’09) (PPDP’14)

3

slide-58
SLIDE 58

Background: session subtyping

(ESOP’99) (ESOP’09) (PPDP’14)

3

slide-59
SLIDE 59
slide-60
SLIDE 60