SlideShare a Scribd company logo
1 of 24
Download to read offline
The Newest in
Session Types
Dr. Roland Kuhn
@rolandkuhn — Akka Tech Lead
The Problem
Which problem are we trying to solve?
• reasoning about distributed programs is hard
• finding the flaws is large systems is hard
• we need better tools to
• help us design the interaction of distributed components
• help us implement said components
3
Session Types
Definition
• Session: aunitofconversation
• Session Type: thestructureofaconversation,

a sequence of interactions in a communication-centric
program model
• originally only binary sessions, multiparty sessions
introduced 2008 by Kohei Honda
• primitives are

sending,receiving,sequence,choice,recursion
• http://groups.inf.ed.ac.uk/abcd/index.html
5
Scribble
• commonly used language for defining protocols
• defines the global protocol for all participants
• verifies the safety of the global protocol
• local projection for a single participant preserves safety
• automatic generation of FSA for local runtime validation
• type discipline for local processes requires support
for expressing linearity from the host language
• where that is unavailable use dynamic validation
6
An Example
• global protocol (a asks b to calculate «x/y»):

a→b: ⟨number⟩ . a→b: ⟨number⟩ .

b→a: { ok: b→a: ⟨number⟩ . end, fail: end }
• local projection for a:

[b]!⟨number⟩ . [b]!⟨number⟩ .

[b]?{ ok: [b]?⟨number⟩ . end, fail: end }
• local projection for b:

[a]?⟨number⟩ . [a]?⟨number⟩ .

[a]!{ ok: [a]!⟨number⟩ . end, fail: end }
7
Report from the ABCD group meeting
Glasgow, Sep 16 & 17, 2015
(in random order)
Talks I didn’t quite understand
• Ornela Dharda: Comparing deadlock free session typed
processes
• showing equivalence of different encodings in π-calculus
• Garrett Morris: Substructural types with class
• how to encode linearity in Haskell
• Dimitris Kouzapas: Characteristic bisimulation for
higher-order session types and Mungo: typechecking
protocols
• lots of typing rules and derivations
9
Julian Lange: Meeting Deadlines Together
• based on Communicating Timed Automata
• the idea is to enrich protocol descriptions with
timing information in order to allow reasoning
about whether a component can meet its SLA
• written in Haskell and using Z3 for constraint
solving, checking may take a long time (minutes)
10
Bernardo Toninho: Certifying data in
multiparty session types
• Be more precise about what is exchanged in the course of a protocol
• Primary tool is the use of singleton types / dependent types
• Singleton types are scoped to entities that have seen them, identical
values are not necessarily recognized as such without global
knowledge
• Projection of the global type needs to add all required local knowledge
(proofs) so that the recipient can make sense of the message
• Proofs may be compressible by using certificates or may even be
elided
• Erasure of proofs can be done within trusted systems, passing proofs
around allows separate compilation
11
Alceste Scalas: Towards type-safe sessions in
Scala
• encoding linear channels using Promise/Future
• abstracting over it using Channel type hierarchy
(Input, Output, End) with nice syntax sugar for
receiving and sending in a type-safe fashion,
including the handling of continuations
• distribution planned via Akka Typed actors
• multiple-use will raise exceptions, but cannot reject
non-use of a channel (i.e. omitting a required action)
12
Dominic Orchard: Session types for Cloud
Haskell
• local session types are projected to Haskell types
• graded monad: tracking effects of computation and defining a
combinator for how effects are composed:

(>>=) :: m s a -> (a -> m t b) -> m (Plus m s
t) b
• parameterized monad: i, j, k are pre/post-conditions

(>>=) :: m i j a -> (a -> m j k b) -> m i k b
• general idea is to track what a process does and then compare it to
what it should do
• horrible type errors due to user having to introduce fresh names
manually
13
Y.T.: Akka Typed—Opportunities for Session
Types
• lifting Actor behavior into a monadic representation
allows effect tracking
• either at runtime, within the interpreter for the monad
• or at compile-time, if graded monads are feasible
14
Simple Ticket Counter Example (Akka Typed)
15
case class Incr(replyTo: ActorRef[Count])
case class Count(n: Int)
def ticket(n: Int): ActorAction[Incr, Behavior[Incr]] =
for {
msg <- receive[Incr]
_ <- send(msg.replyTo, Count(n)).toActor
z <- ticket(n + 1)
} yield z
val counter = Action(ticket(0)) // Behavior[Incr]
val counterRef = ActorSystem("counter", Props(counter)) // ActorSystem[Incr]
How can we forget something?
16
trait Input
case class Intro(step1: ActorRef[Step1]) extends Input
case class Step1(replyTo: ActorRef[Step1Reply])
case class Step1Reply(step2: ActorRef[Step2]) extends Input
case class Step2()
def twoSteps: ActorAction[Input, Behavior[Input]] =
for {
Intro(step1) <- receive[Input]
self <- selfRef
_ <- send(step1, Step1(self)).toActor
Step1Reply(step2) <- receive[Input]
// what prevents usage of step1 here?
_ <- send(step2, Step2()).toActor
z <- twoSteps
} yield z
Roly Perera: Multiparty compatibility without
types
• the idea is that instead of projecting a global
protocol down to local ones we piece together local
sessions into a global protocol and check that one
• this saves the duplication in “implementing the
protocol in two languages”, but requires mocking
out participants for multi-team development
• can express certain types of recursion (if decidably
unfoldable)
17
Simon Fowler: Detecting and handling errors
in Monitored Session Erlang
• Multiparty Session Actors: actors fulfill roles that they declare
• Initiate a controller actor for a session
• Invite actors to fulfill roles
• Maintain mapping between roles and PIDs
• Message sends always go through monitor processes
• Encapsulating subsessions would be nice, in particular with
different reaction to success and failure, but this could be
problematic in the presence of network partitions.
• Inviting actors into subsessions is seen as very useful, both involving
internal as well as external participants. This is equivalent to
protocol refinement.
18
Florian Weber: POP3 with Scribble, StMungo
and Mungo
• Scribble formulation of the POP3 protocol
• StMungo translates local projection of that protocol
to Mungo (annotated Java) syntax
• Mungo aims at writing normal imperative code that
is annotated and verified instead of requiring the
use of a construct like graded monad or linear types
19
Dimitrios Kouzapas: ABCD use-case repository
• https://github.com/epsrc-abcd/session-types-use-
cases
• organization of collaboration so that new tools/
languages can be applied to existing use-cases for
validation and comparison to previous solutions
• this is a good place to start looking for examples when
trying to learn things—opening issues when things are
unclear is probably a good idea :-)
• additions of industry use-cases are welcome!
20
Summary
Summary
• Session types are demonstrably implementable
and applicable to real-world internet protocols
• The ABCD group is keen on practical validation of
the approach and industry feedback
• Largest barrier is deemed to be the expression of
linearity in host languages
22
My Largest Question: Compositionality
• Given an established Session Type, can we
formulate a set of rules or restriction for refining it
(adding to it) so that existing safety properties are
preserved?
23
©Typesafe 2015 – All Rights Reserved

More Related Content

What's hot

Streams, Streams Everywhere! An Introduction to Rx
Streams, Streams Everywhere! An Introduction to RxStreams, Streams Everywhere! An Introduction to Rx
Streams, Streams Everywhere! An Introduction to RxAndrzej Sitek
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaRick Warren
 
Winter is coming? Not if ZooKeeper is there!
Winter is coming? Not if ZooKeeper is there!Winter is coming? Not if ZooKeeper is there!
Winter is coming? Not if ZooKeeper is there!Joydeep Banik Roy
 
Reactive programming with RxJava
Reactive programming with RxJavaReactive programming with RxJava
Reactive programming with RxJavaJobaer Chowdhury
 
Reactive mistakes reactive nyc
Reactive mistakes   reactive nycReactive mistakes   reactive nyc
Reactive mistakes reactive nycPetr Zapletal
 
Self-managed and automatically reconfigurable stream processing
Self-managed and automatically reconfigurable stream processingSelf-managed and automatically reconfigurable stream processing
Self-managed and automatically reconfigurable stream processingVasia Kalavri
 
Reactive programming using rx java & akka actors - pdx-scala - june 2014
Reactive programming   using rx java & akka actors - pdx-scala - june 2014Reactive programming   using rx java & akka actors - pdx-scala - june 2014
Reactive programming using rx java & akka actors - pdx-scala - june 2014Thomas Lockney
 
Developing distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka ClusterDeveloping distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka ClusterKonstantin Tsykulenko
 
TDC2016SP - Trilha Node.Js
TDC2016SP - Trilha Node.JsTDC2016SP - Trilha Node.Js
TDC2016SP - Trilha Node.Jstdc-globalcode
 
Asynchronous stream processing with Akka Streams
Asynchronous stream processing with Akka StreamsAsynchronous stream processing with Akka Streams
Asynchronous stream processing with Akka StreamsJohan Andrén
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for AndroidTomáš Kypta
 
Reactive mistakes - ScalaDays Chicago 2017
Reactive mistakes -  ScalaDays Chicago 2017Reactive mistakes -  ScalaDays Chicago 2017
Reactive mistakes - ScalaDays Chicago 2017Petr Zapletal
 
How to Think in RxJava Before Reacting
How to Think in RxJava Before ReactingHow to Think in RxJava Before Reacting
How to Think in RxJava Before ReactingIndicThreads
 
Distributed Real-Time Stream Processing: Why and How 2.0
Distributed Real-Time Stream Processing:  Why and How 2.0Distributed Real-Time Stream Processing:  Why and How 2.0
Distributed Real-Time Stream Processing: Why and How 2.0Petr Zapletal
 
Reactive Programming and RxJS
Reactive Programming and RxJSReactive Programming and RxJS
Reactive Programming and RxJSDenis Gorbunov
 
RxJava - introduction & design
RxJava - introduction & designRxJava - introduction & design
RxJava - introduction & designallegro.tech
 
Reactive programming with Rxjava
Reactive programming with RxjavaReactive programming with Rxjava
Reactive programming with RxjavaChristophe Marchal
 
RxJava 2.0 介紹
RxJava 2.0 介紹RxJava 2.0 介紹
RxJava 2.0 介紹Kros Huang
 
Pulsar connector on flink 1.14
Pulsar connector on flink 1.14Pulsar connector on flink 1.14
Pulsar connector on flink 1.14宇帆 盛
 

What's hot (20)

Streams, Streams Everywhere! An Introduction to Rx
Streams, Streams Everywhere! An Introduction to RxStreams, Streams Everywhere! An Introduction to Rx
Streams, Streams Everywhere! An Introduction to Rx
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJava
 
Winter is coming? Not if ZooKeeper is there!
Winter is coming? Not if ZooKeeper is there!Winter is coming? Not if ZooKeeper is there!
Winter is coming? Not if ZooKeeper is there!
 
Reactive programming with RxJava
Reactive programming with RxJavaReactive programming with RxJava
Reactive programming with RxJava
 
Reactive mistakes reactive nyc
Reactive mistakes   reactive nycReactive mistakes   reactive nyc
Reactive mistakes reactive nyc
 
Self-managed and automatically reconfigurable stream processing
Self-managed and automatically reconfigurable stream processingSelf-managed and automatically reconfigurable stream processing
Self-managed and automatically reconfigurable stream processing
 
Reactive programming using rx java & akka actors - pdx-scala - june 2014
Reactive programming   using rx java & akka actors - pdx-scala - june 2014Reactive programming   using rx java & akka actors - pdx-scala - june 2014
Reactive programming using rx java & akka actors - pdx-scala - june 2014
 
Developing distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka ClusterDeveloping distributed applications with Akka and Akka Cluster
Developing distributed applications with Akka and Akka Cluster
 
TDC2016SP - Trilha Node.Js
TDC2016SP - Trilha Node.JsTDC2016SP - Trilha Node.Js
TDC2016SP - Trilha Node.Js
 
Asynchronous stream processing with Akka Streams
Asynchronous stream processing with Akka StreamsAsynchronous stream processing with Akka Streams
Asynchronous stream processing with Akka Streams
 
Practical RxJava for Android
Practical RxJava for AndroidPractical RxJava for Android
Practical RxJava for Android
 
Reactive mistakes - ScalaDays Chicago 2017
Reactive mistakes -  ScalaDays Chicago 2017Reactive mistakes -  ScalaDays Chicago 2017
Reactive mistakes - ScalaDays Chicago 2017
 
How to Think in RxJava Before Reacting
How to Think in RxJava Before ReactingHow to Think in RxJava Before Reacting
How to Think in RxJava Before Reacting
 
Distributed Real-Time Stream Processing: Why and How 2.0
Distributed Real-Time Stream Processing:  Why and How 2.0Distributed Real-Time Stream Processing:  Why and How 2.0
Distributed Real-Time Stream Processing: Why and How 2.0
 
Reactive Programming and RxJS
Reactive Programming and RxJSReactive Programming and RxJS
Reactive Programming and RxJS
 
Javantura v3 - Going Reactive with RxJava – Hrvoje Crnjak
Javantura v3 - Going Reactive with RxJava – Hrvoje CrnjakJavantura v3 - Going Reactive with RxJava – Hrvoje Crnjak
Javantura v3 - Going Reactive with RxJava – Hrvoje Crnjak
 
RxJava - introduction & design
RxJava - introduction & designRxJava - introduction & design
RxJava - introduction & design
 
Reactive programming with Rxjava
Reactive programming with RxjavaReactive programming with Rxjava
Reactive programming with Rxjava
 
RxJava 2.0 介紹
RxJava 2.0 介紹RxJava 2.0 介紹
RxJava 2.0 介紹
 
Pulsar connector on flink 1.14
Pulsar connector on flink 1.14Pulsar connector on flink 1.14
Pulsar connector on flink 1.14
 

Viewers also liked

Akka Typed — between Session Types and the Actor Model
Akka Typed — between Session Types and the Actor ModelAkka Typed — between Session Types and the Actor Model
Akka Typed — between Session Types and the Actor ModelRoland Kuhn
 
Project Gålbma – Actors vs Types
Project Gålbma – Actors vs TypesProject Gålbma – Actors vs Types
Project Gålbma – Actors vs TypesRoland Kuhn
 
Go Reactive: Blueprint for Future Applications
Go Reactive: Blueprint for Future ApplicationsGo Reactive: Blueprint for Future Applications
Go Reactive: Blueprint for Future ApplicationsRoland Kuhn
 
Relational Databases are Evolving To Support New Data Capabilities
Relational Databases are Evolving To Support New Data CapabilitiesRelational Databases are Evolving To Support New Data Capabilities
Relational Databases are Evolving To Support New Data CapabilitiesEDB
 
Scala Abide: A lint tool for Scala
Scala Abide: A lint tool for ScalaScala Abide: A lint tool for Scala
Scala Abide: A lint tool for ScalaIulian Dragos
 
Your Code is Wrong
Your Code is WrongYour Code is Wrong
Your Code is Wrongnathanmarz
 
Puppet at Google
Puppet at GooglePuppet at Google
Puppet at GooglePuppet
 
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...In-Memory Computing Summit
 
The Need for Async @ ScalaWorld
The Need for Async @ ScalaWorldThe Need for Async @ ScalaWorld
The Need for Async @ ScalaWorldKonrad Malawski
 
Akka cluster overview at 010dev
Akka cluster overview at 010devAkka cluster overview at 010dev
Akka cluster overview at 010devRoland Kuhn
 
Delivering Meaning In Near-Real Time At High Velocity In Massive Scale with A...
Delivering Meaning In Near-Real Time At High Velocity In Massive Scale with A...Delivering Meaning In Near-Real Time At High Velocity In Massive Scale with A...
Delivering Meaning In Near-Real Time At High Velocity In Massive Scale with A...Helena Edelson
 
Purely Functional Data Structures in Scala
Purely Functional Data Structures in ScalaPurely Functional Data Structures in Scala
Purely Functional Data Structures in ScalaVladimir Kostyukov
 
Akka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeAkka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeRoland Kuhn
 
NewSQL overview, Feb 2015
NewSQL overview, Feb 2015NewSQL overview, Feb 2015
NewSQL overview, Feb 2015Ivan Glushkov
 
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsGo Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsJonas Bonér
 
рататуй
рататуйрататуй
рататуйnem
 

Viewers also liked (20)

Akka Typed — between Session Types and the Actor Model
Akka Typed — between Session Types and the Actor ModelAkka Typed — between Session Types and the Actor Model
Akka Typed — between Session Types and the Actor Model
 
Project Gålbma – Actors vs Types
Project Gålbma – Actors vs TypesProject Gålbma – Actors vs Types
Project Gålbma – Actors vs Types
 
Go Reactive: Blueprint for Future Applications
Go Reactive: Blueprint for Future ApplicationsGo Reactive: Blueprint for Future Applications
Go Reactive: Blueprint for Future Applications
 
Relational Databases are Evolving To Support New Data Capabilities
Relational Databases are Evolving To Support New Data CapabilitiesRelational Databases are Evolving To Support New Data Capabilities
Relational Databases are Evolving To Support New Data Capabilities
 
Scala Abide: A lint tool for Scala
Scala Abide: A lint tool for ScalaScala Abide: A lint tool for Scala
Scala Abide: A lint tool for Scala
 
Your Code is Wrong
Your Code is WrongYour Code is Wrong
Your Code is Wrong
 
Puppet at Google
Puppet at GooglePuppet at Google
Puppet at Google
 
Why Spark?
Why Spark?Why Spark?
Why Spark?
 
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
IMCSummit 2015 - Day 2 IT Business Track - 4 Myths about In-Memory Databases ...
 
The Need for Async @ ScalaWorld
The Need for Async @ ScalaWorldThe Need for Async @ ScalaWorld
The Need for Async @ ScalaWorld
 
Akka cluster overview at 010dev
Akka cluster overview at 010devAkka cluster overview at 010dev
Akka cluster overview at 010dev
 
Delivering Meaning In Near-Real Time At High Velocity In Massive Scale with A...
Delivering Meaning In Near-Real Time At High Velocity In Massive Scale with A...Delivering Meaning In Near-Real Time At High Velocity In Massive Scale with A...
Delivering Meaning In Near-Real Time At High Velocity In Massive Scale with A...
 
Purely Functional Data Structures in Scala
Purely Functional Data Structures in ScalaPurely Functional Data Structures in Scala
Purely Functional Data Structures in Scala
 
Monadic Java
Monadic JavaMonadic Java
Monadic Java
 
Akka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in PracticeAkka and AngularJS – Reactive Applications in Practice
Akka and AngularJS – Reactive Applications in Practice
 
NewSQL overview, Feb 2015
NewSQL overview, Feb 2015NewSQL overview, Feb 2015
NewSQL overview, Feb 2015
 
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive SystemsGo Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
Go Reactive: Event-Driven, Scalable, Resilient & Responsive Systems
 
рататуй
рататуйрататуй
рататуй
 
Presentationv1
Presentationv1Presentationv1
Presentationv1
 
Culture at BazingaLabs
Culture at BazingaLabsCulture at BazingaLabs
Culture at BazingaLabs
 

Similar to The Newest in Session Types

Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesInductive Automation
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesInductive Automation
 
The Beam Vision for Portability: "Write once run anywhere"
The Beam Vision for Portability: "Write once run anywhere"The Beam Vision for Portability: "Write once run anywhere"
The Beam Vision for Portability: "Write once run anywhere"Knoldus Inc.
 
Real World Event Sourcing and CQRS
Real World Event Sourcing and CQRSReal World Event Sourcing and CQRS
Real World Event Sourcing and CQRSMatthew Hawkins
 
Foundational Design Patterns for Multi-Purpose Applications
Foundational Design Patterns for Multi-Purpose ApplicationsFoundational Design Patterns for Multi-Purpose Applications
Foundational Design Patterns for Multi-Purpose ApplicationsChing-Hwa Yu
 
The differing ways to monitor and instrument
The differing ways to monitor and instrumentThe differing ways to monitor and instrument
The differing ways to monitor and instrumentJonah Kowall
 
Summer training vhdl
Summer training vhdlSummer training vhdl
Summer training vhdlArshit Rai
 
Modern Distributed Messaging and RPC
Modern Distributed Messaging and RPCModern Distributed Messaging and RPC
Modern Distributed Messaging and RPCMax Alexejev
 
IBM Blockchain Platform - Architectural Good Practices v1.0
IBM Blockchain Platform - Architectural Good Practices v1.0IBM Blockchain Platform - Architectural Good Practices v1.0
IBM Blockchain Platform - Architectural Good Practices v1.0Matt Lucas
 
Summer training vhdl
Summer training vhdlSummer training vhdl
Summer training vhdlArshit Rai
 
Desired language characteristics – Data typing .pptx
Desired language characteristics – Data typing .pptxDesired language characteristics – Data typing .pptx
Desired language characteristics – Data typing .pptx4132lenin6497ram
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?GetInData
 
How Tencent Applies Apache Pulsar to Apache InLong —— A Streaming Data Integr...
How Tencent Applies Apache Pulsar to Apache InLong —— A Streaming Data Integr...How Tencent Applies Apache Pulsar to Apache InLong —— A Streaming Data Integr...
How Tencent Applies Apache Pulsar to Apache InLong —— A Streaming Data Integr...StreamNative
 
Smart Contracts That Learn
Smart Contracts That LearnSmart Contracts That Learn
Smart Contracts That LearnMike Slinn
 
Soma_Mishra_Resume
Soma_Mishra_ResumeSoma_Mishra_Resume
Soma_Mishra_Resumesoma mishra
 
Megha_Smriti_resume
Megha_Smriti_resumeMegha_Smriti_resume
Megha_Smriti_resumemegha smriti
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler ConstructionAhmed Raza
 

Similar to The Newest in Session Types (20)

Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
The Beam Vision for Portability: "Write once run anywhere"
The Beam Vision for Portability: "Write once run anywhere"The Beam Vision for Portability: "Write once run anywhere"
The Beam Vision for Portability: "Write once run anywhere"
 
Real World Event Sourcing and CQRS
Real World Event Sourcing and CQRSReal World Event Sourcing and CQRS
Real World Event Sourcing and CQRS
 
Foundational Design Patterns for Multi-Purpose Applications
Foundational Design Patterns for Multi-Purpose ApplicationsFoundational Design Patterns for Multi-Purpose Applications
Foundational Design Patterns for Multi-Purpose Applications
 
The differing ways to monitor and instrument
The differing ways to monitor and instrumentThe differing ways to monitor and instrument
The differing ways to monitor and instrument
 
Summer training vhdl
Summer training vhdlSummer training vhdl
Summer training vhdl
 
Modern Distributed Messaging and RPC
Modern Distributed Messaging and RPCModern Distributed Messaging and RPC
Modern Distributed Messaging and RPC
 
IBM Blockchain Platform - Architectural Good Practices v1.0
IBM Blockchain Platform - Architectural Good Practices v1.0IBM Blockchain Platform - Architectural Good Practices v1.0
IBM Blockchain Platform - Architectural Good Practices v1.0
 
Summer training vhdl
Summer training vhdlSummer training vhdl
Summer training vhdl
 
Desired language characteristics – Data typing .pptx
Desired language characteristics – Data typing .pptxDesired language characteristics – Data typing .pptx
Desired language characteristics – Data typing .pptx
 
Microservices.pdf
Microservices.pdfMicroservices.pdf
Microservices.pdf
 
Mannu_Kumar_CV
Mannu_Kumar_CVMannu_Kumar_CV
Mannu_Kumar_CV
 
Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?Hot to build continuously processing for 24/7 real-time data streaming platform?
Hot to build continuously processing for 24/7 real-time data streaming platform?
 
How Tencent Applies Apache Pulsar to Apache InLong —— A Streaming Data Integr...
How Tencent Applies Apache Pulsar to Apache InLong —— A Streaming Data Integr...How Tencent Applies Apache Pulsar to Apache InLong —— A Streaming Data Integr...
How Tencent Applies Apache Pulsar to Apache InLong —— A Streaming Data Integr...
 
Smart Contracts That Learn
Smart Contracts That LearnSmart Contracts That Learn
Smart Contracts That Learn
 
Resume
ResumeResume
Resume
 
Soma_Mishra_Resume
Soma_Mishra_ResumeSoma_Mishra_Resume
Soma_Mishra_Resume
 
Megha_Smriti_resume
Megha_Smriti_resumeMegha_Smriti_resume
Megha_Smriti_resume
 
Compiler Construction
Compiler ConstructionCompiler Construction
Compiler Construction
 

Recently uploaded

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialJoão Esperancinha
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...amber724300
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...itnewsafrica
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessWSO2
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 

Recently uploaded (20)

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Kuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorialKuma Meshes Part I - The basics - A tutorial
Kuma Meshes Part I - The basics - A tutorial
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
JET Technology Labs White Paper for Virtualized Security and Encryption Techn...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
Irene Moetsana-Moeng: Stakeholders in Cybersecurity: Collaborative Defence fo...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
Accelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with PlatformlessAccelerating Enterprise Software Engineering with Platformless
Accelerating Enterprise Software Engineering with Platformless
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 

The Newest in Session Types

  • 1. The Newest in Session Types Dr. Roland Kuhn @rolandkuhn — Akka Tech Lead
  • 3. Which problem are we trying to solve? • reasoning about distributed programs is hard • finding the flaws is large systems is hard • we need better tools to • help us design the interaction of distributed components • help us implement said components 3
  • 5. Definition • Session: aunitofconversation • Session Type: thestructureofaconversation,
 a sequence of interactions in a communication-centric program model • originally only binary sessions, multiparty sessions introduced 2008 by Kohei Honda • primitives are
 sending,receiving,sequence,choice,recursion • http://groups.inf.ed.ac.uk/abcd/index.html 5
  • 6. Scribble • commonly used language for defining protocols • defines the global protocol for all participants • verifies the safety of the global protocol • local projection for a single participant preserves safety • automatic generation of FSA for local runtime validation • type discipline for local processes requires support for expressing linearity from the host language • where that is unavailable use dynamic validation 6
  • 7. An Example • global protocol (a asks b to calculate «x/y»):
 a→b: ⟨number⟩ . a→b: ⟨number⟩ .
 b→a: { ok: b→a: ⟨number⟩ . end, fail: end } • local projection for a:
 [b]!⟨number⟩ . [b]!⟨number⟩ .
 [b]?{ ok: [b]?⟨number⟩ . end, fail: end } • local projection for b:
 [a]?⟨number⟩ . [a]?⟨number⟩ .
 [a]!{ ok: [a]!⟨number⟩ . end, fail: end } 7
  • 8. Report from the ABCD group meeting Glasgow, Sep 16 & 17, 2015 (in random order)
  • 9. Talks I didn’t quite understand • Ornela Dharda: Comparing deadlock free session typed processes • showing equivalence of different encodings in π-calculus • Garrett Morris: Substructural types with class • how to encode linearity in Haskell • Dimitris Kouzapas: Characteristic bisimulation for higher-order session types and Mungo: typechecking protocols • lots of typing rules and derivations 9
  • 10. Julian Lange: Meeting Deadlines Together • based on Communicating Timed Automata • the idea is to enrich protocol descriptions with timing information in order to allow reasoning about whether a component can meet its SLA • written in Haskell and using Z3 for constraint solving, checking may take a long time (minutes) 10
  • 11. Bernardo Toninho: Certifying data in multiparty session types • Be more precise about what is exchanged in the course of a protocol • Primary tool is the use of singleton types / dependent types • Singleton types are scoped to entities that have seen them, identical values are not necessarily recognized as such without global knowledge • Projection of the global type needs to add all required local knowledge (proofs) so that the recipient can make sense of the message • Proofs may be compressible by using certificates or may even be elided • Erasure of proofs can be done within trusted systems, passing proofs around allows separate compilation 11
  • 12. Alceste Scalas: Towards type-safe sessions in Scala • encoding linear channels using Promise/Future • abstracting over it using Channel type hierarchy (Input, Output, End) with nice syntax sugar for receiving and sending in a type-safe fashion, including the handling of continuations • distribution planned via Akka Typed actors • multiple-use will raise exceptions, but cannot reject non-use of a channel (i.e. omitting a required action) 12
  • 13. Dominic Orchard: Session types for Cloud Haskell • local session types are projected to Haskell types • graded monad: tracking effects of computation and defining a combinator for how effects are composed:
 (>>=) :: m s a -> (a -> m t b) -> m (Plus m s t) b • parameterized monad: i, j, k are pre/post-conditions
 (>>=) :: m i j a -> (a -> m j k b) -> m i k b • general idea is to track what a process does and then compare it to what it should do • horrible type errors due to user having to introduce fresh names manually 13
  • 14. Y.T.: Akka Typed—Opportunities for Session Types • lifting Actor behavior into a monadic representation allows effect tracking • either at runtime, within the interpreter for the monad • or at compile-time, if graded monads are feasible 14
  • 15. Simple Ticket Counter Example (Akka Typed) 15 case class Incr(replyTo: ActorRef[Count]) case class Count(n: Int) def ticket(n: Int): ActorAction[Incr, Behavior[Incr]] = for { msg <- receive[Incr] _ <- send(msg.replyTo, Count(n)).toActor z <- ticket(n + 1) } yield z val counter = Action(ticket(0)) // Behavior[Incr] val counterRef = ActorSystem("counter", Props(counter)) // ActorSystem[Incr]
  • 16. How can we forget something? 16 trait Input case class Intro(step1: ActorRef[Step1]) extends Input case class Step1(replyTo: ActorRef[Step1Reply]) case class Step1Reply(step2: ActorRef[Step2]) extends Input case class Step2() def twoSteps: ActorAction[Input, Behavior[Input]] = for { Intro(step1) <- receive[Input] self <- selfRef _ <- send(step1, Step1(self)).toActor Step1Reply(step2) <- receive[Input] // what prevents usage of step1 here? _ <- send(step2, Step2()).toActor z <- twoSteps } yield z
  • 17. Roly Perera: Multiparty compatibility without types • the idea is that instead of projecting a global protocol down to local ones we piece together local sessions into a global protocol and check that one • this saves the duplication in “implementing the protocol in two languages”, but requires mocking out participants for multi-team development • can express certain types of recursion (if decidably unfoldable) 17
  • 18. Simon Fowler: Detecting and handling errors in Monitored Session Erlang • Multiparty Session Actors: actors fulfill roles that they declare • Initiate a controller actor for a session • Invite actors to fulfill roles • Maintain mapping between roles and PIDs • Message sends always go through monitor processes • Encapsulating subsessions would be nice, in particular with different reaction to success and failure, but this could be problematic in the presence of network partitions. • Inviting actors into subsessions is seen as very useful, both involving internal as well as external participants. This is equivalent to protocol refinement. 18
  • 19. Florian Weber: POP3 with Scribble, StMungo and Mungo • Scribble formulation of the POP3 protocol • StMungo translates local projection of that protocol to Mungo (annotated Java) syntax • Mungo aims at writing normal imperative code that is annotated and verified instead of requiring the use of a construct like graded monad or linear types 19
  • 20. Dimitrios Kouzapas: ABCD use-case repository • https://github.com/epsrc-abcd/session-types-use- cases • organization of collaboration so that new tools/ languages can be applied to existing use-cases for validation and comparison to previous solutions • this is a good place to start looking for examples when trying to learn things—opening issues when things are unclear is probably a good idea :-) • additions of industry use-cases are welcome! 20
  • 22. Summary • Session types are demonstrably implementable and applicable to real-world internet protocols • The ABCD group is keen on practical validation of the approach and industry feedback • Largest barrier is deemed to be the expression of linearity in host languages 22
  • 23. My Largest Question: Compositionality • Given an established Session Type, can we formulate a set of rules or restriction for refining it (adding to it) so that existing safety properties are preserved? 23
  • 24. ©Typesafe 2015 – All Rights Reserved