[ RCOS.java Home | RCOS Home | David's Home ]

Scheduler CRC

Name:

SchedulerHeader

Comment:

The following class defines the scheduler/dispatcher abstraction -- the data structures and operations needed to keep track of which thread is running, and which threads are ready but not running.

Collaborators:

Responsibilities:

class Scheduler {
  public:
    Scheduler();                        // Initialize list of ready threads
    ~Scheduler();                       // De-allocate ready list

    void ReadyToRun(Thread* thread);    // Thread can be dispatched.
    Thread* FindNextToRun();            // Dequeue first thread on the ready
                                        // list, if any, and return thread.
    void Run(Thread* nextThread);       // Cause nextThread to start running
    void Print();                       // Print contents of ready list

  private:
    List *readyList;            // queue of threads that are ready to run,
                                // but not running
};