std1.0.0-beta-7 SafeC docs

std :: kernel::scheduler

Struct std::Scheduler

#include <std/kernel/scheduler.h> source

struct Scheduler {
    struct PCB procs[SCHED_MAX_PROCS];
    int count;
    int current;
}

Fields

§int countsource

total number of processes

§int currentsource

index of currently running process (-1 if none)

Methods

§int spawn_proc(&PCB proc)source · definition

Add a process. Returns the process index, or -1 if full.

§int next()source · definition

Select the next READY process with highest priority. Returns the index of the selected process, or -1 if none are ready.

§int yield()source · definition

Mark current process as READY and select the next one.

§void block_current()source · definition

Block the current process (waiting on I/O, etc.).

§void unblock(int idx)source · definition

Unblock a process by index (set to READY).

§void remove(int idx)source · definition

Remove a zombie process by index.

§int ready_count() constsource · definition

Return the number of READY processes.

§static struct Scheduler new()source · definition

Initialize the scheduler.