Efficient task scheduling using a locking mechanism
First Claim
Patent Images
1. A method for efficient task scheduling using a locking mechanism by a processor device in a computing environment, the method comprising:
- allowing a new task to spin on the locking mechanism comprising a lock try-or-spin lock if a number of tasks spinning on the locking mechanism is less than a predetermined threshold for parallel operations requiring locks between multiple threads;
if the number of the tasks spinning on the locking mechanism is one of equal to and more than the predetermined threshold, performing the step of;
failing the new task in lieu of the new task entering a sleep state by returning a fail notification,yielding the processor device to execute additional tasks, andexiting the new task and thereby avoid having the new task spin in a a first queue having a first queue length of a separate ticket based lock, wherein the number of tasks spinning on the locking mechanism is determined by examining a last ticket number provided when compared to a current serving ticket number in the first queue of the ticket based lock and wherein the first queue is called to determine whether the number of tasks spinning on the locking mechanism is less than the predetermined threshold prior to dispatching the new task and allowing the new task to attempt to acquire the lock try-or-spin lock, and the ticket based lock.
1 Assignment
0 Petitions
Accused Products
Abstract
For efficient task scheduling using a locking mechanism, a new task is allowed to spin on the locking mechanism if a number of tasks spinning on the locking mechanism is less than a predetermined threshold for parallel operations requiring locks between the multiple threads.
9 Citations
3 Claims
-
1. A method for efficient task scheduling using a locking mechanism by a processor device in a computing environment, the method comprising:
-
allowing a new task to spin on the locking mechanism comprising a lock try-or-spin lock if a number of tasks spinning on the locking mechanism is less than a predetermined threshold for parallel operations requiring locks between multiple threads; if the number of the tasks spinning on the locking mechanism is one of equal to and more than the predetermined threshold, performing the step of; failing the new task in lieu of the new task entering a sleep state by returning a fail notification, yielding the processor device to execute additional tasks, and exiting the new task and thereby avoid having the new task spin in a a first queue having a first queue length of a separate ticket based lock, wherein the number of tasks spinning on the locking mechanism is determined by examining a last ticket number provided when compared to a current serving ticket number in the first queue of the ticket based lock and wherein the first queue is called to determine whether the number of tasks spinning on the locking mechanism is less than the predetermined threshold prior to dispatching the new task and allowing the new task to attempt to acquire the lock try-or-spin lock, and the ticket based lock.
-
-
2. A system for efficient task scheduling using a locking mechanism in a computing environment, the system comprising:
-
the locking mechanism; and at least one processor device operable in the computing environment in communication with the locking mechanism, wherein processor device; allows a new task to spin on the locking mechanism comprising a lock try-or-spin lock if a number of tasks spinning on the locking mechanism is less than a predetermined threshold for parallel operations requiring locks between multiple threads, if the number of the tasks spinning on the locking mechanism is one of equal to and more than the predetermined threshold, performs the step of; fails the new task in lieu of the new task entering a sleep state by returning a fail notification, yielding the processor device to execute additional tasks, and exiting the new task and thereby avoid having the new task spin in a first queue having a first queue length of a separate ticket based lock wherein the number of tasks spinning on the locking mechanism is determined by examining a last ticket number provided when compared to a current serving ticket number in the first queue of the ticket based lock and wherein the first queue is called to determine whether the number of tasks spinning on the locking mechanism is less than the predetermined threshold prior to dispatching the new task and allowing the new task to attempt to acquire the lock try-or-spin lock, and the ticket based lock.
-
-
3. A computer program product for efficient task scheduling using a locking mechanism in a computing environment by at least one processor device, the computer program product comprising a non-transitory computer-readable storage medium having computer-readable program code portions stored therein, the computer-readable program code portions comprising:
-
a first executable portion that allows a new task to spin on the locking mechanism comprising a lock try-or-spin lock if a number of tasks spinning on the locking mechanism is less than a predetermined threshold for parallel operations requiring locks between multiple threads; a second executable portion that determines if the number of the tasks spinning on the locking mechanism is one of equal to and more than the predetermined threshold, performs the step of; fails the new task in lieu of the new task entering a sleep state by returning a fail notification, yielding the processor device to execute additional tasks, and exiting the new task and thereby avoid having the new task spin in a first queue having a first queue length of a separate ticket based lock, wherein the number of tasks spinning on the locking mechanism is determined by examining a last ticket number provided when compared to a current serving ticket number in the first queue of the ticket based lock and wherein the first queue is called to determine whether the number of tasks spinning on the locking mechanism is less than the predetermined threshold prior to dispatching the new task and allowing the new task to attempt to acquire the lock try-or-spin lock, and the ticket based.
-
Specification