scheduler.c
Include dependency graph for scheduler.c:
![digraph {
graph [bgcolor="#00000000"]
node [shape=rectangle style=filled fillcolor="#FFFFFF" font=Helvetica padding=2]
edge [color="#1414CE"]
"9" [label="stdbool.h" tooltip="stdbool.h"]
"6" [label="atom.h" tooltip="atom.h"]
"12" [label="assert.h" tooltip="assert.h"]
"20" [label="synclist.h" tooltip="synclist.h"]
"5" [label="stdint.h" tooltip="stdint.h"]
"7" [label="stdlib.h" tooltip="stdlib.h"]
"33" [label="valueshashtable.h" tooltip="valueshashtable.h"]
"1" [label="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.c" tooltip="/home/runner/work/AtomVM/AtomVM/src/libAtomVM/scheduler.c" fillcolor="#BFBFBF"]
"2" [label="scheduler.h" tooltip="scheduler.h"]
"32" [label="exportedfunction.h" tooltip="exportedfunction.h"]
"3" [label="context.h" tooltip="context.h"]
"17" [label="utils.h" tooltip="utils.h"]
"8" [label="atom_table.h" tooltip="atom_table.h"]
"11" [label="term_typedef.h" tooltip="term_typedef.h"]
"18" [label="stddef.h" tooltip="stddef.h"]
"13" [label="limits.h" tooltip="limits.h"]
"25" [label="refc_binary.h" tooltip="refc_binary.h"]
"23" [label="string.h" tooltip="string.h"]
"16" [label="mailbox.h" tooltip="mailbox.h"]
"30" [label="module.h" tooltip="module.h"]
"22" [label="term.h" tooltip="term.h"]
"10" [label="erl_nif.h" tooltip="erl_nif.h"]
"34" [label="time.h" tooltip="time.h"]
"26" [label="resources.h" tooltip="resources.h"]
"19" [label="smp.h" tooltip="smp.h"]
"29" [label="sys.h" tooltip="sys.h"]
"31" [label="atomshashtable.h" tooltip="atomshashtable.h"]
"28" [label="debug.h" tooltip="debug.h"]
"4" [label="globalcontext.h" tooltip="globalcontext.h"]
"24" [label="memory.h" tooltip="memory.h"]
"21" [label="stdio.h" tooltip="stdio.h"]
"27" [label="timer_list.h" tooltip="timer_list.h"]
"15" [label="list.h" tooltip="list.h"]
"14" [label="inttypes.h" tooltip="inttypes.h"]
"6" -> "5" [dir=forward tooltip="include"]
"6" -> "7" [dir=forward tooltip="include"]
"20" -> "15" [dir=forward tooltip="include"]
"20" -> "21" [dir=forward tooltip="include"]
"20" -> "19" [dir=forward tooltip="include"]
"1" -> "2" [dir=forward tooltip="include"]
"1" -> "21" [dir=forward tooltip="include"]
"1" -> "28" [dir=forward tooltip="include"]
"1" -> "15" [dir=forward tooltip="include"]
"1" -> "19" [dir=forward tooltip="include"]
"1" -> "29" [dir=forward tooltip="include"]
"1" -> "17" [dir=forward tooltip="include"]
"2" -> "3" [dir=forward tooltip="include"]
"2" -> "4" [dir=forward tooltip="include"]
"32" -> "22" [dir=forward tooltip="include"]
"3" -> "4" [dir=forward tooltip="include"]
"3" -> "15" [dir=forward tooltip="include"]
"3" -> "16" [dir=forward tooltip="include"]
"3" -> "19" [dir=forward tooltip="include"]
"3" -> "22" [dir=forward tooltip="include"]
"3" -> "27" [dir=forward tooltip="include"]
"17" -> "18" [dir=forward tooltip="include"]
"8" -> "9" [dir=forward tooltip="include"]
"8" -> "6" [dir=forward tooltip="include"]
"11" -> "12" [dir=forward tooltip="include"]
"11" -> "13" [dir=forward tooltip="include"]
"11" -> "14" [dir=forward tooltip="include"]
"11" -> "5" [dir=forward tooltip="include"]
"25" -> "9" [dir=forward tooltip="include"]
"25" -> "7" [dir=forward tooltip="include"]
"25" -> "15" [dir=forward tooltip="include"]
"25" -> "26" [dir=forward tooltip="include"]
"16" -> "9" [dir=forward tooltip="include"]
"16" -> "15" [dir=forward tooltip="include"]
"16" -> "11" [dir=forward tooltip="include"]
"16" -> "17" [dir=forward tooltip="include"]
"30" -> "9" [dir=forward tooltip="include"]
"30" -> "5" [dir=forward tooltip="include"]
"30" -> "6" [dir=forward tooltip="include"]
"30" -> "8" [dir=forward tooltip="include"]
"30" -> "31" [dir=forward tooltip="include"]
"30" -> "3" [dir=forward tooltip="include"]
"30" -> "32" [dir=forward tooltip="include"]
"30" -> "4" [dir=forward tooltip="include"]
"30" -> "22" [dir=forward tooltip="include"]
"30" -> "33" [dir=forward tooltip="include"]
"22" -> "9" [dir=forward tooltip="include"]
"22" -> "5" [dir=forward tooltip="include"]
"22" -> "21" [dir=forward tooltip="include"]
"22" -> "7" [dir=forward tooltip="include"]
"22" -> "23" [dir=forward tooltip="include"]
"22" -> "24" [dir=forward tooltip="include"]
"22" -> "25" [dir=forward tooltip="include"]
"22" -> "17" [dir=forward tooltip="include"]
"22" -> "11" [dir=forward tooltip="include"]
"10" -> "11" [dir=forward tooltip="include"]
"26" -> "7" [dir=forward tooltip="include"]
"26" -> "10" [dir=forward tooltip="include"]
"26" -> "15" [dir=forward tooltip="include"]
"26" -> "24" [dir=forward tooltip="include"]
"19" -> "9" [dir=forward tooltip="include"]
"29" -> "4" [dir=forward tooltip="include"]
"29" -> "30" [dir=forward tooltip="include"]
"29" -> "5" [dir=forward tooltip="include"]
"29" -> "34" [dir=forward tooltip="include"]
"31" -> "6" [dir=forward tooltip="include"]
"28" -> "3" [dir=forward tooltip="include"]
"4" -> "5" [dir=forward tooltip="include"]
"4" -> "6" [dir=forward tooltip="include"]
"4" -> "8" [dir=forward tooltip="include"]
"4" -> "10" [dir=forward tooltip="include"]
"4" -> "15" [dir=forward tooltip="include"]
"4" -> "16" [dir=forward tooltip="include"]
"4" -> "19" [dir=forward tooltip="include"]
"4" -> "20" [dir=forward tooltip="include"]
"4" -> "22" [dir=forward tooltip="include"]
"4" -> "27" [dir=forward tooltip="include"]
"24" -> "10" [dir=forward tooltip="include"]
"24" -> "11" [dir=forward tooltip="include"]
"24" -> "17" [dir=forward tooltip="include"]
"24" -> "5" [dir=forward tooltip="include"]
"24" -> "7" [dir=forward tooltip="include"]
"27" -> "9" [dir=forward tooltip="include"]
"27" -> "5" [dir=forward tooltip="include"]
"27" -> "15" [dir=forward tooltip="include"]
}](../../../_images/graphviz-7d957cf3708d152bb9b80de96bff482713c32424.png)
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.
Cannot be called from a foreign task or from ISR.
- 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.