Struct std::PCB
struct PCB {
int pid;
int state;
int priority;
unsigned long stack_ptr;
unsigned long pc;
unsigned long page_table;
int parent_pid;
int exit_code;
}Fields
process ID
PROC_READY, PROC_RUNNING, etc.
scheduling priority (higher = more important)
saved stack pointer
saved program counter
physical address of page table root
parent process ID (-1 if none)
exit code (valid when ZOMBIE)
Methods
Set process state.
Set process priority.
Save context (stack pointer + program counter).
Mark process as zombie with the given exit code.
§
static struct PCB new(
int pid,
unsigned long entry,
unsigned long sp,
unsigned long page_table,
)source · definitionInitialize a PCB with the given pid, entry point, and stack.