Class Scheduler

Class Scheduler

Placement in the overall structure

Module
thread
Base classes
Dispatcher
Derived classes
Guarded_Scheduler
Organizer
Time of creation
Task 4
Modified in
Task 6
Files
scheduler.h scheduler.cc

Description

The scheduler manages the ready list (a private Queue member of this class), which is the list of processes of type Entrant that are ready to run. The list is processed from front to back. New processes, and those that yield the processor, are appended to the end of the list.

Public methods

void ready (Entrant& that)
This method registers the process that with the scheduler. It is appended to the end of the ready list.
void schedule ()
This method starts up scheduling by removing the first process from the ready list and activating it.
void exit ()
With this method a process can terminate itself. The scheduler does not append it again to the end of the ready list. Instead, it removes the first process from the ready list and activates it. If, however, all processes are currently blocked, it must wait appropriately until one gets ready.
void kill (Entrant& that)
With this method a process can terminate another one (that). The process that is simply removed from the ready list and is thereby never scheduled again.
void resume ()
This method allows to trigger a context switch without the calling Entrant having to know which other Entrant objects exist in the system, and which of these should be activated. This decision is made by the scheduler using the entries in its ready list. In this system, it shall append the currently running process to the end of the ready list and activate the first one.