Efficient priority-aware thread scheduling
First Claim
1. A method of prioritizing a plurality of threads, including at least a first thread, a second thread, a third thread, and a fourth thread, each of which is owned by a process and available for being scheduled to be executed on a processor of a device and has a respective priority, the priority of the first thread being higher than the priority of the second thread, the priority of the second thread being higher than the priority of the third thread, and the priority of the third thread being higher than the priority of the fourth thread, the method comprising:
- allocating a reservation of a first resource to the third thread;
during the reservation of the first resource by the third thread, receiving a request from the fourth thread for the first resource;
allocating a reservation of a second resource to the fourth thread;
during the reservation of the second resource to the fourth thread, receiving a request from the first thread for the second resource;
detecting a resource conflict comprising a delayed release of the reservation of the second resource by the execution of the fourth thread while the request for the second resource by the first thread is pending; and
addressing the resource conflict by;
temporarily elevating the priority of the third thread to a priority that is higher than the priority of the second thread, such that the third thread is scheduled to be executed prior to the second thread;
in response to the third thread relinquishing the first resource, temporarily elevating the priority of the fourth thread to a priority that is higher than the priority of the second thread, such that the fourth thread is scheduled to be executed prior to the second thread; and
in response to the fourth thread relinquishing the second resource, schedule the first thread to be executed prior to the second thread.
1 Assignment
0 Petitions
Accused Products
Abstract
A priority-based scheduling and execution of threads may enable the completion of higher-priority tasks above lower-priority tasks. Occasionally, a high-priority thread may request a resource that has already been reserved by a low-priority thread, and the higher-priority thread may be blocked until the low-priority thread relinquishes the reservation. Such prioritization may be acceptable if the low-priority thread is able to execute comparatively unimpeded, but in some scenarios, the low-priority thread may execute at a lower priority than a medium-priority thread that also has a lower priority than the high-priority thread. In this scenario, the medium-priority thread is effectively but incorrectly prioritized above the high-priority thread. Instead, upon detecting this scenario, the device may temporarily elevate the priority of the lower-priority thread over the priority of the medium-priority thread until the lower-priority thread relinquishes the resource, thereby reducing the waiting period of the high-priority thread for the requested resource.
20 Citations
20 Claims
-
1. A method of prioritizing a plurality of threads, including at least a first thread, a second thread, a third thread, and a fourth thread, each of which is owned by a process and available for being scheduled to be executed on a processor of a device and has a respective priority, the priority of the first thread being higher than the priority of the second thread, the priority of the second thread being higher than the priority of the third thread, and the priority of the third thread being higher than the priority of the fourth thread, the method comprising:
-
allocating a reservation of a first resource to the third thread; during the reservation of the first resource by the third thread, receiving a request from the fourth thread for the first resource; allocating a reservation of a second resource to the fourth thread; during the reservation of the second resource to the fourth thread, receiving a request from the first thread for the second resource; detecting a resource conflict comprising a delayed release of the reservation of the second resource by the execution of the fourth thread while the request for the second resource by the first thread is pending; and addressing the resource conflict by; temporarily elevating the priority of the third thread to a priority that is higher than the priority of the second thread, such that the third thread is scheduled to be executed prior to the second thread; in response to the third thread relinquishing the first resource, temporarily elevating the priority of the fourth thread to a priority that is higher than the priority of the second thread, such that the fourth thread is scheduled to be executed prior to the second thread; and in response to the fourth thread relinquishing the second resource, schedule the first thread to be executed prior to the second thread. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18)
-
-
19. A computer program product comprising one or more hardware storage devices having stored thereon computer-executable instructions that are structured such that, when executed by one or more processors of a computing system, the computer-executable instructions cause the computing system to prioritize a plurality of threads, including at least a first thread, a second thread, a third thread, and a fourth thread, each of which is owned by a process and available for being scheduled to be executed on the processor of the computing system and has a respective priority, the priority of the first thread being higher than the priority of the second thread, the priority of the second thread being higher than the priority of the third thread, and the priority of the third thread being higher than the priority of the fourth thread, the instructions comprising instructions that are executable to cause the computing system to perform at least the following:
-
allocate a reservation of a first resource to the third thread; during the reservation of the first resource by the third thread, receive a request from the fourth thread for the first resource; allocate a reservation of a second resource to the fourth thread; during the reservation of the second resource to the fourth thread, receive a request from the first thread for the second resource; detect a resource conflict comprising a delayed release of the reservation of the second resource by the execution of the fourth thread while the request for the second resource by the first thread is pending; and address the resource conflict by; temporarily elevating the priority of the third thread to a priority that is higher than the priority of the second thread, such that the third thread is scheduled to be executed prior to the second thread; in response to the third thread relinquishing the first resource, temporarily elevating the priority of the fourth thread to a priority that is higher than the priority of the second thread, such that the fourth thread is scheduled to be executed prior to the second thread; and in response to the fourth thread relinquishing the second resource, scheduling the first thread to be executed prior to the second thread.
-
-
20. A computing system that executes a plurality threads, including at least a first thread, a second thread, a third thread, and a fourth thread, each of which is owned by a process and available for being scheduled to be executed by the computing system and has a respective priority, the priority of the first thread being higher than the priority of the second thread, the priority of the second thread being higher than the priority of the third thread, and the priority of the third thread being higher than the priority of the fourth thread, comprising:
-
a processor; and a memory having stored thereon computer-executable instructions that are executable by the processor to cause the computing system to prioritize the first thread, the second thread, the third thread, and the fourth thread, the instructions including instructions that are executable to cause the computing system to perform at least the following; allocate a reservation of a first resource to the third thread; during the reservation of the first resource by the third thread, receive a request from the fourth thread for the first resource; allocate a reservation of a second resource to the fourth thread; during the reservation of the second resource to the fourth thread, receive a request from the first thread for the second resource; detect a resource conflict comprising a delayed release of the reservation of the second resource by the execution of the fourth thread while the request for the resource by the first thread is pending; and address the resource conflict by; temporarily elevating the priority of the third thread to a priority that is higher than the priority of the second thread, such that the third thread is scheduled to be executed prior to the second thread; in response to the third thread relinquishing the first resource, temporarily elevating the priority of the fourth thread to a priority that is higher than the priority of the second thread, such that the fourth thread is scheduled to be executed prior to the second thread; and in response to the fourth thread relinquishing the second resource, scheduling the first thread to be executed prior to the second thread.
-
Specification