Commit 68aaebf5 authored by Xavier Thompson's avatar Xavier Thompson

Add comments to scheduler.hpp and stack.hpp

parent 6d64f7d0
#ifndef TYPON_SCHEDULER_HPP_INCLUDED #ifndef TYPON_SCHEDULER_HPP_INCLUDED
#define TYPON_SCHEDULER_HPP_INCLUDED #define TYPON_SCHEDULER_HPP_INCLUDED
/* Continuation-stealing scheduler */
/* Papers:
. N. S. Arora, R. D. Blumofe, and C. G. Plaxton. 1998.
Thread scheduling for multiprogrammed multiprocessors.
https://doi.org/10.1145/277651.277678
. C. X. Lin, T .W Huang, and M. D. F. Wong. 2020.
An efficient work-stealing scheduler for task dependency graph.
https://tsung-wei-huang.github.io/papers/icpads20.pdf
. F. Schmaus, N. Pfeiffer, W. Schröder-Preikschat, T. Hönig, and J. Nolte.
2021. Nowa: a wait-free continuation-stealing concurrency platform.
https://www4.cs.fau.de/Publications/2021/schmaus2021nowa.pdf
*/
#include <atomic> #include <atomic>
#include <bit> #include <bit>
#include <coroutine> #include <coroutine>
......
#ifndef TYPON_FUNDAMENTAL_STACK_HPP_INCLUDED #ifndef TYPON_FUNDAMENTAL_STACK_HPP_INCLUDED
#define TYPON_FUNDAMENTAL_STACK_HPP_INCLUDED #define TYPON_FUNDAMENTAL_STACK_HPP_INCLUDED
/* Work-stealing deque */
/* A stack of continuations that may be stolen and resumed concurrently.
Continuations are pushed when a potentially concurrent child task is
started and popped when the child completes, unless stolen first by a
concurrent worker. Thieves steal from the oldest continuations first,
while completed children tasks try to resume the most recent.
Furthermore, the whole stack may be suspended while waiting for an
asynchronous operation. In that case thieves may still steal but the
most recent child task is suspended. Suspended stacks will be enabled
when the asynchronous operation completes, at which point a thief may
take over the whole stack and resume the suspended child task.
There are five possible states:
- ACTIVE: A worker is actively running a child task.
- WAITING: Waiting on an asynchronous operation.
- EMPTY: Like WAITING, but no continuation remains unstolen.
- READY: A thief may take the whole stack and resume the suspended task.
- DONE: No more task remains, suspended or otherwise.
Papers:
. D. Chase and Y. Lev. 2005.
Dynamic circular work-stealing deque.
https://doi.org/10.1145/1073970.1073974
. N. M. Lê, A. Pop, A. Cohen, and F. Zappa Nardelli. 2013.
Correct and efficient work-stealing for weak memory models.
https://doi.org/10.1145/2517327.2442524
. Kyle Singer, Yifan Xu, and I-Ting Angelina Lee. 2019.
Proactive work stealing for futures.
https://doi.org/10.1145/3293883.3295735
*/
#include <atomic> #include <atomic>
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment