Struct std::Scheduler
struct Scheduler {
struct PCB procs[SCHED_MAX_PROCS];
int count;
int current;
}Fields
total number of processes
index of currently running process (-1 if none)
Methods
Add a process. Returns the process index, or -1 if full.
Select the next READY process with highest priority. Returns the index of the selected process, or -1 if none are ready.
Mark current process as READY and select the next one.
Block the current process (waiting on I/O, etc.).
Unblock a process by index (set to READY).
Remove a zombie process by index.
Return the number of READY processes.
Initialize the scheduler.