Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple question #92

Open
Pismice opened this issue Apr 3, 2024 · 1 comment
Open

Simple question #92

Pismice opened this issue Apr 3, 2024 · 1 comment

Comments

@Pismice
Copy link

Pismice commented Apr 3, 2024

Hello,

First let me just say that I am sorry because it probably isnt the place to ask such questions but I didnt find any other :(

My question is: can the completions be compared to green threads or did I misunderstand something ?

Sorry for the disturbance and I wish you a nice day 😃

@gerbyzation
Copy link

Someone correct me if I'm wrong but to my understanding in general green threads are something different beyond that they both provide an async programming model. Green threads provide a concurrent programming model by essentially providing "virtual" threads to execute arbitrary units of work. The virtual threads are scheduled by the runtime on the same thread and/or additional threads (probably on less threads than the number of green/virtual threads) and run in userspace.

What this library (and the underlying APIs this abstracts such as kqueue and io_uring) provide is an asynchronous API for I/O operations and some other system calls. Syscalls are handled by the OS kernel so it's not possible to schedule your own code in this event loop. Essentially it passes a message to the OS kernel to ask it to do some work for you (read from a file for example), and it'll let you know when the requested work has been completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants