|
PatchworkOS
|
Per-CPU scheduling context. More...
#include <sched.h>
Data Fields | |
| sched_queues_t | queues [2] |
| Array storing both queues. | |
| sched_queues_t * | active |
| Pointer to the currently active queue. | |
| sched_queues_t * | expired |
| Pointer to the currently expired queue. | |
| thread_t * | runThread |
| The currently running thread. | |
| 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. | |
| cpu_t * | owner |
| The cpu that owns this scheduling context. | |
Per-CPU scheduling context.
The sched_cpu_ctx_t structure holds the scheduling context for a each CPU.
| sched_queues_t* sched_cpu_ctx_t::active |
Pointer to the currently active queue.
Definition at line 106 of file sched.h.
Referenced by sched_cpu_ctx_init(), sched_get_load(), sched_invoke(), sched_load_balance(), sched_push(), and sched_push_new_thread().
| sched_queues_t* sched_cpu_ctx_t::expired |
Pointer to the currently expired queue.
Definition at line 110 of file sched.h.
Referenced by sched_cpu_ctx_init(), sched_get_load(), sched_invoke(), and sched_load_balance().
| thread_t* sched_cpu_ctx_t::idleThread |
The thread that runs when the owner CPU is idling.
This thread never changes after boot, so no need for a lock.
Definition at line 125 of file sched.h.
Referenced by panic(), sched_cpu_ctx_init(), sched_done_with_boot_thread(), sched_get_load(), sched_invoke(), sched_is_idle(), and sched_should_notify().
| lock_t sched_cpu_ctx_t::lock |
The lock that protects this context, except the zombieThreads list.
Definition at line 129 of file sched.h.
Referenced by sched_cpu_ctx_init(), sched_get_load(), sched_invoke(), sched_is_idle(), sched_load_balance(), sched_push(), and sched_push_new_thread().
| cpu_t* sched_cpu_ctx_t::owner |
The cpu that owns this scheduling context.
Definition at line 130 of file sched.h.
Referenced by sched_cpu_ctx_init().
| sched_queues_t sched_cpu_ctx_t::queues[2] |
Array storing both queues.
Should never be accessed always use the pointer active and expired as those always point to these queues.
Definition at line 102 of file sched.h.
Referenced by sched_cpu_ctx_init().
| thread_t* sched_cpu_ctx_t::runThread |
The currently running thread.
Accessing the run thread can be a bit weird; if the run thread is accessed by the currently running thread, then there is no need for a lock as it will always see the same value, itself. However, if it is accessed from another CPU, then the lock is needed.
Definition at line 119 of file sched.h.
Referenced by init_early(), panic(), sched_cpu_ctx_init(), sched_done_with_boot_thread(), sched_get_load(), sched_invoke(), sched_is_idle(), sched_should_notify(), sched_thread(), sched_thread_unsafe(), sched_yield(), wait_block_cancel(), wait_block_commit(), and wait_block_setup().