|
Serene Runtime 1.0.0-dev
C runtime for the Serene programming language
|
The state one os thread uses to run fibers. More...
Data Fields | |
| srn_scheduler_t * | sched |
| srn_fiber_t | loop |
| srn_fiber_t * | current |
| srn_worker_id_t | id |
| atomic_intptr_t | top |
| Chase-Lev deque. | |
| atomic_intptr_t | bottom |
The state one os thread uses to run fibers.
The worker's loop (loop) represents the os thread itself and is the resumer for every fiber this worker runs. Each worker owns a lock free Chase-Lev work stealing deque. The owner pushes and pops the bottom end, while thieves take from the top end. So the common push and pop touch no lock, and only a steal contends.
Definition at line 228 of file scheduler.c.
| atomic_intptr_t srn_worker_t::bottom |
Definition at line 240 of file scheduler.c.
| srn_fiber_t* srn_worker_t::current |
Definition at line 231 of file scheduler.c.
| srn_worker_id_t srn_worker_t::id |
Definition at line 232 of file scheduler.c.
| srn_fiber_t srn_worker_t::loop |
Definition at line 230 of file scheduler.c.
| srn_scheduler_t* srn_worker_t::sched |
Definition at line 229 of file scheduler.c.
| atomic_intptr_t srn_worker_t::top |
Chase-Lev deque.
top and bottom are signed and monotonically increasing (signed so the transient bottom - 1 on an empty deque does not wrap), and the live slot for an index is index & (SRN_FIBER_LOCAL_RING_CAP - 1). TODO(lxsameer): Make the ring capacity configurable via CLI args.
Definition at line 239 of file scheduler.c.