open-coroutine
The open-coroutine
is a simple, efficient and generic stackful-coroutine library.
Status
Still under development, please do not
use this library in the production
environment !
How to use this library ?
step1: add dependency to your Cargo.toml
[]
# check https://crates.io/crates/open-coroutine
= "x.y.z"
step2: add macro
step3: enjoy the performance improvement brought by open-coroutine !
Examples
Amazing preemptive schedule
Note: not supported for windows
outputs
coroutine1 launched
loop1
coroutine2 launched
loop2
coroutine3 launched
loop1
loop2 end
loop1 end
Arbitrary use of blocking syscalls
outputs
nanosleep hooked
Features
todo
-
support scalable stack
-
support and compatibility for AF_XDP socket
-
hook other syscall maybe interrupt by signal
- open
- chdir
- chroot
- mkdir
- rmdir
- link
- unlink
- readlink
- stat
- dup
- dup2
- umask
- mount
- umount
- mknod
- fcntl
- truncate
- ftruncate
- setjmp
- longjmp
- chown
- lchown
- fchown
- chmod
- fchmod
- fchmodat
- semop
- ppoll
- pselect
- io_getevents
- semop
- semtimedop
- msgrcv
- msgsnd
-
support
#[open_coroutine::join]
macro to wait coroutines
0.5.x
- refactor syscall state, distinguish between state and innerState
0.4.x
- Supports and is compatible with io_uring in terms of local file IO
- elegant shutdown
- use log instead of println
- enhance
#[open_coroutine::main]
macro - refactor hook impl, no need to publish dylibs now
-
Monitor
follow thethread-per-core
guideline -
EventLoop
follow thethread-per-core
guideline
0.3.x
-
supportgenawaiter
as low_level stackless coroutine (can't support it due to hook) - use
corosensei
as low_level coroutine - support backtrace
- support
#[open_coroutine::co]
macro - refactor
WorkStealQueue
0.2.x
-
use correct
epoll_event
struct -
use
rayon
for parallel computing -
support
#[open_coroutine::main]
macro -
hook almost all
read
syscall- recv
- readv
- pread
- preadv
- recvfrom
- recvmsg
-
hook almost all
write
syscall- send
- writev
- sendto
- sendmsg
- pwrite
- pwritev
-
hook other syscall
- sleep
- usleep
- nanosleep
- connect
- listen
- accept
- shutdown
- poll
- select
0.1.x
- basic suspend/resume supported
- use jemalloc as memory pool
- higher level coroutine abstraction supported
- preemptive scheduling supported
- work stealing supported
- sleep system call hooks supported