Lock reservation: Java']Java locks can mostly do without atomic operations

被引:13
作者
Kawachiya, K [1 ]
Koseki, A [1 ]
Onodera, T [1 ]
机构
[1] IBM Res Corp, Tokyo Res Lab, Kanagawa 2428502, Japan
关键词
languages; algorithms; performance; measurement; experimentation; !text type='Java']Java[!/text; synchronization; monitor; lock; reservation; thread locality; atomic operation;
D O I
10.1145/583854.582433
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
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.
引用
收藏
页码:130 / 141
页数:12
相关论文
共 45 条
  • [1] Shared memory consistency models: A tutorial
    Adve, SV
    Gharachorloo, K
    [J]. COMPUTER, 1996, 29 (12) : 66 - &
  • [2] AGESEN O, 1999, P 1999 ACM SIGPLAN C, P207
  • [3] ALDRICH J, 1999, P 6 INT STAT AN S SA, P19
  • [4] ARMSTRONG E, 1998, HOTSPOT NEW BREED VI
  • [5] Bacon D., COMMUNICATION
  • [6] BACON DF, 1997, THESIS U CAL
  • [7] BACON DF, 1998, P ACM SIGPLAN 98 C P, P258
  • [8] BERSHAD BN, 1992, P ACM ASPLOS, V5, P223
  • [9] BLANCHET B, 1999, P 1999 ACM SIGPLAN C, P20
  • [10] Removing unnecessary synchronization in Java']Java
    Bogda, J
    Hölzle, U
    [J]. ACM SIGPLAN NOTICES, 1999, 34 (10) : 35 - 46