Expand description
ArceOS task management module.
This module provides primitives for task management, including task creation, scheduling, sleeping, termination, etc. The scheduler algorithm is configurable by cargo features.
Cargo Features
multitask
: Enable multi-task support. If it’s enabled, complex task management and scheduling is used, as well as more task-related APIs. Otherwise, only a few APIs with naive implementation is available.irq
: Interrupts are enabled. If this feature is enabled, timer-based APIs can be used, such assleep
,sleep_until
, andWaitQueue::wait_timeout
.preempt
: Enable preemptive scheduling.sched_fifo
: Use the FIFO cooperative scheduler. It also enables themultitask
feature if it is enabled. This feature is enabled by default, and it can be overriden by other scheduler features.sched_rr
: Use the Round-robin preemptive scheduler. It also enables themultitask
andpreempt
features if it is enabled.sched_cfs
: Use the Completely Fair Scheduler. It also enables the themultitask
andpreempt
features if it is enabled.
Structs
- CurrentTask
multitask
A wrapper ofAxTaskRef
as the current task. - The status of the scheduler
- TaskId
multitask
A unique identifier for a thread. - TaskInner
multitask
The inner task structure used as the minimal unit of scheduling. - WaitQueue
multitask
A queue to store sleeping tasks.
Enums
- The policy of the scheduler
- The possible states of a task.
Statics
- The exited task-queue of the kernel.
- The idle task of the kernel.
- The running task-queue of the kernel.
Functions
- current
multitask
Gets the current task. - current_check_preempt_pending
multitask
Checks if the current task should be preempted. - current_may_uninit
multitask
Gets the current task, or returnsNone
if the current task is not initialized. - exit
multitask
Exits the current task. - init_scheduler
multitask
Initializes the task scheduler (for the primary CPU). - init_scheduler_secondary
multitask
Initializes the task scheduler for secondary CPUs. - join
multitask
Current task is going to sleep, it will be woken up when the given task exits. - new_task
multitask
Create a new task. - on_timer_tick
multitask
Handles periodic timer ticks for the task manager. - run_idle
multitask
The idle task routine. - set_priority
multitask
Set the priority for current task. - Current task is going to sleep for the given duration.
- Current task is going to sleep, it will be woken up at the given deadline.
- spawn
multitask
Spawns a new task with the default parameters. - spawn_raw
multitask
Spawns a new task with the given parameters. - vfork_suspend
multitask
Current task is going to sleep. It will be woken up when the given task does exec syscall or exit. - wake_vfork_process
multitask
To wake up the task that is blocked because vfork out of current task - Current task gives up the CPU time voluntarily, and switches to another ready task.
Type Aliases
- AxTaskRef
multitask
The reference type of a task.