|
PatchworkOS
19e446b
A non-POSIX operating system.
|
#include <kernel/sched/wait.h>#include <kernel/sync/lock.h>#include <kernel/utils/rbtree.h>#include <sys/defs.h>#include <sys/list.h>#include <sys/proc.h>Go to the source code of this file.
Data Structures | |
| struct | sched_client_t |
| Per-thread scheduler context. More... | |
| struct | sched_t |
| Per-CPU scheduler. More... | |
Macros | |
| #define | SCHED_FIXED_POINT (63LL) |
| The bits used for the fractional part of a virtual clock or lag value. | |
| #define | SCHED_FIXED_ZERO ((int128_t)0) |
| Fixed-point zero. | |
| #define | SCHED_EPSILON (10LL) |
| The minimum difference between two virtual clock or lag values to consider then unequal. | |
| #define | SCHED_FIXED_TO(x) (((int128_t)(x)) << SCHED_FIXED_POINT) |
| Convert a regular integer to fixed-point representation. | |
| #define | SCHED_FIXED_FROM(x) ((int64_t)((int128_t)(x) >> SCHED_FIXED_POINT)) |
| Convert a fixed-point value to a regular integer. | |
| #define | SCHED_WEIGHT_MAX (PRIORITY_MAX + SCHED_WEIGHT_BASE) |
| The maximum weight a thread can have. | |
| #define | SCHED_WEIGHT_BASE 1 |
| Base weight added to all threads. | |
| #define | SCHED_SCOPE() |
| Disable preemption for the duration of the current scope. | |
Typedefs | |
| typedef struct process | process_t |
| typedef struct thread | thread_t |
| typedef struct sched | sched_t |
| typedef int128_t | vclock_t |
| Virtual clock type. | |
| typedef int128_t | lag_t |
Functions | |
| void | sched_client_init (sched_client_t *client) |
| Initialize the scheduler context for a thread. | |
| _NORETURN void | sched_start (thread_t *bootThread) |
| Starts the scheduler by jumping to the boot thread. | |
| void | sched_submit (thread_t *thread) |
| Submits a thread to the scheduler. | |
| void | sched_do (interrupt_frame_t *frame) |
| Perform a scheduling operation. | |
| bool | sched_is_idle (cpu_t *cpu) |
| Checks if the CPU is currently idle. | |
| uint64_t | sched_nanosleep (clock_t timeout) |
| Sleeps the current thread for a specified duration in nanoseconds. | |
| void | sched_yield (void) |
| Yield the current thread's time slice to allow other threads to run. | |
| void | sched_disable (void) |
| Disables preemption on the current CPU. | |
| void | sched_enable (void) |
| Enables preemption on the current CPU. | |
| _NORETURN void | sched_exits (const char *status) |
| Terminates the currently executing process and all it's threads. | |
| _NORETURN void | sched_thread_exit (void) |
| Terminates the currently executing thread. | |
| _NORETURN void | sched_idle_loop (void) |
| The idle loop for the scheduler. | |
| static void | sched_scope_cleanup (int *_) |
Variables | |
| sched_t PERCPU | _pcpu_sched |
| The per CPU scheduler. | |