OPPORTUNISTIC USE OF LOCK MECHANISM TO REDUCE WAITING TIME OF THREADS TO ACCESS A SHARED RESOURCE
First Claim
1. In association with a plurality of processors including two or more processors that each provides a specified thread to access a shared resource, wherein the shared resource can only be accessed by one thread at a given time, a locking mechanism enables a first one of the specified threads to access the shared resource while each of the other specified threads is retained in a waiting queue, and a second one of the specified threads occupies a position of highest priority in the queue, a method comprising the steps of:
- identifying a time period between a time when the first specified thread releases access to the shared resource, and a later time when the second specified thread becomes enabled to access the shared resource;
responsive to an additional thread that is not one of the specified threads being provided by a processor to access the shared resource during the identified time period, determining whether a first prespecified criterion pertaining to the specified threads retained in said queue has been met;
responsive to said first criterion being met, determining whether a second prespecified criterion has been met, wherein said second criterion is that the number of specified threads in said queue has not decreased since a specified prior time; and
responsive to said second criterion being met, deciding whether to enable said additional thread to access the shared resource before the second specified thread accesses the shared resource.
1 Assignment
0 Petitions
Accused Products
Abstract
Embodiments of the invention provide a method, apparatus and computer program product for enabling a thread to acquire a lock associated with a shared resource, when a locking mechanism is used therewith, wherein each embodiment reduces waiting time and enhances efficiency in using the shared resource. One embodiment is associated with a plurality of processors, which includes two or more processors that each provides a specified thread to access a shared resource. The shared resource can only be accessed by one thread at a given time, a locking mechanism enables a first one of the specified threads to access the shared resource while each of the other specified threads is retained in a waiting queue, and a second one of the specified threads occupies a position of highest priority in the queue. The method includes the step of identifying a time period between a time when the first specified thread releases access to the shared resource, and a later time when the second specified thread becomes enabled to access the shared resource. Responsive to an additional thread that is not one of the specified threads being provided by a processor to access the shared resource during the identified time period, it is determined whether a first prespecified criterion pertaining to the specified threads retained in the queue has been met. Responsive to the first criterion being met, the method determines whether a second prespecified criterion has been met, wherein the second criterion is that the number of specified threads in the queue has not decreased since a specified prior time. Responsive to the second criterion being met, the method then decides whether to enable the additional thread to access the shared resource before the second specified thread accesses the resource.
-
Citations
20 Claims
-
1. In association with a plurality of processors including two or more processors that each provides a specified thread to access a shared resource, wherein the shared resource can only be accessed by one thread at a given time, a locking mechanism enables a first one of the specified threads to access the shared resource while each of the other specified threads is retained in a waiting queue, and a second one of the specified threads occupies a position of highest priority in the queue, a method comprising the steps of:
-
identifying a time period between a time when the first specified thread releases access to the shared resource, and a later time when the second specified thread becomes enabled to access the shared resource; responsive to an additional thread that is not one of the specified threads being provided by a processor to access the shared resource during the identified time period, determining whether a first prespecified criterion pertaining to the specified threads retained in said queue has been met; responsive to said first criterion being met, determining whether a second prespecified criterion has been met, wherein said second criterion is that the number of specified threads in said queue has not decreased since a specified prior time; and responsive to said second criterion being met, deciding whether to enable said additional thread to access the shared resource before the second specified thread accesses the shared resource. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
-
11. In association with a plurality of processors including two or more processors that each provides a specified thread to access a shared resource, wherein the shared resource can only be accessed by one thread at a given time, a locking mechanism enables a first one of the specified threads to access the shared resource while each of the other specified threads is retained in a waiting queue, and a second one of the specified threads occupies a position of highest priority in the queue, a computer program product executable in a computer readable storage medium comprising:
-
instructions for identifying a time period between a time when the first specified thread releases access to the shared resource, and a later time when the second specified thread becomes enabled to access the shared resource; instructions for responsive to an additional thread that is not one of the specified threads being provided by a processor to access the shared resource during the identified time period, for determining whether a first prespecified criterion pertaining to the specified threads retained in said queue has been met; instructions for responsive to said first criterion being met, for determining whether a second prespecified criterion has been met, wherein said second criterion is that the number of specified threads in said queue has not decreased since a specified prior time; and instructions for responsive to said second criterion being met, for deciding whether to enable said additional thread to access the shared resource before the second specified thread accesses the shared resource. - View Dependent Claims (12, 13, 14, 15)
-
-
16. In association with a plurality of processors including two or more processors that each provides a specified thread to access a shared resource, wherein the shared resource can only be accessed by one thread at a given time, a locking mechanism enables a first one of the specified threads to access the shared resource while each of the other specified threads is retained in a waiting queue, and a second one of the specified threads occupies a position of highest priority in the queue, a apparatus comprising:
-
means for identifying a time period between a time when the first specified thread releases access to the shared resource, and a later time when the second specified thread becomes enabled to access the shared resource; means responsive to an additional thread that is not one of the specified threads being provided by a processor to access the shared resource during the identified time period, for determining whether a first prespecified criterion pertaining to the specified threads retained in said queue has been met; means responsive to said first criterion being met, for determining whether a second prespecified criterion has been met, wherein said second criterion is that the number of specified threads in said queue has not decreased since a specified prior time; and means responsive to said second criterion being met, for deciding whether to enable said additional thread to access the shared resource before the second specified thread accesses the shared resource. - View Dependent Claims (17, 18, 19, 20)
-
Specification