[][src]Module sunrise_kernel::scheduler

The Completly Unfair Scheduler

Statics

CURRENT_THREAD

An Arc to the currently running thread.

SCHEDULE_QUEUE

The schedule queue

Functions

add_to_schedule_queue

Adds a thread at the end of the schedule queue, and changes its state to 'scheduled' Thread must be ready to be scheduled.

create_first_process

Creates the very first process at boot. The created process has 1 thread, which is marked as the current thread, and added to the schedule queue.

find_next_thread_to_run

Parses the queue to find the first unlocked process. Returns the index of found process

get_current_process

Gets the ProcessStruct of the current thread, incrementing its refcount.

get_current_thread

Gets the current ThreadStruct, incrementing its refcount.

internal_schedule

Internal impl of the process switch, used by schedule and unschedule.

is_in_schedule_queue

Checks if a thread is already either in the schedule queue or currently running.

schedule

Performs a process switch.

scheduler_first_schedule

The function called when a thread was scheduled for the first time, right after the arch-specific process switch was performed.

set_current_thread

Sets the current ThreadStruct.

try_get_current_process

Gets the ProcessStruct of the current thread, incrementing its refcount. Will return None if we're in an early boot state, and it has not yet been initialized.

try_get_current_thread

Gets the current ThreadStruct, incrementing its refcount. Will return None if we're in an early boot state, and it has not yet been initialized.

unschedule

Removes the current thread from the schedule queue, and schedule.