You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,11 @@
5
5
6
6
## Intro
7
7
8
-
Photon is a minimalistic multi-threaded fiber scheduler and event loop that works transparently with traditional blocking I/O C/C++/D/Rust libraries w/o degrading performance. For example one can run multituide of downloads with `std.net.curl` with fibers, no blocking - it is as fast as threads but using less resources. Think of it as Golang style concurrency that is brought to D transparently.
8
+
Photon is a minimalistic multi-threaded fiber scheduler and event loop that works transparently with traditional blocking I/O C/C++/D/Rust libraries w/o degrading performance. For example one can run a multitude of downloads with `std.net.curl` with fibers, no blocking - it is as fast as threads but using less resources. Think of it as Golang style concurrency that is brought to D transparently.
9
9
10
-
Just like its particle cousing, Photon’s nature is dual, seeking to unify 2 different concepts (such as async and blocking I/O) in many ways:
11
-
Fibers and Threads can be mixed and matched in coherent way.
12
-
LibC syscall wrapper is overriden to be aware of D fiber scheduling and transparently uses the same eventloop if called on fiber and is passed through otherwise.
10
+
Just like its particle cousin, Photon’s nature is dual, seeking to unify 2 different concepts (such as async and blocking I/O) in many ways:
11
+
Fibers and Threads can be mixed and matched in a coherent way.
12
+
LibC syscall wrapper is overriden to be aware of D fiber scheduling and transparently uses the same eventloop if called on a fiber and is passed through otherwise.
13
13
14
14
Explicit async model with tasks/futures could be integrated with pseudoblocking fiber scheduling,
15
15
D Ranges with asynchronous event streams are a natural extension looking forward.
@@ -80,8 +80,8 @@ Specifically note the points of interaction 1-4:
80
80
81
81
What's important to understand is that all of the above can be mixed and matched (and in fact inevitably will, if we are not careful). To underline the problem:
82
82
- explicit async mixes well with explicit async of the same flavor, badly with any other model. But at least it's an explicit problem that can be solved on per use case basis.
83
-
- pseudoblocking only works if everything is following pseudoblocking model, also explicit async can integrate passably well, any single blocking primitive rapidly degrades pseudoblocking model
84
-
- finally blocking I/O is bane of all, it trivially spills through into any other model code with disastrous consequences
83
+
- pseudoblocking only works if everything is following a pseudoblocking model, also explicit async can integrate passably well, any single blocking primitive rapidly degrades pseudoblocking model
84
+
- finally blocking I/O is the bane of all, it trivially spills through into any other model code with disastrous consequences
85
85
86
86
The end result is a brittle ecosystem where even if you have a 3rd party "driver" for your database it is likely not compatible with your I/O scheme, and the most widely compatible scheme (blocking I/O) is not scalable. Some libraries have 2 versions - one on top of vibe.d sockets and the other on top of std.socket.
87
87
@@ -90,6 +90,6 @@ The end result is a brittle ecosystem where even if you have a 3rd party "driver
90
90
This project is going for a bold approach to solve this problem once and for all:
91
91
1. Replacing the libc syscall wrapper so that any blocking call relying on it (which is next to all) is transparently rewired to go through pseudoblocking runtime. All 3rd party libraries do fiber-aware pseudoblocking I/O automatically.
92
92
2. The rest of the libraries that do explicit async I/O stay as their are, their syscall are passed through. In the future we will intercept them as well to re-route to our eventloop, basically emulating the likes of `select`, `poll` and `epoll` in user-space by reusing the same event cache.
93
-
3. Finally vibe.d may produce a thin-shelled version that forward all of calls to blocking I/O to reuse our scheduler.
93
+
3. Finally vibe.d may produce a thin-shelled version that forwards all calls to blocking I/O to reuse our scheduler.
94
94
95
-
Note: the approach of overriding underlying libc facilities is not something new or uncalled for, e.g. jemalloc does it fitfully to replace default libc memory allocator.
95
+
Note: the approach of overriding underlying libc facilities is not something new or uncalled for, e.g. jemalloc does it fitfully to replace the default libc memory allocator.
0 commit comments