This Article 
 Bibliographic References 
 Add to: 
Teapot: A Domain-Specific Language for Writing Cache Coherence Protocols
May/June 1999 (vol. 25 no. 3)
pp. 317-333

Abstract—In this paper, we describe Teapot, a domain-specific language for writing cache coherence protocols. Cache coherence is of concern when parallel and distributed systems make local replicas of shared data to improve scalability and performance. In both distributed shared memory systems and distributed file systems, a coherence protocol maintains agreement among the replicated copies as the underlying data are modified by programs running on the system. Cache coherence protocols are notoriously difficult to implement, debug, and maintain. Moreover, protocols are not off-the-shelf, reusable components, because their details depend on the requirements of the system under consideration. The complexity of engineering coherence protocols can discourage users from experimenting with new, potentially more efficient protocols. We have designed and implemented Teapot, a domain-specific language that attempts to address this complexity. Teapot's language constructs, such as a state-centric control structure and continuations, are better suited to expressing protocol code than those of a typical systems programming language. Teapot also facilitates automatic verification of protocols, so hard to find protocol bugs, such as deadlocks, can be detected and fixed before encountering them on an actual execution. We describe the design rationale of Teapot, present an empirical evaluation of the language using two case studies, and relate the lessons that we learned in building a domain-specific language for systems programming.

[1] J.B. Carter, J.K. Bennett, and W. Zwaenepoel, "Implementation and Performance of Munin," Proc. 13th ACM SIGOPS Symp. Operating Systems Principles, pp. 152-164,Pacific Grove, Calif., Oct. 1991.
[2] K.L. Johnson, M.F. Kaashoek, and D.A. Wallach, "CRL: High-Performance All-Software Distributed Shared Memory," Proc. 15th Symp. Operating Systems Principles, ACM Press, New York, 1995, pp. 213-228.
[3] M. Dahlin et al., “Cooperative Caching: Using Remote Client Memory to Improve File System Performance,” Proc. First Symp. Operating Systems Design and Implementation, pp. 267–280, Nov. 1994.
[4] M.N. Nelson, B.B. Welch, and J.K. Ousterhout, "Caching in the Sprite File System," ACM Trans. Computer Systems, vol. 6, no. 1, pp. 134-154, Feb. 1988.
[5] M.J. Franklin, M.J. Carey, and M. Livny, “Transactional Client-Server Cache Consistency: Alternatives and Performance,” ACM Trans. Database Systems, vol. 22, no. 3, pp. 315-363, Sept. 1997.
[6] C. Liu and P. Cao, "Maintaining Strong Cache Consistency in the World-Wide Web," Proc. Int'l Conf. Distributed Computing Systems, 1997.
[7] K. Gharachorloo, D. Lenoski, J. Laudon, P. Gibbons, A. Gupta, and J. Hennessy, “Memory Consistency and Event Ordering in Scalable Shared-Memory Multiprocessors,” Proc. 17th Ann. Int'l Symp. Computer Architecture, 1990.
[8] A.J. Dill, D.L. Drexler, A.J. Hu, and C.H. Yang, “Protocol Verification as a Hardware Design Aid,” Proc. IEEE Int'l Conf. Computer Design: VLSI in Computers and Processors, 1992.
[9] J.R. Larus, B. Richards, and G. Viswanathan, “LCM: Memory System Support for Parallel Language Implementation,” Proc. Sixth Int'l Conf. Architectural Support for Programming Languages and Operating Systems, pp. 208–218, San Jose, Calif., 1994.
[10] T. Anderson, M. Dahlin, J. Neefe, D. Patterson, D. Roselli, and R. Wang, “Serverless Network File Systems,” ACM Trans. Computer Systems, pp. 41-79, Jan. 1996.
[11] T. von Eicken et al., “Active Messages: A Mechanism for Integrated Communication and Computation,” Proc. 19th Int’l Symp. Computer Architecture, Assoc. of Computing Machinery, N.Y., May 1992, pp. 256-266.
[12] M. Wand, “Continuation-Based Multiprocessing,” Conf. Record LISP Conf., Stanford Univ., Palo Alto Calif., pp. 19-28, 1980.
[13] S.K. Reinhardt, J.R. Larus, and D.A. Wood, “Tempest and Typhoon: User-Level Shared Memory,” Proc. 21st Int'l Symp. Computer Architecture, pp. 325-337, Apr. 1994.
[14] D. Lenoski et al., “The Stanford DASH Multiprocessor,” Computer, pp. 63-79, Mar. 1992.
[15] S. Chandra, B. Richards, and J.R. Larus, "Teapot: Language Support for Writing Memory Coherence Protocols," Proc. SIGPLAN Conf. Programming Language Design and Implementation, May 1996.
[16] I. Schoinas, B. Falsafi, A.R. Lebeck, S.K. Reinhardt, J.R. Larus, and D.A. Wood, “Fine-Grain Access Control for Distributed Shared Memory,” Proc. Sixth Int'l Conf. Architectural Support for Programming Languages and Operating Systems (ASPLOS '94), pp. 297-306, Oct. 1994.
[17] S. Chandra et al., “Experience with a Language for Writing Coherence Protocols,” USENIX Conf. Domain-Specific Languages, Santa Barbara, Calif., 1997.
[18] J.R. Larus, B. Richards, and G. Viswanathan, “Parallel Programming in C**: A Large-Grain Data-Parallel Programming Language,” Parallel Programming Using C++, G.V.W.a.P. Lu, ed., pp. 297-342, 1996.
[19] K. Birman, A. Schiper, and P. Stephenson, “Lightweight Causal and Atomic Group Multicast,” ACM Trans. Computer Systems, vol. 9, no. 3, pp. 272-314, Aug. 1991.
[20] D.R. Cheriton and D. Skeen, "Understanding the Limitations of Causally and Totally Ordered Communications," Operating Systems Rev., Dec. 1993, pp. 44-57.
[21] K. Uehara et al., “A Framework for Customizing Coherence Protocols of Distributed File Caches in Lucas File System,” pp. 94-114, 1994.
[22] G.e. Berry and G. Gonthier, “The ESTEREL Synchronous Programming Language: Design, Semantics, Implementation,”
[23] D. Harel, “Statecharts: A Visual Approach to Complex Systems,” Science of Computer Programming, Vol. 8, No. 3, pp. 231–274, 1987.
[24] J.M. Wing and M. Vaziri-Farahani, “Model Checking Software Systems: A Case Study,” Proc. ACM SIGSOFT Symp. Foundations of Software Eng., 1995.
[25] M.W. Bailey and J.W. Davidson, A Formal Model and Specification Language for Procedure Calling Conventions Proc. ACM SIGPLAN-SIGACT Symp. Principles of Programming Languages, pp. 298-310, Jan. 1995.
[26] N. Ramsey and M.F. Fernandez, “The New Jersey Machine-Code Toolkit,” 1995 Usenix Technical Conf., pp. 289–302, New Orleans, 1995.
[27] T.A. Proebsting and S.A. Watterson, “Filter Fusion,” Conf. Record POPL'96: 23rd ACM SIGPLAN-SIGACT Symp. Principles of Programming Languages, 1996.
[28] E. Eide, K. Frei, B. Ford, J. Lepreau, and G. Lindstrom, "Flick: A Flexible, Optimizing IDL Compiler," Proc. ACM SIGPLAN '97 Conf. Programming Language Design and Implementation (PLDI),Las Vegas, Nev., June 1997.
[29] J.K. Ousterhout, Why Threads Are a Bad Idea, 1995.

Index Terms:
Domain-specific languages, distributed systems, cache coherence, continuations, verification.
Satish Chandra, Bradley Richards, James R. Larus, "Teapot: A Domain-Specific Language for Writing Cache Coherence Protocols," IEEE Transactions on Software Engineering, vol. 25, no. 3, pp. 317-333, May-June 1999, doi:10.1109/32.798322
Usage of this product signifies your acceptance of the Terms of Use.