MOS Source Code
Loading...
Searching...
No Matches
schedule.c File Reference
+ Include dependency graph for schedule.c:

Go to the source code of this file.

Functions

char thread_state_str (thread_state_t state)
 
 MOS_SETUP ("scheduler", scheduler_cmdline_selector)
 
void scheduler_init ()
 
void unblock_scheduler (void)
 Unblock the scheduler, so that APs can start scheduling.
 
void enter_scheduler (void)
 Enter the scheduler and switch to the next thread.
 
void scheduler_add_thread (thread_t *thread)
 Add a thread to the scheduler, so that it can be scheduled.
 
void scheduler_remove_thread (thread_t *thread)
 Remove a thread from the scheduler.
 
void scheduler_wake_thread (thread_t *thread)
 Wake a thread.
 
void reschedule (void)
 reschedule.
 
void blocked_reschedule (void)
 Mark the current task as blocked and reschedule.
 
bool reschedule_for_waitlist (waitlist_t *waitlist)
 

Variables

static bool scheduler_ready = false
 
static scheduler_tactive_scheduler = NULL
 
const scheduler_info_t __MOS_SCHEDULERS_START []
 
const scheduler_info_t __MOS_SCHEDULERS_END []
 

Function Documentation

◆ thread_state_str()

char thread_state_str ( thread_state_t state)

Definition at line 14 of file schedule.c.

Referenced by _thread_do_print(), and reschedule().

◆ MOS_SETUP()

MOS_SETUP ( "scheduler" ,
scheduler_cmdline_selector  )

Definition at line 33 of file schedule.c.

+ Here is the call graph for this function:

◆ scheduler_init()

void scheduler_init ( )

Definition at line 50 of file schedule.c.

Referenced by mos_start_kernel().

◆ unblock_scheduler()

void unblock_scheduler ( void )

Unblock the scheduler, so that APs can start scheduling.

Definition at line 60 of file schedule.c.

Referenced by mos_start_kernel().

◆ enter_scheduler()

void enter_scheduler ( void )

Enter the scheduler and switch to the next thread.

Definition at line 67 of file schedule.c.

Referenced by mos_start_kernel(), and platform_ap_entry().

+ Here is the call graph for this function:

◆ scheduler_add_thread()

void scheduler_add_thread ( thread_t * thread)

Add a thread to the scheduler, so that it can be scheduled.

Parameters
thread

Definition at line 78 of file schedule.c.

Referenced by create_thread(), elf_create_process(), kthread_create(), process_do_fork(), and reschedule().

+ Here is the call graph for this function:

◆ scheduler_remove_thread()

void scheduler_remove_thread ( thread_t * thread)

Remove a thread from the scheduler.

Parameters
thread

Definition at line 85 of file schedule.c.

+ Here is the call graph for this function:

◆ scheduler_wake_thread()

void scheduler_wake_thread ( thread_t * thread)

Wake a thread.

Parameters
thread

Definition at line 91 of file schedule.c.

Referenced by signal_send_to_thread(), timer_do_wakeup(), and waitlist_wake().

◆ reschedule()

void reschedule ( void )

reschedule.

Warning
The caller must have the current thread's state_lock acquired.

Definition at line 107 of file schedule.c.

Referenced by blocked_reschedule(), enter_scheduler(), MOS_STATIC_ASSERT(), riscv64_trap_handler(), thread_exit_locked(), timer_msleep(), and x86_pit_timer_handler().

+ Here is the call graph for this function:

◆ blocked_reschedule()

void blocked_reschedule ( void )

Mark the current task as blocked and reschedule.

Definition at line 165 of file schedule.c.

Referenced by ipc_connect_to_server(), ipc_server_accept(), reschedule_for_waitlist(), and timer_msleep().

+ Here is the call graph for this function:

◆ reschedule_for_waitlist()

bool reschedule_for_waitlist ( waitlist_t * waitlist)

Definition at line 174 of file schedule.c.

Referenced by console_io_read(), futex_wait(), pipe_read(), pipe_write(), process_wait_for_pid(), and thread_wait_for_tid().

+ Here is the call graph for this function:

Variable Documentation

◆ scheduler_ready

bool scheduler_ready = false
static

Definition at line 29 of file schedule.c.

Referenced by enter_scheduler(), and unblock_scheduler().

◆ active_scheduler

◆ __MOS_SCHEDULERS_START

const scheduler_info_t __MOS_SCHEDULERS_START[]
extern

Referenced by MOS_SETUP(), and scheduler_init().

◆ __MOS_SCHEDULERS_END

const scheduler_info_t __MOS_SCHEDULERS_END[]

Definition at line 31 of file schedule.c.

Referenced by MOS_SETUP().