|
Serene Runtime 1.0.0
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 |
| int | 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 218 of file scheduler.c.
| atomic_intptr_t srn_worker_t::bottom |
Definition at line 229 of file scheduler.c.
| srn_fiber_t* srn_worker_t::current |
Definition at line 221 of file scheduler.c.
| int srn_worker_t::id |
Definition at line 222 of file scheduler.c.
| srn_fiber_t srn_worker_t::loop |
Definition at line 220 of file scheduler.c.
| srn_scheduler_t* srn_worker_t::sched |
Definition at line 219 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 228 of file scheduler.c.