216aabe629 | ||
---|---|---|
.. | ||
README.md |
README.md
Taskpools architecture
Taskpools architecture is a simple threadpool with work-stealing to handle unbalanced workloads.
Architecture
Processing steps
- On a
spawn
expression, thread i packages the function call in a task. - It enqueues it in it's own dequeue.
- It notify_one a condition variable that holds all sleeping threads.
- The notified thread wakes up and
- The notified thread randomly tries to steal a task in a worker.
- If no tasks are found, it goes back to sleep.
- Otherwise it runs the task.
- On a
sync
statement, it runs task in its own task dequeue or steal a task from another worker. - Once the
sync
task is ready, it can run the following statements (continuation).