A Views: Synthesizing Fine-Grained Concurrency Control BRIAN DEMSKY, University of California, Irvine PATRICK LAM, University of Waterloo Fine-grained locking is often necessary to increase concurrency. Correctly implementing fine-grained lock- ing with today’s concurrency primitives can be challenging—race conditions often plague programs with sophisticated locking schemes. We present views, a new approach to concurrency control. Views ease the task of implementing sophis- ticated locking schemes and provide static checks to automatically detect many data races. A view of an object declares a partial interface, consisting of fields and methods, to the object that the view protects. A view also contains an incompatibility declaration, which lists views that may not be simultaneously held by other threads. A set of view annotations specify which code regions hold a view of an object. Our view compiler performs simple static checks which identify many data races. We pair the basic approach with an inference algorithm that can infer view incompatibility specifications for many applications. We have ported four benchmark applications to use views: portions of Vuze, a BitTorrent client; Mailpuc- cino, a graphical e-mail client; jphonelite, a VoIP softphone implementation; and TupleSoup, a database. Our experience indicates that views are easy to use, make implementing sophisticated locking schemes sim- ple, and can help eliminate concurrency bugs. We have evaluated the performance of a view implementation of a red-black tree and found that views can significantly improve performance over that of the lock-based implementation. Categories and Subject Descriptors: D.3.3 [Programming Languages]: Language Constructs and Fea- tures—Concurrent programming structures; D.1.3 [Programming Techniques]: Concurrent Program- ming—Parallel programming; D.2.4 [Software Engineering]: Software/Program Verification—Reliability General Terms: Languages, Design, Reliability Additional Key Words and Phrases: concurrency, language design, static verification ACM Reference Format: Demsky, B., Lam, P. 2012. Views: Synthesizing fine-grained concurrency control. ACM Trans. Softw. Eng. Methodol. V, N, Article A (January YYYY), 36 pages. DOI = 10.1145/0000000.0000000 http://doi.acm.org/10.1145/0000000.0000000 1. INTRODUCTION The increasing availability of multi-core processors has prompted a resurgence of in- terest in parallel software. To work properly, parallel software must use concurrency control mechanisms to ensure that multiple threads of execution do not interfere with each other. Without sufficient concurrency control, race conditions occur, causing un- desired and potentially incorrect program behaviors. The dominant concurrency control mechanism today is the lock. Developers must manually acquire an appropriate lock before accessing a shared resource and release This is a revised and extended version of a paper presented at ICSE 2010 in Cape Town, South Africa. This research was partially supported by the National Science Foundation under grants CCF-0846195 and CCF-0725350. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies show this notice on the first page or initial screen of a display along with the full citation. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is per- mitted. To copy otherwise, to republish, to post on servers, to redistribute to lists, or to use any component of this work in other works requires prior specific permission and/or a fee. Permissions may be requested from Publications Dept., ACM, Inc., 2 Penn Plaza, Suite 701, New York, NY 10121-0701 USA, fax +1 (212) 869-0481, or permissions@acm.org. c YYYY ACM 1049-331X/YYYY/01-ARTA $10.00 DOI 10.1145/0000000.0000000 http://doi.acm.org/10.1145/0000000.0000000 ACM Transactions on Software Engineering and Methodology, Vol. V, No. N, Article A, Pub. date: January YYYY.