Assigning and scheduling threads for multiple prioritized queues
First Claim
1. A computer comprising:
- a memory and at least one processing unit;
an operating system executing on the at least one processing unit, wherein the operating system is operative to;
in response to a request from an application executing on the computer, allocate a pool of worker threads for the application, wherein each worker thread is a thread provided by the operating system, and wherein each worker thread services requests from the application to access operating system resources;
associate a plurality of queues with the pool of worker threads allocated for the application, each queue having a different priority, for storing items to be assigned to the worker threads, each item representing a request, having a priority, from the application to access the operating system resources using one of the worker threads in the pool of worker threads allocated for the application; and
the operating system further comprising a concurrency controller operative to assign items from the plurality of queues to worker threads while limiting a number of concurrently executing worker threads;
wherein, in response to a request, having a priority, from the application to access the operating system resources, the concurrency controller is operative to;
add an item corresponding to the request to the queue having the priority of the request, anddetermine whether a concurrency limit for the queue having the priority of the request is reached based on at least a thread count of concurrently executing worker threads associated with the queue; and
in response to a determination that the concurrency limit for the queue having the priority of the request is not reached, assign the item corresponding to the request to one of the worker threads and increment the thread count associated with the queue.
2 Assignments
0 Petitions
Accused Products
Abstract
An operating system provides a pool of worker threads servicing multiple queues of requests at different priority levels. A concurrency controller limits the number of currently executing threads. The system tracks the number of currently executing threads above each priority level, and preempts operations of lower priority worker threads in favor of higher priority worker threads. A system can have multiple pools of worker threads, with each pool having its own priority queues and concurrency controller. A thread also can change its priority mid-operation. If a thread becomes lower priority and is currently active, then steps are taken to ensure priority inversion does not occur. In particular, the current thread for the now lower priority item can be preempted by a thread for a higher priority item and the preempted item is placed in the lower priority queue.
11 Citations
26 Claims
-
1. A computer comprising:
-
a memory and at least one processing unit; an operating system executing on the at least one processing unit, wherein the operating system is operative to; in response to a request from an application executing on the computer, allocate a pool of worker threads for the application, wherein each worker thread is a thread provided by the operating system, and wherein each worker thread services requests from the application to access operating system resources; associate a plurality of queues with the pool of worker threads allocated for the application, each queue having a different priority, for storing items to be assigned to the worker threads, each item representing a request, having a priority, from the application to access the operating system resources using one of the worker threads in the pool of worker threads allocated for the application; and the operating system further comprising a concurrency controller operative to assign items from the plurality of queues to worker threads while limiting a number of concurrently executing worker threads; wherein, in response to a request, having a priority, from the application to access the operating system resources, the concurrency controller is operative to; add an item corresponding to the request to the queue having the priority of the request, and determine whether a concurrency limit for the queue having the priority of the request is reached based on at least a thread count of concurrently executing worker threads associated with the queue; and in response to a determination that the concurrency limit for the queue having the priority of the request is not reached, assign the item corresponding to the request to one of the worker threads and increment the thread count associated with the queue. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. An article of manufacture comprising:
-
a memory or storage device; computer program instructions stored on the memory or storage device which, when read from the memory or storage device and processed by a processing unit of a computer, instruct the processing unit to be configured to have an operating system executing on the at least one processing unit, wherein the operating system is operative to; in response to a request from an application executing on the computer, allocate a pool of worker threads for the application, wherein each worker thread is a thread provided by the operating system, and wherein each worker thread services requests from the application to access operating system resources; associate a plurality of queues with the pool of worker threads allocated for the application, each queue having a different priority, for storing items to be assigned to the worker threads, each item representing a request, having a priority, from the application to access the operating system resources using one of the worker threads in the pool of worker threads allocated for the application; and the operating system further comprising a concurrency controller operative to assign items from the plurality of queues to worker threads while limiting a number of concurrently executing worker threads; wherein, in response to a request, having a priority, from the application to access the operating system resources, the concurrency controller is operative to; add an item corresponding to the request to the queue having the priority of the request, and determine whether a concurrency limit for the queue having the priority of the request is reached based on at least a thread count of concurrently executing worker threads associated with the queue; and in response to a determination that the concurrency limit for the queue having the priority of the request is not reached, assign the item corresponding to the request to one of the worker threads and increment the thread count associated with the queue. - View Dependent Claims (11, 12, 13, 14, 15, 16, 17, 18)
-
-
19. A computer-implemented process performed by an operating system executing on a computer, the process comprising:
-
the operating system allocating a pool of worker threads for an application executing on the computer in response to a request from the application, wherein each worker thread is a thread provided by the operating system, wherein each worker thread services requests from the application to access operating system resources;
the operating system associating a plurality of queues with the pool of worker threads, each queue for items of different priority, each item representing a request having a priority from the application to access the operating system resources using one of the worker threads in the pool of worker threads allocated to the application,assigning items to the pool of worker threads using a concurrency controller provided by the operating system, while limiting a number of concurrently executing worker threads by, in response to a request from the application including an item having a priority, the concurrency controller; adding the item to the queue having the priority of the item; determining whether a concurrency limit for the queue having the priority of the item is reached based on at least a thread count of concurrently executing worker threads associated with the queue; and in response to a determination that the concurrency limit for the queue having the priority of the item is not reached, assigning the item to one of the worker threads and increment the thread count for the queue. - View Dependent Claims (20, 21, 22, 23, 24, 25, 26)
-
Specification