Method and apparatus for user level monitor implementation
AssigneeSun Microsystems, Inc.
InventorHong Zhang
Life of this patent
Estimating the term…
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.
Claims16
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.
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.
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.
Dependencies are inferred from the claim text.