ABSTRACT
Because of the built-in support for multi-threaded programming, Java programs perform many lock operations. Although the overhead has been significantly reduced in the recent virtual machines, One or more atomic operations are required for acquiring and releasing an object's lock even in the fastest cases.This paper presents a novel algorithm called lock reservation. It exploits thread locality of Java locks, which claims that the locking sequence of a Java lock contains a very long repetition of a specific thread. The algorithm allows locks to be reserved for threads. When a thread attempts to acquire a lock, it can do without any atomic operation if the lock is reserved for the thread. Otherwise, it cancels the reservation and falls back to a conventional locking algorithm.We have evaluated an implementation of lock reservation in IBM's production virtual machine and compiler. The results show that it achieved performance improvements up to 53% in real Java programs.
- S. V. Adve and K. Gharachorloo. Shared Memory Consistency Models: A Tutorial. IEEE Computer, 29(12), 66--76, 1996.]] Google ScholarDigital Library
- O. Agesen, D. Detlefs, A. Garthwaite, R. Knippel, Y. S. Ramakrishna, and D. White. An Efficient Meta-lock for Implementing Ubiquitous Synchronization. Proceedings of ACM OOPSLA '99, 207--222, 1999.]] Google ScholarDigital Library
- J. Aldrich, C. Chambers, E. G. Sirer, and S. Eggers. Static Analyses for Eliminating Unnecessary Synchronization from Java Programs. Proceedings of the 6th Int'l Static Analysis Symposium (SAS '99), 19--38, 1999.]] Google ScholarDigital Library
- E. Armstrong. HotSpot: A New Breed of Virtual Machine.]]Google Scholar
- D. F. Bacon. Fast and Effective Optimization of Statically Typed Object-Oriented Languages. Ph.D. Thesis UCB/CSD-98-1017, University of California, 1997.]] Google ScholarDigital Library
- D. F. Bacon, R. Konuru, C. Murthy, and M. Serrano. Thin Locks: Featherweight Synchronization for Java. Proceedings of ACM PLDI '98, 258--268, 1998.]] Google ScholarDigital Library
- D. F. Bacon and S. Fink. Personal Communication.]]Google Scholar
- B. N. Bershad, D. D. Redell, and J. R. Ellis. Fast Mutual Exclusion for Uniprocessors. Proceedings of ACM ASPLOS V, 223--233, 1992.]] Google ScholarDigital Library
- B. Blanchet. Escape Analysis for Object-Oriented Languages: Application to Java. Proceedings of ACM OOPSLA '99, 20--34, 1999.]] Google ScholarDigital Library
- J. Bogda and U. Halzle. Removing Unnecessary Synchronization in Java. Proceedings of ACM OOPSLA '99, 35--46, 1999.]] Google ScholarDigital Library
- P. A. Buhr, M. Fortier, and M. H. Coffin. Monitor Classification. ACM Computing Surveys, 27(1), 63--107, 1995.]] Google ScholarDigital Library
- J.-D. Choi, M. Gupta, M. Serrano, V. C. Sreedhar, S. Midkiff. Escape Analysis for Java. Proceedings of ACM OOPSLA '99, 1--19, 1999.]] Google ScholarDigital Library
- D. Dice. Implementing Fast Java Monitors with Relaxed-Locks. Proceedings of USENIX JVM '01, 79--90, 2001.]] Google ScholarDigital Library
- E. W. Dijkstra. Solution of a Problem in Concurrent Programming and Control. Communications of the ACM, 8(9), 569, 1965.]] Google ScholarDigital Library
- R. Eckstein, D. Collier-Brown, and P. Kelly. Using Samba. O'Reilly, 1999. http://www.oreilly.com/catalog/samba/chapter/book/ch05_05.html.]]Google Scholar
- E. M. Gagnon and L. J. Hendren. SableVM: A Research Framework for the Efficient Execution of Java Bytecode Proceedings of USENIX JVM '01, 27--39, 2001.]] Google ScholarDigital Library
- J. Gosling, B. Joy, and G. Steele. The Java Language Specification. Addison Wesley, 1996.]] Google ScholarDigital Library
- C. A. R. Hoare. Monitors: An Operating System Structuring Concept. Communications of the ACM, 17(10), 549--557, 1974.]] Google ScholarDigital Library
- R. L. Hudson, J. E. B. Moss, S. Subramoney, and W. Washburn. Cycles to Recycle: Garbage Collection on the IA-64. Proceedings of the 2nd ACM Int'l Symposium on Memory Management (ISMM '00), 101--110, 2000.]] Google ScholarDigital Library
- IBM developerWorks Java Technology Zone. http://www.ibm.com/developerworks/java/.]]Google Scholar
- Intel Corporation. IA-32 Intel Architecture Software Developer's Manual Vol. 1--3. http://developer.intel.com/design/Pentium4/manuals/.]]Google Scholar
- Intel Corporation. Intel Itanium Architecture Software Developer's Manual Vol. 1--3. http://developer.intel.com/design/itanium/manuals/.]]Google Scholar
- K. Ishizaki, M. Kawahito, T. Yasue, M. Takeuchi, T. Ogasawara, T. Suganuma, T. Onodera, H. Komatsu, and T. Nakatani. Design, Implementation, and Evaluation of Optimizations in a Just-In Time Compiler. Proceedings of ACM Java Grande '99, 119--128, 1999.]] Google ScholarDigital Library
- Java Community Process. JSR 133: Java Memory Model and Thread Specification Revision. http://jcp.org/jsr/detail/133.jsp.]]Google Scholar
- T. Johnson and K. Harathi. Interruptible Critical Sections. Technical Report TR94007, University of Florida, 1994.]]Google Scholar
- Kaffe.org. Developing Kaffe. http://www.kaffe.org/develop.html.]]Google Scholar
- M. Kawahito. Personal Communication.]]Google Scholar
- A. Krall and M. Probst. Monitors and Exceptions: How to Implement Java Efficiently. Proceedings of ACM Workshop on Java for High-Performance Network Computing, 15--24, 1998.]]Google ScholarCross Ref
- H. T. Kung and J. T. Robinson. On Optimistic Methods for Concurrency Control. ACM Transactions on Database System, 6(2), 213--226, 1981.]] Google ScholarDigital Library
- L. Lamport. A Fast Mutual Exclusion Algorithm. ACM Transactions on Computing System, 5(1), 1--11, 1987.]] Google ScholarDigital Library
- P. Leach and D. Perry. CIFS: A Common Internet File System. http://www.microsoft.com/mind/1196/cifs.asp|, 1996.]]Google Scholar
- G. Muller, B. Moura, F. Bellard, and C. Consel. Harissa: A Flexible and Efficient Java Environment Mixing Bytecode and Compiled Code. Proceedings of the 3rd USENIX Conference on Object Oriented Technologies and Systems (COOTS '97), 1--20, 1997.]] Google ScholarDigital Library
- T. Onodera. A Simple and Space-Efficient Monitor Optimization for Java. IBM Research Report RT0259, IBM, 1998.]]Google Scholar
- T. Onodera and K. Kawachiya. A Study of Locking Objects with Bimodal Fields. Proceedings of ACM OOPSLA '99, 223--237, 1999.]] Google ScholarDigital Library
- Y. G. Park and B. Goldberg. Escape Analysis on Lists. Proceedings of ACM PLDI '92, 116--127, 1992.]] Google ScholarDigital Library
- W. Pugh. Fixing the Java Memory Model. Proceedings of ACM Java Grande '99, 89--98, 1999.]] Google ScholarDigital Library
- R. Rajwar and J. R. Goodman. Speculative Lock Elision: Enabling Highly Concurrent Multithreaded Execution. Proceedings of the 34th ACM/IEEE MICRO 34, 294--305, 2001.]] Google ScholarDigital Library
- E. Ruf. Effective Synchronization Removal for Java. Proceedings of ACM PLDI '00, 208--218, 2000.]] Google ScholarDigital Library
- Standard Performance Evaluation Corporation. SPEC JBB2000. http://www.spec.org/osg/jbb2000/.]]Google Scholar
- Standard Performance Evaluation Corporation. SPEC JVM98 Benchmarks. http://www.spec.org/osg/jvm98/.]]Google Scholar
- T. Suganuma, T. Ogasawara, M. Takeuchi, T. Yasue, M. Kawahito, K. Ishizaki, H. Komatsu, and T. Nakatani. Overview of the IBM Java Just-in-Time Compiler. IBM Systems Journal, 39(1), 175--193, 2000.]] Google ScholarDigital Library
- A. Thomasian. Concurrency Control: Methods, Performance, and Analysis. ACM Computing Surveys, 30(1), 70--119, 1998.]] Google ScholarDigital Library
- Volano LLC. Volano Benchmarks. http://www.volano.com/benchmarks.html.]]Google Scholar
- J. Whaley and M. Rinard. Compositional Pointer and Escape Analysis for Java Programs. Proceedings of ACM OOPSLA '99, 187--206, 1999.]] Google ScholarDigital Library
- J. Whaley. Partial Method Compilation using Dynamic Profile Information. Proceedings of ACM OOPSLA '01, 166--179, 2001.]] Google ScholarDigital Library
- B.-S. Yang, J. Lee, J. Park, S.-M. Moon, K. Ebcioglu, and E. Altman. Lightweight Monitor for Java VM. ACM SIGARCH Computer Architecture News, 27(1), 35--38, 1999.]] Google ScholarDigital Library
- F. Yellin and T. Lindholm. Java Runtime Internals. Presentation in JavaOne '96,]]Google Scholar
Index Terms
- Lock reservation: Java locks can mostly do without atomic operations
Recommendations
Eliminating synchronization-related atomic operations with biased locking and bulk rebiasing
Proceedings of the 2006 OOPSLA ConferenceThe Java™ programming language contains built-in synchronization primitives for use in constructing multithreaded programs. Efficient implementation of these synchronization primitives is necessary in order to achieve high performance.Recent research [9,...
Lock reservation: Java locks can mostly do without atomic operations
Because of the built-in support for multi-threaded programming, Java programs perform many lock operations. Although the overhead has been significantly reduced in the recent virtual machines, One or more atomic operations are required for acquiring and ...
Lock elision for read-only critical sections in Java
PLDI '10It is not uncommon in parallel workloads to encounter shared data structures with read-mostly access patterns, where operations that update data are infrequent and most operations are read-only. Typically, data consistency is guaranteed using mutual ...
Comments