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 themultitaskfeature 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 themultitaskandpreemptfeatures if it is enabled.sched_cfs: Use the Completely Fair Scheduler. It also enables the themultitaskandpreemptfeatures if it is enabled.
Modules
- loadavg
irqload average
Structs
- CurrentTask
multitaskA wrapper ofAxTaskRefas the current task. - TaskId
multitaskA unique identifier for a thread. - TaskInner
multitaskThe inner task structure. - WaitQueue
multitaskA queue to store sleeping tasks.
Enums
- The possible states of a task.
Functions
- current
multitaskGets the current task. - current_may_uninit
multitaskGets the current task, or returnsNoneif the current task is not initialized. - exit
multitaskExits the current task. - Get the load average
- init_scheduler
multitaskInitializes the task scheduler (for the primary CPU). - init_scheduler_secondary
multitaskInitializes the task scheduler for secondary CPUs. - on_timer_tick
multitaskandirqHandles periodic timer ticks for the task manager. - pspawn
multitaskUsed by musl - pspawn_raw
multitaskUsed by musl - put_task
multitaskUsed by musl - run_idle
multitaskThe idle task routine. - set_priority
multitaskSet 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
multitaskSpawns a new task with the default parameters. - spawn_raw
multitaskSpawns a new task with the given parameters. - Current task gives up the CPU time voluntarily, and switches to another ready task.
Type Aliases
- AxTaskRef
multitaskThe reference type of a task.