P: Safe Asynchronous Event-Driven Programming

被引:83
作者
Desai, Ankush [1 ]
Gupta, Vivek [1 ]
Jackson, Ethan [1 ]
Qadeer, Shaz [1 ]
Rajamani, Sriram [1 ]
Zufferey, Damien
机构
[1] Microsoft Corp, Redmond, WA 98052 USA
关键词
domain-specific language; device driver; event-driven programming; state machine; verification; systematic testing; LANGUAGE; STATECHARTS; SEMANTICS;
D O I
10.1145/2499370.2462184
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
We describe the design and implementation of P, a domain-specific language to write asynchronous event driven code. P allows the programmer to specify the system as a collection of interacting state machines, which communicate with each other using events. P unifies modeling and programming into one activity for the programmer. Not only can a P program be compiled into executable code, but it can also be tested using model checking techniques. P allows the programmer to specify the environment, used to "close" the system during testing, as nondeterministic ghost machines. Ghost machines are erased during compilation to executable code; a type system ensures that the erasure is semantics preserving. The P language is designed so that a P program can be checked for responsiveness-the ability to handle every event in a timely manner. By default, a machine needs to handle every event that arrives in every state. But handling every event in every state is impractical. The language provides a notion of deferred events where the programmer can annotate when she wants to delay processing an event. The default safety checker looks for presence of unhandled events. The language also provides default liveness checks that an event cannot be potentially deferred forever. P was used to implement and verify the core of the USB device driver stack that ships with Microsoft Windows 8. The resulting driver is more reliable and performs better than its prior incarnation (which did not use P); we have more confidence in the robustness of its design due to the language abstractions and verification provided by P.
引用
收藏
页码:321 / 331
页数:11
相关论文
共 19 条
[1]  
Adya A, 2002, USENIX ASSOCIATION PROCEEDINGS OF THE GENERAL TRACK, P289
[2]  
Andrews T, 2004, LECT NOTES COMPUT SC, V3114, P484
[3]   SYNCHRONOUS PROGRAMMING WITH EVENTS AND RELATIONS - THE SIGNAL LANGUAGE AND ITS SEMANTICS [J].
BENVENISTE, A ;
LEGUERNIC, P ;
JACQUEMOT, C .
SCIENCE OF COMPUTER PROGRAMMING, 1991, 16 (02) :103-149
[4]   THE ESTEREL SYNCHRONOUS PROGRAMMING LANGUAGE - DESIGN, SEMANTICS, IMPLEMENTATION [J].
BERRY, G ;
GONTHIER, G .
SCIENCE OF COMPUTER PROGRAMMING, 1992, 19 (02) :87-152
[5]   Teapot: A domain-specific language for writing cache coherence protocols [J].
Chandra, S ;
Richards, B ;
Larus, JR .
IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 1999, 25 (03) :317-333
[6]   Delay-Bounded Scheduling [J].
Emmi, Michael ;
Qadeer, Shaz ;
Rakamaric, Zvonimir .
ACM SIGPLAN NOTICES, 2011, 46 (01) :411-422
[7]   A type and effect system for atomicity [J].
Flanagan, C ;
Qadeer, S .
ACM SIGPLAN NOTICES, 2003, 38 (05) :338-349
[8]  
Fournet C., 1996, Conference Record of POPL '96: The 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, P372, DOI 10.1145/237721.237805
[9]  
Godefroid P., 1997, Conference Record of POPL '97: The 24th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, P174, DOI 10.1145/263699.263717
[10]   THE SYNCHRONOUS DATA FLOW PROGRAMMING LANGUAGE LUSTER [J].
HALBWACHS, N ;
CASPI, P ;
RAYMOND, P ;
PILAUD, D .
PROCEEDINGS OF THE IEEE, 1991, 79 (09) :1305-1320