Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
typon-compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
typon
typon-compiler
Commits
3103e35b
Commit
3103e35b
authored
Jul 12, 2022
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve README.md
parent
e548de56
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
28 deletions
+88
-28
README.md
README.md
+88
-28
No files found.
README.md
View file @
3103e35b
# (*Working Title*) Typon
# (*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/rt`, A Concurrency Runtime
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,
A continuation-stealing concurrency runtime using cutting-edge C++20 coroutines,
featuring both
`fork`
/
`sync`
structured concurrency and
`future`
-based unbounded
featuring both
`fork`
/
`sync`
structured concurrency and
`future`
-based unbounded
concurrency.
concurrency.
### Status
### Status
-
[x] structured concurrency with
`fork`
/
`sync`
-
[x] structured concurrency with
`fork`
/
`sync`
-
[x] systematic exception propagation from
`fork`
ed tasks
-
[x] systematic exception propagation from
`fork`
ed tasks
-
[x] unbounded concurrency with
`future`
-
[x] unbounded concurrency with
the
`future`
primitive
-
[x] asynchronous waiting
(
`Promise`
,
`future`
/
`Future`
)
-
[x] asynchronous waiting
on
`Future`
and
`Promise`
objects
-
[ ] channels (single producer, single consumer)
-
[ ] channels (single producer, single consumer)
-
[ ] mutexes (with asynchronous blocking)
-
[ ] mutexes (with asynchronous blocking)
-
[ ] asynchronous I/O
-
[ ] asynchronous I/O
-
[ ]
builtin
task cancellation
-
[ ] task cancellation
### `fork`/`sync`, Structured Concurrency
### `fork`/`sync`, Structured Concurrency
...
@@ -56,8 +39,25 @@ Join<int> fibo(int n) {
...
@@ -56,8 +39,25 @@ Join<int> fibo(int n) {
}
}
```
```
[
Structured concurrency
](
https://en.wikipedia.org/wiki/Structured_concurrency
)
is a concurrency paradigm where parallel execution paths are always joined
before exiting the function which created them.
It makes it possible to reason locally about concurrent code, since concurrent
tasks will not outlive the current function. This makes concurrent code more
intuitive and readable, and makes it much easier to reason about memory safety
and thread safety. It also enables systematic exception propagation from
spawned tasks to the parent scope.
The
`fork`
/
`sync`
primitives mirror the
`spawn`
/
`sync`
paradigm of
[
Cilk
](
http://cilk.mit.edu/
)
.
`fork`
introduces a potentially parallel nested task.
`sync`
waits for all
the tasks forked so far in the current scope.
`fork`
/
`sync`
can only be used
inside a
`Join`
coroutine, which guarantees all forked tasks complete before
the parent
`Join`
coroutine returns, even when there is no explicit
`sync`
.
### `future`, Unbounded Concurrency
### `future`,
A Primitive for
Unbounded Concurrency
```
```
using namespace typon;
using namespace typon;
...
@@ -74,9 +74,69 @@ Task<int> fibo(int n) {
...
@@ -74,9 +74,69 @@ Task<int> fibo(int n) {
}
}
```
```
In cases when structured concurrency is too constraining, the
`future`
primitive
creates concurrent tasks that may outlive the parent scope, more like the
`go`
statement in Go. Unlike
`go`
,
`future`
immediately returns a
`Future`
object
that can be used to wait for the task to complete. If the
`Future`
object is
not used, the task becomes "detached" and lives independantly.
### Examples
See
`rt/examples`
.
### Using `rt/typon`
`typon/rt`
is a headers-only library, so no preliminary build step is required.
Programs only need to include
`rt/include/typon/typon.hpp`
.
Compiling requires
`gcc++-11`
or
`clang++-14`
or more recent.
See
`rt/examples`
for hints.
### References
### References
-
https://en.wikipedia.org/wiki/Work_stealing#Child_stealing_vs._continuation_stealing
##### Structured Concurrency
-
Nathaniel J. Smith's
[
Notes on structured concurrency
](
https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/
)
-
Martin Sústrik's blog articles on
[
structured concurrency
](
https://250bpm.com/blog:137/index.html
)
-
Lewis Baker's talk on
[
structured concurrency with C++20 coroutines
](
https://www.youtube.com/watch?v=1Wy5sq3s2rg
)
##### C++20 Coroutines
-
Lewis Baker's
[
Asymmetric Transfer blog on C++20 coroutines
](
https://lewissbaker.github.io/
)
-
[
C++20 coroutines at cppreference.com
](
https://en.cppreference.com/w/cpp/language/coroutines
)
##### Papers
-
N. S. Arora, R. D. Blumofe, and C. G. Plaxton. 1998.
Thread scheduling for multiprogrammed multiprocessors.
https://doi.org/10.1145/277651.277678
-
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
-
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
-
https://en.wikipedia.org/wiki/Futures_and_promises
-
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment