METHOD AND APPARATUS FOR CONVERTING A LIGHTWEIGHT MONITOR TO A HEAVYWEIGHT MONITOR
First Claim
1. A computer implemented method for converting a lightweight monitor into a heavy weight monitor when a first thread attempts to execute a synchronous operation on an object associated with the lightweight monitor, the object having an object header containing the lightweight monitor, comprising:
- determining ownership of the object;
creating a heavyweight monitor when it is determined that the object is owned by a second thread;
setting ownership of the heavyweight monitor to the second thread; and
entering the heavyweight monitor by the first thread.
2 Assignments
0 Petitions
Accused Products
Abstract
Methods and apparatus for converting a lightweight monitor to a heavyweight monitor are disclosed. According to one aspect of the present invention, a computer-implemented method for converting a lightweight monitor to a heavyweight monitor when an object that is owned by a second thread is unavailable to a first thread includes creating a new heavyweight monitor and setting the ownership of the new heavyweight monitor to the second thread. The first thread then enters the newly created heavyweight monitor without being forced to spin lock until the object is released by the second object.
-
Citations
17 Claims
-
1. A computer implemented method for converting a lightweight monitor into a heavy weight monitor when a first thread attempts to execute a synchronous operation on an object associated with the lightweight monitor, the object having an object header containing the lightweight monitor, comprising:
-
determining ownership of the object;
creating a heavyweight monitor when it is determined that the object is owned by a second thread;
setting ownership of the heavyweight monitor to the second thread; and
entering the heavyweight monitor by the first thread. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A computer program product for converting a lightweight monitor into a heavy weight monitor when a first thread attempts to execute a synchronous operation on an object associated with the lightweight monitor, the object having an object header containing the lightweight monitor, comprising:
-
computer code that determines ownership of the object;
computer code that creates a heavyweight monitor when it is determined that the object is owned by a second thread;
computer code that sets ownership of the heavyweight monitor to the second thread;
computer code that causes the first thread to enter the heavyweight monitor; and
a computer readable medium that stores the computer codes. - View Dependent Claims (11, 12, 13, 14)
-
-
15. A computer system including a memory which includes a plurality of threads, each of the plurality of threads, the computer system comprising:
-
a processor coupled to the memory; and
an object including an object header, the object header being arranged to contain a lightweight monitor which includes information relating to the ownership of object, a first thread selected from the plurality of threads that has locked the object as indicated by a first thread ID included in the lightweight monitor; and
a second thread selected from the plurality of threads, the second thread being arranged to convert the lightweight monitor to a corresponding heavyweight monitor owned by the first thread when the object is not available to the second thread. - View Dependent Claims (16, 17)
-
Specification