Real time thread dispatcher for multiprocessor applications
First Claim
1. A multiprocessor scheduling system comprising:
- a plurality of processors;
a plurality of schedulers, each of said plurality of processors coupled to one of said plurality of schedulers;
a plurality of local dispatch queues, each of said plurality of processors coupled to one of said plurality of local dispatch queues;
said plurality of schedulers coupled to a communication medium;
a global dispatch queue coupled to a communication medium;
a shared memory coupled to said communication medium;
wherein said plurality of local queues and said global queue each have a respective lock that is obtained before a thread is removed from the respective queue, and wherein said plurality of schedulers are coupled to a communication medium wherein at least one of said plurality of schedulers is configured to;
select for execution on an associated one of said plurality of processors a candidate highest priority runnable thread from said global dispatch queue and one of said local dispatch queues;
notify said plurality of processors of the candidate highest priority runnable thread;
verify that the selected thread is the highest priority thread by checking whether a higher priority thread having higher priority than said candidate thread is available on said global dispatch queue or one of said local dispatch queues;
preempt the selected thread with a new highest priority thread if the verification is negative.
0 Assignments
0 Petitions
Accused Products
Abstract
The present invention provides a process scheduler or dispatcher for a multiprocessor system for real time applications. This embodiment of the present invention proposes a dispatcher model that maintains a dispatch queue for each processor and a separate global dispatch queue for unbound higher priority real time threads. A processor has its own queue and a dispatcher. Each queue has a separate schedule lock associated with it to protect scheduling operations. A processor'"'"'s dispatcher selects a thread for execution from one of the queues in the system as a candidate thread to execute. When a candidate thread is selected for execution, the processor proceeds to verify against threads in the global real time queue and the processor'"'"'s own dispatch queue to select a highest priority runnable thread in the system. Thus, the present invention allows the dispatcher to prevent race conditions and minimize lock contention while assuring that high-priority threads are dispatched as quickly as possible. The present invention is implemented by a synchronization between the operations of dispatching a thread and making a thread runnable.
127 Citations
14 Claims
-
1. A multiprocessor scheduling system comprising:
-
a plurality of processors;
a plurality of schedulers, each of said plurality of processors coupled to one of said plurality of schedulers;
a plurality of local dispatch queues, each of said plurality of processors coupled to one of said plurality of local dispatch queues;
said plurality of schedulers coupled to a communication medium;
a global dispatch queue coupled to a communication medium;
a shared memory coupled to said communication medium;
wherein said plurality of local queues and said global queue each have a respective lock that is obtained before a thread is removed from the respective queue, and wherein said plurality of schedulers are coupled to a communication medium wherein at least one of said plurality of schedulers is configured to;
select for execution on an associated one of said plurality of processors a candidate highest priority runnable thread from said global dispatch queue and one of said local dispatch queues;
notify said plurality of processors of the candidate highest priority runnable thread;
verify that the selected thread is the highest priority thread by checking whether a higher priority thread having higher priority than said candidate thread is available on said global dispatch queue or one of said local dispatch queues;
preempt the selected thread with a new highest priority thread if the verification is negative. - View Dependent Claims (2, 3)
-
-
4. A multiprocessor system comprising:
-
a plurality of processors;
a plurality of local dispatch queues, each of said plurality of local dispatch queues associated with a respective one of said plurality of processors;
a global dispatch queue accessible by said plurality of processors; and
a dispatcher configured to;
select a highest priority thread as a first thread for execution by one of said plurality of processors, said highest priority thread selected from said global queue and at least one of said local dispatch queues;
after obtaining said first thread, verify that said first thread is the highest priority thread by checking whether a higher priority thread having higher priority than said candidate thread is available on said global dispatch queue or one of said local dispatch queues; and
preempt said first thread with a higher priority thread if the verification is negative. - View Dependent Claims (5, 6, 7, 8, 9, 10, 11, 12, 13, 14)
selecting the highest priority runnable thread from said global queue;
selecting the highest priority runnable thread from an associated local dispatch queue when there is no runnable thread in said global queue.
-
-
6. The system of claim 5, wherein said dispatcher is configured to select said highest priority thread by performing the further step of selecting the highest priority thread from local dispatch queues other than said associated local dispatch queue when there is no runnable thread in said global queue and said associated local dispatch queue.
-
7. The system of claim 6, wherein said dispatcher is configured to select said highest priority thread by performing the further step of selecting an idle thread when there is no runnable thread in said global queue and said plurality of local dispatch queues.
-
8. The system of claim 4, wherein a newly runnable thread that is bound to a given processor is placed in the local dispatch queue associated with the given processor.
-
9. The system of claim 4, wherein threads that have a real time property are stored in said global queue.
-
10. The system of claim 4, wherein a previously run thread is placed into the local dispatch queue associated with the processor that previously ran the thread.
-
11. The system of claim 4, further comprising a memory accessible by said plurality of processors, said memory comprising a register value used to notify said plurality of processors of said first thread.
-
12. The system of claim 4, further comprising a plurality of dispatchers, each associated with a respective processor.
-
13. The system of claim 12, wherein each of said plurality of local dispatch queues and said global queue has a respective lock, and wherein a dispatcher obtains said lock prior to obtaining a thread from the respective queue.
-
14. The method of claim 4 wherein threads can be executed directly from either said global queue or said local dispatch queues.
Specification