Rendered at 20:44:07 GMT+0000 (Coordinated Universal Time) with Cloudflare Workers.
Neywiny 3 days ago [-]
If other threads can pull out of the dequeue, is there an advantage to not just having one common dequeue for all threads?
enduku 3 days ago [-]
Yes: contention and locality.
In Cactus the fast path is local. A worker pushes its own continuation onto its own deque, runs the child, and later tries to reclaim that continuation locally. Other workers only touch that deque when they become idle and steal.
With one global deque, every fork/pop/steal hits the same shared structure, making it a cache-coherency hotspot.
Per-worker deques make the common case mostly uncontended; stealing is only the load-balancing fallback.
So a global deque is simpler, but it scales worse.
In Cactus the fast path is local. A worker pushes its own continuation onto its own deque, runs the child, and later tries to reclaim that continuation locally. Other workers only touch that deque when they become idle and steal.
With one global deque, every fork/pop/steal hits the same shared structure, making it a cache-coherency hotspot.
Per-worker deques make the common case mostly uncontended; stealing is only the load-balancing fallback.
So a global deque is simpler, but it scales worse.