Commit beb737fa authored by Xavier Thompson's avatar Xavier Thompson

Add README.md (WIP)

parent 68aaebf5
# (*Working Title*) Typon
> typon \ti.pɔ̃\ masculin
>
> (Imprimerie) Masque, feuille transparente, sur laquelle est imprimé un motif
> dans une encre opaque qui permet d'insoler, puis de graver la plaque qui
> servira à imprimer.
>
> (Électronique) Masque transparent sur lequel sont imprimées les pistes, dans
> une encre opaque aux ultraviolets, permettant de réaliser un circuit imprimé
> par photogravure soustractive.
Typon is a three-part project to bring practical GIL-free concurrency to Python:
1. [ ] Write a C++ concurrency runtime
2. [ ] Write a compiler from Python syntax into C++
3. [ ] Add C++/Python bindings for interoperability with actual Python
Step 1 is currently in progress.
## (*in progress*) `typon/rt`, A Concurrency Runtime
A continuation-stealing concurrency runtime using cutting-edge C++20 coroutines,
featuring both `fork`/`sync` structured concurrency and `future`-based unbounded
concurrency.
### Status
- [x] structured concurrency with `fork`/`sync`
- [x] systematic exception propagation from `fork`ed tasks
- [x] unbounded concurrency with `future`
- [x] asynchronous waiting (`Promise`, `future`/`Future`)
- [ ] channels (single producer, single consumer)
- [ ] mutexes (with asynchronous blocking)
- [ ] asynchronous I/O
- [ ] builtin task cancellation
### `fork`/`sync`, Structured Concurrency
```C++
using namespace typon;
Join<int> fibo(int n) {
if (n < 2) {
co_return n;
}
// Start two potentially concurrent tasks
Forked a = co_await fork(fibo(n - 1));
Forked b = co_await fork(fibo(n - 2));
// Wait until they both complete
co_await Sync();
// Access the results
co_return a.get() + b.get();
}
```
### `future`, Unbounded Concurrency
```
using namespace typon;
Task<int> fibo(int n) {
if (n < 2) {
co_return n;
}
// Start two potentially concurrent tasks
Future a = co_await future(fibo(n - 1));
Future b = co_await future(fibo(n - 2));
// Wait for each future and retrieve the results
co_return co_await a.get() + co_await b.get();
}
```
### References
- https://en.wikipedia.org/wiki/Work_stealing#Child_stealing_vs._continuation_stealing
- https://en.wikipedia.org/wiki/Futures_and_promises
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