Expand description

Implementation of TaskManager

It is only used to manage processes and schedule process based on ready queue. Other CPU process monitoring functions are in Processor.

Structs

PID2PCB instance (map of pid to pcb)

TASK_MANAGER instance through lazy_static!

A array of TaskControlBlock that is thread-safe

Functions

Set a task to stop-wait status, waiting for its kernel stack out of use.

Add a task to ready queue

Fetch a task out of the ready queue

Insert item(pid, pcb) into PID2PCB map (called by do_fork AND ProcessControlBlock::new)

Get process by pid

Remove item(pid, _some_pcb) from PDI2PCB map (called by exit_current_and_run_next)

Remove a task from the ready queue

Wake up a task