scheduler.c
Include dependency graph for scheduler.c:
Defines
-
SMP_SPINLOCK_LOCK(spinlock) smp_spinlock_lock(spinlock)
-
SMP_SPINLOCK_UNLOCK(spinlock) smp_spinlock_unlock(spinlock)
-
SMP_MUTEX_LOCK(mtx) smp_mutex_lock(mtx)
-
SMP_MUTEX_TRYLOCK(mtx) smp_mutex_trylock(mtx)
-
SMP_MUTEX_UNLOCK(mtx) smp_mutex_unlock(mtx)
Functions
-
static void scheduler_timeout_callback(struct TimerListItem *it)
-
static int update_timer_list(GlobalContext *global)
-
Context *scheduler_wait(Context *ctx)
move a process to waiting queue and wait a ready one
move current process to the waiting queue, and schedule the next one or sleep until an event is received.
- Parameters:
c – the process context.
-
static Context *scheduler_run0(GlobalContext *global)
-
Context *scheduler_run(GlobalContext *global)
run the scheduler and return a process to be executed.
- Parameters:
global – the global context.
-
Context *scheduler_next(GlobalContext *global, Context *c)
gets next runnable process from the ready queue.
gets next runnable process from the ready queue, it may return current process if there isn’t any other runnable process.
- Parameters:
global – the global context.
c – the current process.
- Returns:
runnable process.
-
void scheduler_init_ready(Context *c)
Init a process in the ready state, moving it to the scheduler queue.
- Parameters:
c – the process context.
-
void scheduler_signal_message(Context *c)
Signal a process that a message was inserted in the mailbox.
- Parameters:
c – the process context.
-
void scheduler_terminate(Context *ctx)
removes a process and terminates it from the scheduling queue
removes a process from the scheduling ready queue and destroys it if its not a leader process.
- Parameters:
c – the process that is going to be terminated.
-
void scheduler_stop_all(GlobalContext *global)
Terminate all schedulers. Every process is terminated gracefully at next scheduling point.
- Parameters:
global – the global context.
-
void scheduler_set_timeout(Context *ctx, avm_int64_t timeout)
sets context timeout
set context timeout timestamp, move context to wait queue and update global next timeout timestamp.
- Parameters:
ctx – the context that will be put on sleep
timeout – amount of time to be waited in milliseconds.