skip to main content
article

Lock reservation: Java locks can mostly do without atomic operations

Authors Info & Claims
Published:04 November 2002Publication History
Skip Abstract Section

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.

References

  1. S. V. Adve and K. Gharachorloo. Shared Memory Consistency Models: A Tutorial. IEEE Computer, 29(12), 66--76, 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. E. Armstrong. HotSpot: A New Breed of Virtual Machine.]]Google ScholarGoogle Scholar
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. D. F. Bacon and S. Fink. Personal Communication.]]Google ScholarGoogle Scholar
  8. B. N. Bershad, D. D. Redell, and J. R. Ellis. Fast Mutual Exclusion for Uniprocessors. Proceedings of ACM ASPLOS V, 223--233, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. B. Blanchet. Escape Analysis for Object-Oriented Languages: Application to Java. Proceedings of ACM OOPSLA '99, 20--34, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. Bogda and U. Halzle. Removing Unnecessary Synchronization in Java. Proceedings of ACM OOPSLA '99, 35--46, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. P. A. Buhr, M. Fortier, and M. H. Coffin. Monitor Classification. ACM Computing Surveys, 27(1), 63--107, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. D. Dice. Implementing Fast Java Monitors with Relaxed-Locks. Proceedings of USENIX JVM '01, 79--90, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. E. W. Dijkstra. Solution of a Problem in Concurrent Programming and Control. Communications of the ACM, 8(9), 569, 1965.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle Scholar
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. J. Gosling, B. Joy, and G. Steele. The Java Language Specification. Addison Wesley, 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. C. A. R. Hoare. Monitors: An Operating System Structuring Concept. Communications of the ACM, 17(10), 549--557, 1974.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. IBM developerWorks Java Technology Zone. http://www.ibm.com/developerworks/java/.]]Google ScholarGoogle Scholar
  21. Intel Corporation. IA-32 Intel Architecture Software Developer's Manual Vol. 1--3. http://developer.intel.com/design/Pentium4/manuals/.]]Google ScholarGoogle Scholar
  22. Intel Corporation. Intel Itanium Architecture Software Developer's Manual Vol. 1--3. http://developer.intel.com/design/itanium/manuals/.]]Google ScholarGoogle Scholar
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. Java Community Process. JSR 133: Java Memory Model and Thread Specification Revision. http://jcp.org/jsr/detail/133.jsp.]]Google ScholarGoogle Scholar
  25. T. Johnson and K. Harathi. Interruptible Critical Sections. Technical Report TR94007, University of Florida, 1994.]]Google ScholarGoogle Scholar
  26. Kaffe.org. Developing Kaffe. http://www.kaffe.org/develop.html.]]Google ScholarGoogle Scholar
  27. M. Kawahito. Personal Communication.]]Google ScholarGoogle Scholar
  28. 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 ScholarGoogle ScholarCross RefCross Ref
  29. H. T. Kung and J. T. Robinson. On Optimistic Methods for Concurrency Control. ACM Transactions on Database System, 6(2), 213--226, 1981.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. L. Lamport. A Fast Mutual Exclusion Algorithm. ACM Transactions on Computing System, 5(1), 1--11, 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. P. Leach and D. Perry. CIFS: A Common Internet File System. http://www.microsoft.com/mind/1196/cifs.asp|, 1996.]]Google ScholarGoogle Scholar
  32. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  33. T. Onodera. A Simple and Space-Efficient Monitor Optimization for Java. IBM Research Report RT0259, IBM, 1998.]]Google ScholarGoogle Scholar
  34. T. Onodera and K. Kawachiya. A Study of Locking Objects with Bimodal Fields. Proceedings of ACM OOPSLA '99, 223--237, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Y. G. Park and B. Goldberg. Escape Analysis on Lists. Proceedings of ACM PLDI '92, 116--127, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. W. Pugh. Fixing the Java Memory Model. Proceedings of ACM Java Grande '99, 89--98, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  38. E. Ruf. Effective Synchronization Removal for Java. Proceedings of ACM PLDI '00, 208--218, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Standard Performance Evaluation Corporation. SPEC JBB2000. http://www.spec.org/osg/jbb2000/.]]Google ScholarGoogle Scholar
  40. Standard Performance Evaluation Corporation. SPEC JVM98 Benchmarks. http://www.spec.org/osg/jvm98/.]]Google ScholarGoogle Scholar
  41. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  42. A. Thomasian. Concurrency Control: Methods, Performance, and Analysis. ACM Computing Surveys, 30(1), 70--119, 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Volano LLC. Volano Benchmarks. http://www.volano.com/benchmarks.html.]]Google ScholarGoogle Scholar
  44. J. Whaley and M. Rinard. Compositional Pointer and Escape Analysis for Java Programs. Proceedings of ACM OOPSLA '99, 187--206, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. J. Whaley. Partial Method Compilation using Dynamic Profile Information. Proceedings of ACM OOPSLA '01, 166--179, 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  47. F. Yellin and T. Lindholm. Java Runtime Internals. Presentation in JavaOne '96,]]Google ScholarGoogle Scholar

Index Terms

  1. Lock reservation: Java locks can mostly do without atomic operations

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 37, Issue 11
      November 2002
      385 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/583854
      Issue’s Table of Contents
      • cover image ACM Conferences
        OOPSLA '02: Proceedings of the 17th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
        November 2002
        396 pages
        ISBN:1581134711
        DOI:10.1145/582419

      Copyright © 2002 ACM

      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: 4 November 2002

      Check for updates

      Qualifiers

      • article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader