#define NORETURN
GCC noreturn function attribute.
void sched_push_new_thread(thread_t *thread, thread_t *parent)
Pushes a newly created thread onto the scheduling queue.
void sched_push(thread_t *thread, cpu_t *target)
Pushes a thread onto a scheduling queue.
process_t * sched_process(void)
Retrieves the process of the currently running thread.
NORETURN void sched_done_with_boot_thread(void)
Specify that the boot thread is no longer needed.
thread_t * sched_thread(void)
Retrieves the currently running thread.
void sched_thread_ctx_init(sched_thread_ctx_t *ctx)
Initializes a thread's scheduling context.
void sched_yield(void)
Yields the CPU to another thread.
void sched_cpu_ctx_init(sched_cpu_ctx_t *ctx, cpu_t *self)
Initializes a CPU's scheduling context.
thread_t * sched_thread_unsafe(void)
Retrieves the currently running thread without disabling interrupts.
bool sched_is_idle(cpu_t *cpu)
Checks if the CPU is idle.
_NORETURN void sched_process_exit(uint64_t status)
Exits the current process.
void sched_invoke(interrupt_frame_t *frame, cpu_t *self, schedule_flags_t flags)
The main scheduling function.
uint64_t sched_nanosleep(clock_t timeout)
Puts the current thread to sleep.
process_t * sched_process_unsafe(void)
Retrieves the process of the currently running thread without disabling interrupts.
NORETURN void sched_idle_loop(void)
The idle loop for a CPU.
schedule_flags_t
Scheduling flags.
_NORETURN void sched_thread_exit(void)
Exits the current thread.
@ SCHED_NORMAL
No special flags.
@ SCHED_DIE
Kill and free the currently running thread.
uint8_t priority_t
Priority type.
__UINT64_TYPE__ clock_t
A nanosecond time.
A simple ticket lock implementation.
Per-CPU scheduling context.
cpu_t * owner
The cpu that owns this scheduling context.
thread_t * runThread
The currently running thread.
sched_queues_t * expired
Pointer to the currently expired queue.
sched_queues_t * active
Pointer to the currently active queue.
thread_t * idleThread
The thread that runs when the owner CPU is idling.
lock_t lock
The lock that protects this context, except the zombieThreads list.
Scheduling queues structure.
uint64_t length
The total number of threads in all lists.
uint64_t bitmap
A bitmap indicating which of the lists have threads in them.
Per-thread scheduling context.
clock_t recentBlockTime
The amount of time within the last CONFIG_MAX_RECENT_BLOCK_TIME nanoseconds that the thread was block...
clock_t prevBlockCheck
The previous time when the recentBlockTime member was updated.
priority_t actualPriority
The actual priority of the thread.
clock_t deadline
The time when the time slice will actually expire, only valid while the thread is running.
clock_t timeSlice
The length of the threads time slice, used to determine its deadline when its scheduled.
Thread of execution structure.