skip to main content
research-article

Lightweight annotations for controlling sharing in concurrent data structures

Published: 15 June 2009 Publication History

Abstract

SharC is a recently developed system for checking data-sharing in multithreaded programs. Programmers specify sharing rules (read-only, protected by a lock, etc.) for individual objects, and the SharC compiler enforces these rules using static and dynamic checks. Violations of these rules indicate unintended data sharing, which is the underlying cause of harmful data-races. Additionally, SharC allows programmers to change the sharing rules for a specific object using a sharing cast, to capture the fact that sharing rules for an object often change during the object's lifetime. SharC was successfully applied to a number of multi-threaded C programs.
However, many programs are not readily checkable using SharC because their sharing rules, and changes to sharing rules, effectively apply to whole data structures rather than to individual objects. We have developed a system called Shoal to address this shortcoming. In addition to the sharing rules and sharing cast of SharC, our system includes a new concept that we call groups. A group is a collection of objects all having the same sharing mode. Each group has a distinguished member called the group leader. When the sharing mode of the group leader changes by way of a sharing cast, the sharing mode of all members of the group also changes. This operation is made sound by maintaining the invariant that at the point of a sharing cast, the only external pointer into the group is the pointer to the group leader. The addition of groups allows checking safe concurrency at the level of data structures rather than at the level of individual objects.
We demonstrate the necessity and practicality of groups by applying Shoal to a wide range of concurrent C programs (the largest approaching a million lines of code). In all benchmarks groups entail low annotation burden and no significant additional performance overhead.

References

[1]
Anderson, Z., Gay, D., Ennals, R., and Brewer, E. SharC: checking data sharing strategies for multithreaded C. In PLDI'08, pp. 149--158.
[2]
Anderson, Z., Gay, D., and Naik, M. Lightweight annotations for controlling sharing in concurrent data structures. Tech. Rep. UCB/EECS--2009--44, EECS Department, University of California, Berkeley, Mar 2009.
[3]
Barnes, J., and Hut, P. A hierarchical O(N log N) force-calculation algorithm. Nature 324 (Dec. 1986), 446--449.
[4]
Boyapati, C. SafeJava: A Unified Type System for Safe Programming. PhD thesis, MIT.
[5]
Boyapati, C., Lee, R., and Rinard, M. Ownership types for safe programming: preventing data races and deadlocks. In OOPSLA'02, pp. 211--230.
[6]
Boyapati, C., Liskov, B., and Shrira, L. Ownership types for object encapsulation. In OOPSLA'03, pp. 213--223.
[7]
Boyapati, C., Salcianu, A., Beebee, Jr., W., and Rinard, M. Ownership types for safe region--based memory management in Real-Time Java. In PLDI'03, pp.324--337.
[8]
Choi, J.-D., Lee, K., Loginov, A., O'Callahan, R., Sarkar, V., and Sridharan, M. Efficient and precise datarace detection for multithreaded object-oriented programs. In PLDI'02, pp. 258--269.
[9]
Condit, J., Harren, M., Anderson, Z., Gay, D., and Necula, G. Dependent types for low-level programming. In ESOP'07.
[10]
Crary, K., Walker, D., and Morrisett, G. Typed memory management in a calculus of capabilities. In POPL'99, pp. 262--275.
[11]
developers.sun.com. LockLint -- static data race and deadlock detection tool for C. http://developers.sun.com/solaris/articles/locklint.html.
[12]
Elmas, T., Qadeer, S., and Tasiran, S. Goldilocks: a race and transaction-aware Java runtime. In PLDI'07, pp. 245--255.
[13]
Engler, D., and Ashcraft, K. RacerX: effective, static detection of race conditions and deadlocks. In SOSP'03, pp. 237--252.
[14]
Flanagan, C., and Freund, S. N. Atomizer: a dynamic atomicity checker for multithreaded programs. In POPL'04, pp. 256--267.
[15]
Flanagan, C., Freund, S. N., and Lifshin, M. Type inference for atomicity. In TLDI'05, pp. 47--58.
[16]
Gay, D., and Aiken, A. Language support for regions. In PLDI'01, pp. 70--80.
[17]
Greenhouse, A., Halloran, T. J., and Scherlis, W. L. Observations on the assured evolution of concurrent Java programs. Sci. Comput. Program. 58, 3 (2005), 384--411.
[18]
Grossman, D. Type-safe multithreading in Cyclone. In TLDI'03.
[19]
Krishnamurthy, A., Culler, D. E., Dusseau, A., Goldstein, S. C., Lumetta, S., von Eicken, T., and Yelick, K. Parallel Programming in Split-C. In SUPERCOM'93, pp. 262--273.
[20]
McCloskey, B., Zhou, F., Gay, D., and Brewer, E. Autolocker: synchronization inference for atomic sections. In POPL'06, pp. 346--358.
[21]
Naik, M., and Aiken, A. Conditional must not aliasing for static race detection. In PLDI'07, pp. 327--338.
[22]
Necula, G. C., McPeak, S., and Weimer, W. CIL: Intermediate language and tools for the analysis of C programs. In CC'04, pp. 213--228. http://cil.sourceforge.net/.
[23]
Pratikakis, P., Foster, J. S., and Hicks, M. Locksmith: context-sensitive correlation analysis for race detection. In PLDI'06, pp. 320--331.
[24]
Rayside, D., Mendel, L., and Jackson, D. A dynamic analysis for revealing object ownership and sharing. In WODA'06, pp. 57--64.
[25]
Sasturkar, A., Agarwal, R., Wang, L., and Stoller, S. D. Automated type-based analysis of data races and atomicity. In PPoPP'05, pp. 83--94.
[26]
Savage, S., Burrows, M., Nelson, G., Sobalvarro, P., and Anderson, T. Eraser: a dynamic data race detector for multi-threaded programs. In SOSP'97, pp. 27--37.
[27]
Schmidt, D., and Harrison, T. Double-Checked Locking. In Chapter 20 of Pattern Languages of Program Design 3, Addison-Wesley, ISBN 0201310112.
[28]
Terauchi, T. Checking race freedom via linear programming. In PLDI'08, pp.1--10.
[29]
Tofte, M., and Talpin, J.-P. Region-based memory management.
[30]
In Information and Computation (1977), vol. 132, pp. 109--176.
[31]
von Behren, R., Condit, J., Zhou, F., Necula, G. C., and Brewer, E. Capriccio: scalable threads for internet services. In SOSP'03, pp. 268--281.
[32]
Voung, J. W., Jhala, R., and Lerner, S. RELAY: static race detection on millions of lines of code. In ESEC-FSE'07, pp. 205--214.
[33]
Woo, S. C., Ohara, M., Torrie, E., Shingh, J. P., and Gupta, A. The SPLASH-2 Programs: Characterization and Methodological Considerations. In ISCA'95, pp. 24--36.
[34]
Yu, Y., Rodeheffer, T., and Chen, W. Racetrack: efficient detection of data race conditions via adaptive tracking. In SOSP'05, pp. 221--234.

Cited By

View all
  • (2024)SSRD: Shapes and Summaries for Race Detection in Concurrent Data StructuresProceedings of the 2024 ACM SIGPLAN International Symposium on Memory Management10.1145/3652024.3665505(68-81)Online publication date: 20-Jun-2024
  • (2013)Ownership Types: A SurveyAliasing in Object-Oriented Programming. Types, Analysis and Verification10.1007/978-3-642-36946-9_3(15-58)Online publication date: 2013
  • (2010)Cache topology aware computation mapping for multicoresACM SIGPLAN Notices10.1145/1809028.180660545:6(74-85)Online publication date: 5-Jun-2010
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 44, Issue 6
PLDI '09
June 2009
478 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/1543135
Issue’s Table of Contents
  • cover image ACM Conferences
    PLDI '09: Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation
    June 2009
    492 pages
    ISBN:9781605583921
    DOI:10.1145/1542476
Permission to make digital or hard copies of all or part 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 bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 15 June 2009
Published in SIGPLAN Volume 44, Issue 6

Check for updates

Author Tags

  1. concurrent programming
  2. data races
  3. multithreaded programming

Qualifiers

  • Research-article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)6
  • Downloads (Last 6 weeks)1
Reflects downloads up to 05 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2024)SSRD: Shapes and Summaries for Race Detection in Concurrent Data StructuresProceedings of the 2024 ACM SIGPLAN International Symposium on Memory Management10.1145/3652024.3665505(68-81)Online publication date: 20-Jun-2024
  • (2013)Ownership Types: A SurveyAliasing in Object-Oriented Programming. Types, Analysis and Verification10.1007/978-3-642-36946-9_3(15-58)Online publication date: 2013
  • (2010)Cache topology aware computation mapping for multicoresACM SIGPLAN Notices10.1145/1809028.180660545:6(74-85)Online publication date: 5-Jun-2010
  • (2010)Cache topology aware computation mapping for multicoresProceedings of the 31st ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/1806596.1806605(74-85)Online publication date: 5-Jun-2010
  • (2010)Restructuring parallel loops to curb false sharing on multicore architectures2010 IEEE International Symposium on Parallel & Distributed Processing, Workshops and Phd Forum (IPDPSW)10.1109/IPDPSW.2010.5470764(1-7)Online publication date: Apr-2010
  • (2019)PUShProceedings of the 52nd Annual IEEE/ACM International Symposium on Microarchitecture10.1145/3352460.3358317(886-898)Online publication date: 12-Oct-2019
  • (2019)Hamsaz: replication coordination analysis and synthesisProceedings of the ACM on Programming Languages10.1145/32903873:POPL(1-32)Online publication date: 2-Jan-2019
  • (2013)Ownership typesAliasing in Object-Oriented Programming10.5555/2554511.2554516(15-58)Online publication date: 1-Jan-2013
  • (2012)Secure the ClonesLogical Methods in Computer Science10.2168/LMCS-8(2:5)20128:2Online publication date: 31-May-2012
  • (2011)Secure the clonesProceedings of the 20th European conference on Programming languages and systems: part of the joint European conferences on theory and practice of software10.5555/1987211.1987228(317-337)Online publication date: 26-Mar-2011
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media