Fencing off Go: Liveness and Safety for Channel-Based Programming

被引:43
作者
Lange, Julien [1 ]
Ng, Nicholas [1 ]
Toninho, Bernardo [1 ]
Yoshida, Nobuko [1 ]
机构
[1] Imperial Coll London, London, England
基金
英国工程与自然科学研究理事会;
关键词
Channel-based programming; Message-passing programming; Process calculus; Types; Safety and Liveness; Compiletime (static) deadlock detection; SESSION TYPES; PROGRESS; SYSTEM;
D O I
10.1145/3093333.3009847
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Go is a production-level statically typed programming language whose design features explicit message-passing primitives and lightweight threads, enabling (and encouraging) programmers to develop concurrent systems where components interact through communication more so than by lock-based shared memory concurrency. Go can only detect global deadlocks at runtime, but provides no compile-time protection against all too common communication mismatches or partial deadlocks. This work develops a static verification framework for bounded liveness and safety in Go programs, able to detect communication errors and partial deadlocks in a general class of realistic concurrent programs, including those with dynamic channel creation and infinite recursion. Our approach infers from a Go program a faithful representation of its communication patterns as a behavioural type. By checking a syntactic restriction on channel usage, dubbed fencing, we ensure that programs are made up of finitely many different communication patterns that may be repeated infinitely many times. This restriction allows us to implement bounded verification procedures (akin to bounded model checking) to check for liveness and safety in types which in turn approximates liveness and safety in Go programs. We have implemented a type inference and liveness and safety checks in a tool-chain and tested it against publicly available Go programs.
引用
收藏
页码:748 / 761
页数:14
相关论文
共 49 条
[1]  
Agababov V., 2015, NSDI
[2]  
Ajamni Sameer, 2013, ADV GO CONCURRENCY P
[3]  
Ajmani Sameer, 2014, GO CONCURRENCY PATTE
[4]  
Anderson D. G., 2013, EXPERIENCE EPAXOS SY
[5]   ON COMMUNICATING FINITE-STATE MACHINES [J].
BRAND, D ;
ZAFIROPULO, P .
JOURNAL OF THE ACM, 1983, 30 (02) :323-342
[6]  
Busi N, 2004, LECT NOTES COMPUT SC, V3142, P307
[7]  
Busi N, 2003, LECT NOTES COMPUT SC, V2719, P133
[8]   Linear logic propositions as session types [J].
Caires, Luis ;
Pfenning, Frank ;
Toninho, Bernardo .
MATHEMATICAL STRUCTURES IN COMPUTER SCIENCE, 2016, 26 (03) :367-423
[9]  
Caires L, 2010, LECT NOTES COMPUT SC, V6269, P222, DOI 10.1007/978-3-642-15375-4_16
[10]  
Carbone M, 2014, LECT NOTES COMPUT SC, V8459, P49, DOI 10.1007/978-3-662-43376-8_4