ABCD Meeting, London, 17/12/2018 Asynchronous Timed Session Types & Processes Laura Bocchi University of Kent Maurizio Murgia University of Kent Vasco Thudichum Vasconcelos University of Lisbon Nobuko Yoshida Imperial College London 1
Agenda • Session types ♥ Time • Synchronous [Bartoletti,Cimoli&Murgia@FORTE’13] • Multiparty asynchronous [Bocchi,Yang,Yoshida@CONCUR’14] • restriction to types/protocols that could be used for type-checking • limitations to the expressiveness of the calculus • Today • Designing timed protocols : asynchronous timed duality • Checking timed programs : a time-sensitive calculus & typing system 2
Time & trouble • A timed protocol is not correct by definition S = ! 홸횗횝 .? 횂횝횛횒횗횐 S = ! 홸횗횝 ( x ≤ 3) . ? 횂횝횛횒횗횐 ( x ≤ 2) Usually this is handled by adding some conditions • feasibility [Bocchi, Yang, Yoshida@CONCUR’14], interaction-enabledness (CTA) [Bocchi, Lange, Yoshida@CONCUR’15], compliance [Bartoletti, Cimoli, Murgia@FORTE’16] formation + duality [Bocchi, Murgia, Yoshida, Vasconcelos’18] S = ! 홸횗횝 ( x ≤ 3) . ? 횂횝횛횒횗횐 ( x ≤ 3) 3
Duality & progress • Duality characterises well-behaved systems S = ! 홸횗횝 .? 횂횝횛횒횗횐 S = ? 홸횗횝 .! 횂횝횛횒횗횐 S = ! 홸횗횝 ( x ≤ 1, x ) . ? 횂횝횛횒횗횐 ( x ≤ 2) S = ? 홸횗횝 ( y ≤ 1, y ) . ! 횂횝횛횒횗횐 ( y ≤ 2) Synchronous Int String 0.4 S ∣ S ⟶ S ∣ S 2 ⟶ ? 횂횝횛횒횗횐 ( x ≤ 2) ∣ ! 횂횝횛횒횗횐 ( y ≤ 2) ⟶ ⟶ 4
Duality & progress • Duality characterises well-behaved systems S = ! 홸횗횝 .? 횂횝횛횒횗횐 S = ? 홸횗횝 .! 횂횝횛횒횗횐 S = ! 홸횗횝 ( x ≤ 1, x ) . ? 횂횝횛횒횗횐 ( x ≤ 2) S = ? 홸횗횝 ( y ≤ 1, y ) . ! 횂횝횛횒횗횐 ( y ≤ 2) Synchronous Int String 0.4 S ∣ S ⟶ S ∣ S 2 ⟶ ? 횂횝횛횒횗횐 ( x ≤ 2) ∣ ! 횂횝횛횒횗횐 ( y ≤ 2) ⟶ ⟶ Asynchronous 0.4 !Int S ∣ S ⟶ S ∣ S ⟶ ? 횂횝횛횒횗횐 ( x ≤ 2) ∣ ? 홸횗횝 ( y ≤ 1, y ) . ! 횂횝횛횒횗횐 ( y ≤ 2) !String ? 횂횝횛횒횗횐 ( x ≤ 2) ?Int 0.6 2 ⟶ ⟶ ? 횂횝횛횒횗횐 ( x ≤ 2) ∣ ! 횂횝횛횒횗횐 ( y ≤ 2) ⟶ ⟶ 0.4 0 0 2 1 2.6 0.6 0.4 0 0 x y
<latexit sha1_base64="T+BD+6QkOQZoI/4E8slcVqmOxIE=">ADUHiclVJNb9QwFHSyfJTw0S0cubyqlSkVZQUJLigVnCBW1HZtJmtXK8ztaq4wT7BTWK8hO59Mbv4MIBE6alna7IPVJlkczHr95luNcCoNB8M1xe7du37m7cs+7/+Dho9X+2uN9kxWa8RHLZKYPY2q4FIqPUKDkh7nmNI0lP4iP3zX6wReujcjUJyxzPknpXIlEMIqWmq45yR68gai9qNJ8VkdpAVFK8QgRsONjSdlxDT6sd0r1QWF9IRa83jyJP8M4fDk+RWPHw0Bts9de6iFmi8zbi3YIBpeyvQ3kLcRZXacZlq4SfDtfwYv2/4vhuWS4Ov/C17eKPi0Pwj8oC24DsIODEhXu9P+aTLWJFyhUxSY8ZhkOkohoFk7z2osLw3Lakcz62UNGUm0nVtq5hwzIzSDJtl0Jo2cuOiqbGlGlsTzYBzaLWkMu0cYHJ60klVF4gV+ysUVJIwAya3wUzoTlDWVpAmRY2K7AjqilD+wc9+wjh4sjXwf6WHwZ+PHlYOdt9xwr5Cl5RjZJSF6RHfKe7JIRYc5X57vz0/nlnro/3N895+yo2+3kCblSPe8PGL0Vg=</latexit> <latexit sha1_base64="T+BD+6QkOQZoI/4E8slcVqmOxIE=">ADUHiclVJNb9Q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VJIwAya3wUzoTlDWVpAmRY2K7AjqilD+wc9+wjh4sjXwf6WHwZ+PHlYOdt9xwr5Cl5RjZJSF6RHfKe7JIRYc5X57vz0/nlnro/3N895+yo2+3kCblSPe8PGL0Vg=</latexit> <latexit sha1_base64="T+BD+6QkOQZoI/4E8slcVqmOxIE=">ADUHiclVJNb9QwFHSyfJTw0S0cubyqlSkVZQUJLigVnCBW1HZtJmtXK8ztaq4wT7BTWK8hO59Mbv4MIBE6alna7IPVJlkczHr95luNcCoNB8M1xe7du37m7cs+7/+Dho9X+2uN9kxWa8RHLZKYPY2q4FIqPUKDkh7nmNI0lP4iP3zX6wReujcjUJyxzPknpXIlEMIqWmq45yR68gai9qNJ8VkdpAVFK8QgRsONjSdlxDT6sd0r1QWF9IRa83jyJP8M4fDk+RWPHw0Bts9de6iFmi8zbi3YIBpeyvQ3kLcRZXacZlq4SfDtfwYv2/4vhuWS4Ov/C17eKPi0Pwj8oC24DsIODEhXu9P+aTLWJFyhUxSY8ZhkOkohoFk7z2osLw3Lakcz62UNGUm0nVtq5hwzIzSDJtl0Jo2cuOiqbGlGlsTzYBzaLWkMu0cYHJ60klVF4gV+ysUVJIwAya3wUzoTlDWVpAmRY2K7AjqilD+wc9+wjh4sjXwf6WHwZ+PHlYOdt9xwr5Cl5RjZJSF6RHfKe7JIRYc5X57vz0/nlnro/3N895+yo2+3kCblSPe8PGL0Vg=</latexit> Receive & asynchrony (1/2) S = µ t . ! Int ( x ≤ 1 , x ) . ? String ( x ≤ 2) . t 1 func S (a chan<- int, b <-chan string, start time.Time){ for { time.Sleep(400 * time.Millisecond) t := time.Now() a<-10 fmt.Printf("sent int 10 at time %s\n", t.Sub(start)) select{ case c:=<-b : t := time.Now() fmt.Printf("received string %s at time %s\n", c, t.Sub(start)) case <-time.After(2 * time.Second) : fmt.Println("S Failed! String not received within deadline") } } } 6
<latexit sha1_base64="Fm7wJ8H+ZwgtQVqyUSRODw/Nc8=">ADUHiclVJNb9QwFHSyfJTwtYU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dzT/iAKo0XBVRB3YEC62pv2z+gs52UmNHLFrB3HUYGTmhmUXIkmoKUVhWvJ5mLsoGaZsJN60bqBTcfMIM2NWxphwV501CyztsoSd7INaJe1lyljUtMX05qYsShebnjdJSAebQ/i6YSM4qsoBxo10WYEfM8M4uj8YuEeIl0e+Cg62wzgK4/fPB7uvu+dYI0/IU7JFYvKC7JK3ZI+MCPc+e1+9794P/8z/5v/sedH/W4nj8ml6gW/AOyxFYA=</latexit> Receive & asynchrony (2/2) S = µ t . ? Int ( y ≤ 1 , y ) . ! String ( y ≤ 2) . t func Sd (a <-chan int, b chan<- string, start time.Time){ for{ select{ case c:=<-a : t := time.Now() fmt.Printf("received int %d at time %s\n", c, t.Sub(start)) case <-time.After(1 * time.Second) : fmt.Println("Sd Failed! …”) } time.Sleep(600 * time.Millisecond) t := time.Now() b<-"hello!" fmt.Printf("sent 'hello!' at time %s\n", t.Sub(start)) } } 7 https://play.golang.org/p/pagByVB4Gtd
Urgent receive semantics • Urgent receive semantics: messages are received as soon as • they are in a channel, and • the time constraint of the receiver is satisfied Urgent receive semantics yields executions that are • are a bit more synchronous … • … but as asynchronous as when using (common) receive primitives • !Int 0.4 S ∣ S ⟶ S ∣ S ⟶ ? 횂횝횛횒횗횐 ( x ≤ 2) ∣ ? 홸횗횝 ( y ≤ 1, y ) . ! 횂횝횛횒횗횐 ( y ≤ 2) ?Int !String 0.6 2 ? 횂횝횛횒횗횐 ( x ≤ 2) ⟶ ⟶ ? 횂횝횛횒횗횐 ( x ≤ 2) ∣ ! 횂횝횛횒횗횐 ( y ≤ 2) ⟶ ⟶ 0 0.4 0 y x 8
Recommend
More recommend