Method and apparatus for user level monitor implementation
First Claim
1. A computer-implemented method for implementing an atomic monitor wait operation, comprising:
- creating a semaphore specific to a first thread desiring to exit a monitor associated with a target object having an object lock;
placing the semaphore in a wait queue associated with the target object; and
releasing the object lock by the first thread thereby allowing a second thread to execute a synchronous operation on the target object.
2 Assignments
0 Petitions
Accused Products
Abstract
Methods and apparatus for implementing an atomic monitor wait operation are disclosed. According to one aspect of the present invention, a computer-implemented method for implementing an atomic monitor wait operation includes creating a semaphore specific to a first thread. The semaphore is then placed in a wait queue associated with an object whose object lock is owned by the first thread in order to, in one implementation, preserve queue order. The first thread then exits a monitor associated with the object by, in one embodiment, releasing the object lock. The first thread then suspends execution until the semaphore receives notification that the object lock is available.
-
Citations
16 Claims
-
1. A computer-implemented method for implementing an atomic monitor wait operation, comprising:
-
creating a semaphore specific to a first thread desiring to exit a monitor associated with a target object having an object lock;
placing the semaphore in a wait queue associated with the target object; and
releasing the object lock by the first thread thereby allowing a second thread to execute a synchronous operation on the target object. - View Dependent Claims (2, 3, 4, 5)
suspending execution by the first thread;
receiving a notify call by the semaphore when the object lock is available; and
reacquiring the object lock by the first thread.
-
-
3. A method as recited in claim 2, wherein the receiving further includes determining if a period of time allocated for a timeout condition has elapsed.
-
4. A method as recited in claim 3, wherein when it is determined that the timeout period has not elapsed then the first thread executes a synchronous operation on the target object.
-
5. A method as recited in claim 4, further including removing the semaphore from the wait queue.
-
6. A computer program product for implementing an atomic monitor wait operation, comprising:
-
computer code that creates a semaphore specific to a first thread desiring to exit a monitor associated with a target object have an object lock;
computer code that places the semaphore in a wait queue associated with the target object;
computer code that releases the object lock by the first thread thereby allowing a second thread to execute a synchronous operation on the target object; and
a computer readable medium that stores the computer codes. - View Dependent Claims (7, 8)
computer code that receives a notify call by the semaphore when the object lock is available; and
computer code that re-acquires the object lock by the first thread.
-
-
9. 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 and an associate wait queue, the object header being arranged to contain a monitor which includes information relating to the ownership of object, a first thread selected from the plurality of threads that has locked the object; and
a semaphore created by and specific to the first thread;
the first thread places the semaphore into the wait queue prior to releasing an object lock in furtherance of an atomic monitor wait operation.- View Dependent Claims (10, 11, 12, 13, 14, 15, 16)
receiving a notify call by the semaphore when the object lock is available; and
re-acquiring the object lock by the first thread.
-
-
12. A computer system as recited in claim 11, wherein when the first thread suspends execution such that when the object lock is made available, the second thread receives a notify call that was generated by the first thread.
-
13. A computer system as recited in claim 12, wherein when the second thread receives the notify call, a determination is made if a period of time allocated for a timeout condition has elapsed.
-
14. A computer system as recited in claim 13, wherein when it is determined that the timeout period has not elapsed then the first thread re-acquires the object lock.
-
15. A computer system as recited in claim 14, wherein the semaphore is then removed from the wait queue.
-
16. A computer system as recited in claim 15, wherein the first thread executes a synchronous operation on the target object.
Specification