# Module os::task

source · [−]
Expand description

Task management implementation

Everything about task management, like starting and switching tasks is implemented here.

A single global instance of `TaskManager` called `TASK_MANAGER` controls all the tasks in the operating system.

Be careful when you see `__switch` ASM function in `switch.S`. Control flow around this function might not be what you expect.

## Modules

context 🔒

Implementation of `TaskContext`

switch 🔒

Rust wrapper around `__switch`.

task 🔒

Types related to task management

## Structs

TASK_MANAGER

Global variable: TASK_MANAGER

TaskContext

Task Context

TaskManager

The task manager, where all the tasks are managed.

TaskManagerInner

Inner of Task Manager

## Functions

exit_current_and_run_next

exit current task, then run next task

mark_current_exited 🔒

exit current task

mark_current_suspended 🔒

suspend current task

run_first_task

run first task

run_next_task 🔒

rust next task

suspend_current_and_run_next

suspend current task, then run next task