8000 Virtual/lightweight/green threads · Issue #323 · jank-lang/jank · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Virtual/lightweight/green threads #323

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

Open
amano-kenji opened this issue Apr 13, 2025 · 2 comments
Open

Virtual/lightweight/green threads #323

amano-kenji opened this issue Apr 13, 2025 · 2 comments
8000

Comments

@amano-kenji
Copy link
amano-kenji commented Apr 13, 2025

Core.async go blocks are lightweight threads implemented as state machine. JVM virtual threads are supported by JVM. Have you thought about this?

JVM virtual threads haven't yet solved file I/O capturing and native pinning. File I/O capturing could be solved on linux with io_uring, but java developers decided to delay adoption of io_uring. Native pinning hasn't been solved yet because java developers think native pinning might be rare.

In core.async go blocks, parking operations don't cross function boundaries because state machines don't catch parking operations in functions called in go blocks. If you have virtual threads, blocking channel operations will park the virtual threads.

@jeaye
Copy link
Member
jeaye commented Apr 13, 2025

The green thread space within C++ is quite immature, based on what I've seen. C++20 introduce rudimentary coroutine support, but it's more about providing legos for you to build your own coroutine. Some libraries have built around this, such as folly::coro. Others, like boost.asio fibers provide their own framework for this.

I don't know if there are clear winners yet. Furthermore, there isn't a clear set of winners for actual async libs for doing various types of IO. From what I've seen, boost.asio likely is most popular here, but that's more because it's been around longer.

For jank, we will choose an option, but ultimately this is low priority right now. We're still building out the core functionality of the language, solving packaging and distribution, etc. We may not tackle green threads for another year or more, unless someone else from the community drives it forward.

@amano-kenji
Copy link
Author

I just wanted to document the issue without any expectation of timeline. If all else fails, we can still have core.async go blocks.

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

No branches or pull requests

2 participants
0