Method for resource lock/unlock capability in multithreaded computer environment
First Claim
1. A method for obtaining a lock on a resource in a multithread computer environment, said method comprising:
- determining whether one thread or multiple threads desire said lock on said resource;
directly assigning resource ownership to said one thread when said determining determines only said one thread to be actively seeking said lock on said resource, said directly assigning employing a first lock process comprising one of an operating system primitive lock process or a hardware lock process; and
employing a second lock process to obtain said lock on said resource when said determining determines that multiple threads concurrently desire ownership of said resource, said second lock process employing at least one function in the POSIX threads standard.
1 Assignment
0 Petitions
Accused Products
Abstract
Hybrid lock and unlock capabilities are provided for a threaded computing environment. For example, kernel locking services are selectively employed in conjunction with functions in the POSIX threads standard to provide a lock capability and an unlock capability. The hybrid approach determines which lock scheme to employ by evaluating whether one thread or multiple threads concurrently desire a resource lock. When only one thread desires the lock, the thread is directly assigned resource ownership employing one of an operating system primitive lock process or a hardware lock process. An alternate lock process is used to obtain resource ownership when multiple threads concurrently desire the lock. This alternate process employs at least one function in the POSIX threads standard to implement a queue of waiting threads. A similar hybrid approach to the unlock capability is also provided.
-
Citations
17 Claims
-
1. A method for obtaining a lock on a resource in a multithread computer environment, said method comprising:
-
determining whether one thread or multiple threads desire said lock on said resource; directly assigning resource ownership to said one thread when said determining determines only said one thread to be actively seeking said lock on said resource, said directly assigning employing a first lock process comprising one of an operating system primitive lock process or a hardware lock process; and employing a second lock process to obtain said lock on said resource when said determining determines that multiple threads concurrently desire ownership of said resource, said second lock process employing at least one function in the POSIX threads standard. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
-
-
14. A method for unlocking a lock on a resource in a multithread computer environment, said lock employing a lock structure including a lock.owner field representative of thread ownership of said resource, a lock.status field representative of ownership of said lock structure, and a lock.waiters field representative of a count of threads waiting to obtain said lock, said method comprising:
-
obtaining control of said lock structure by setting said lock.status field; determining whether any threads are waiting for said lock by evaluating said lock.waiters field; and if no threads are waiting, directly setting said lock.owner field to null, otherwise employing at least one function in the POSIX threads standard to set said lock.owner field to null and issue a thread condition signal to waiting threads that said resource has been unlocked. - View Dependent Claims (15, 16, 17)
-
Specification