Skip to main content
The task registry tracks up to 16 kernel tasks, each identified by a PID and carrying priority, execution state, creation tick, and display name metadata. This is a registry, not a scheduler — MVH Kernel runs on a single processor without preemptive multitasking or context switching. The registry exists to give you a consistent view of which logical tasks the kernel has created and what state each one is in.
The task registry is informational. There is no scheduler or context switching in the current release. Task states are updated by the kernel itself; you cannot forcibly suspend or resume a task through this API.

Constants

Types

task_state_t

An enumeration of all possible task execution states.

task_info_t

A snapshot of a single registered task.
uint32_t
A kernel-assigned numeric identifier that is unique within a single boot session. PIDs are assigned sequentially and are never reused.
uint8_t
A priority hint in the range [0, 255], where higher values indicate higher priority. Because there is no preemptive scheduler in the current release, this field is informational only.
task_state_t
The current execution state. Use task_state_name() to convert this value to a printable string.
uint64_t
The value of the kernel tick counter at the moment the task was registered. Use this to determine task age relative to other tasks or to the current tick.
char[24]
A null-terminated display name assigned at registration. Maximum usable length is 23 characters.

Functions

task_init

Initialise the task registry. You must call this function once during kernel startup, before calling any other task API function. Pass the current kernel tick value so that the first task’s created_tick is anchored to a meaningful timestamp.
uint64_t
required
The current kernel tick at the time of initialisation. Typically this is the tick value read from the hardware timer immediately before calling task_init.

task_count

Return the number of tasks currently registered (including tasks in any state other than TASK_UNUSED).
uint32_t
The number of active task entries, in the range [0, TASK_MAX].

task_list

Copy registered task records into a caller-supplied array. Only slots whose state is not TASK_UNUSED are included.
task_info_t *
required
Pointer to an array of task_info_t that will receive the task records. The array must be large enough to hold at least capacity elements.
uint32_t
required
The maximum number of records to write. Pass TASK_MAX to guarantee that every active task is captured.
uint32_t
The number of records written to tasks. This is min(task_count(), capacity).

task_state_name

Return a human-readable string for a task state enumerator.
task_state_t
required
Any task_state_t value.
const char *
A pointer to a null-terminated static string: "UNUSED", "RUNNING", "READY", "SLEEPING", or "STOPPED". Returns "UNKNOWN" for unrecognised values. Do not free or modify the returned pointer.

Shell Command

The built-in ps shell command prints a formatted table of every registered task, showing its PID, priority, state, creation tick, and name:

Example

The following example initialises the task registry, then lists all tasks and prints their state alongside their PID and name.