Static Analyses for Eliminating Unnecessary Synchronization from Java Programs

This paper presents and evaluates a set of analyses designed to reduce synchronization overhead in Java programs. Monitor-based synchronization in Java often causes significant overhead, accounting for 5-10% of total execution time in our benchmark applications. To reduce this overhead, programmers often try to eliminate unnecessary lock operations by hand. Such manual optimizations are tedious, error-prone, and often result in poorly structured and less reusable programs. Our approach replaces manual optimizations with static analyses that automatically find and remove unnecessary synchronization from Java programs. These analyses optimize cases where a monitor is entered multiple times by a single thread, where one monitor is nested within another, and where a monitor is accessible by only one thread. A partial implementation of our analyses eliminates up to 70% of synchronization overhead and improves running time by up to 5% for several already hand-optimized benchmarks. Thus, our automated analyses have the potential to significantly improve the performance of Java applications while enabling programmers to design simpler and more reusable multithreaded code.

[1]  Edwin H. Satterthwaite,et al.  Early experience with Mesa , 1977, CACM.

[2]  Edwin H. Satterthwaite,et al.  Early experience with Mesa , 1977 .

[3]  Butler W. Lampson,et al.  Experience with processes and monitors in Mesa , 1980, CACM.

[4]  Olin Shivers,et al.  Control flow analysis in scheme , 1988, PLDI '88.

[5]  Hans-Juergen Boehm,et al.  Garbage collection in an uncooperative environment , 1988, Softw. Pract. Exp..

[6]  Thomas E. Anderson,et al.  The performance implications of thread management alternatives for shared-memory multiprocessors , 1989, SIGMETRICS '89.

[7]  John Hogg,et al.  Islands: aliasing protection in object-oriented languages , 1991, OOPSLA '91.

[8]  Simon L. Peyton Jones,et al.  Imperative functional programming , 1993, POPL '93.

[9]  Andrew A. Chien,et al.  Obtaining sequential efficiency for concurrent object-oriented languages , 1995, POPL '95.

[10]  Pierre Cointe Proceedings of the 10th European Conference on Object-Oriented Programming , 1996 .

[11]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[12]  Naftaly H. Minsky Towards Alias-Free Pointers , 1996, ECOOP.

[13]  David Grove,et al.  Vortex: an optimizing compiler for object-oriented languages , 1996, OOPSLA '96.

[14]  Martin C. Rinard,et al.  Lock Coarsening: Eliminating Lock Overhead in Automatically Parallelized Object-Based Programs , 1996, LCPC.

[15]  Sandeep K. Singhal,et al.  Building high-performance applications and services in Java: an experiential study , 1997, OOPSLA '97.

[16]  Julian Dolby Automatic inline allocation of objects , 1997, PLDI '97.

[17]  David Grove,et al.  Call graph construction in object-oriented languages , 1997, OOPSLA '97.

[18]  Andreas Krall,et al.  Monitors and exceptions: how to implement Java efficiently , 1998 .

[19]  K. Rustan M. Leino,et al.  Extended static checking , 1998, PROCOMET.

[20]  Martin C. Rinard,et al.  Lock Coarsening: Eliminating Lock Overhead in Automatically Parallelized Object-Based Programs , 1998, J. Parallel Distributed Comput..

[21]  Jan Vitek,et al.  Flexible Alias Protection , 1998, ECOOP.

[22]  Eric Jul,et al.  Proceedings of the 12th European Conference on Object-Oriented Programming , 1998 .

[23]  James C. Corbett,et al.  Constructing compact models of concurrent Java programs , 1998, ISSTA '98.

[24]  Emin Gün Sirer,et al.  Distributed virtual machines: a system architecture for network computing , 1998, ACM SIGOPS European Workshop.

[25]  Mauricio J. Serrano,et al.  Thin locks: featherweight synchronization for Java , 1998, PLDI '98.

[26]  James C. Corbett,et al.  Using shape analysis to reduce finite-state models of concurrent Java programs , 2000, TSEM.