#include <scheduler.h>
Public Methods | |
| Scheduler () | |
| Initialize list of ready threads. More... | |
| ~Scheduler () | |
| De-allocate ready list. More... | |
| void | ReadyToRun (Thread *thread) |
| Thread can be dispatched. More... | |
| Thread* | FindNextToRun () |
| Dequeue first thread on the ready list, if any, and return thread. More... | |
| void | Run (Thread *nextThread, bool finishing) |
| Cause nextThread to start running. More... | |
| void | CheckToBeDestroyed () |
| Check if thread that had been running needs to be deleted. More... | |
| void | Print () |
| SelfTest for scheduler is implemented in class Thread. More... | |
Private Attributes | |
| List<Thread *>* | readyList |
| queue of threads that are ready to run, but not running. More... | |
| Thread* | toBeDestroyed |
| finishing thread to be destroyed by the next thread that runs. More... | |
Definition at line 20 of file scheduler.h.
|
|
Initialize list of ready threads. Scheduler::Scheduler Initialize the list of ready but not running threads. Initially, no ready threads. Definition at line 32 of file scheduler.cc. |
|
|
De-allocate ready list. Scheduler::~Scheduler De-allocate the list of ready threads. Definition at line 43 of file scheduler.cc. |
|
|
Check if thread that had been running needs to be deleted. Scheduler::CheckToBeDestroyed If the old thread gave up the processor because it was finishing, we need to delete its carcass. Note we cannot delete the thread before now (for example, in Thread::Finish()), because up to this point, we were still running on the old thread's stack! Definition at line 163 of file scheduler.cc. |
|
|
Dequeue first thread on the ready list, if any, and return thread. Scheduler::FindNextToRun Return the next thread to be scheduled onto the CPU. If there are no ready threads, return NULL. Side effect: Thread is removed from the ready list. Definition at line 75 of file scheduler.cc. |
|
|
SelfTest for scheduler is implemented in class Thread. Scheduler::Print Print the scheduler state -- in other words, the contents of the ready list. For debugging. Definition at line 177 of file scheduler.cc. |
|
|
Thread can be dispatched. Scheduler::ReadyToRun Mark a thread as ready, but not running. Put it on the ready list, for later scheduling onto the CPU. "thread" is the thread to be put on the ready list. Definition at line 57 of file scheduler.cc. Referenced by Thread::Fork().
|
|
|
Cause nextThread to start running. Scheduler::Run Dispatch the CPU to nextThread. Save the state of the old thread, and load the state of the new thread, by calling the machine dependent context switch routine, SWITCH. Note: we assume the state of the previously running thread has already been changed from running to blocked or ready (depending). Side effect: The global variable kernel->currentThread becomes nextThread. "nextThread" is the thread to be put into the CPU. "finishing" is set if the current thread is to be deleted once we're no longer running on its stack (when the next thread starts running) Definition at line 104 of file scheduler.cc. |
|
|
queue of threads that are ready to run, but not running.
Definition at line 38 of file scheduler.h. |
|
|
finishing thread to be destroyed by the next thread that runs.
Definition at line 40 of file scheduler.h. |
1.2.8.1 written by Dimitri van Heesch,
© 1997-2001