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
I have read the roadmap and priorities and I believe this request falls within the priorities.
What is your request?
I would like to propose the addition of coroutine support in the Mojo programming language. I believe that integrating coroutine functionality would significantly enhance the language's capabilities, particularly for asynchronous programming and concurrent task management.
What is your motivation for this change?
Coroutines allow for writing asynchronous code in a more sequential and readable manner. They enable developers to pause and resume functions, making it easier to manage tasks that involve waiting for I/O operations or other time-consuming processes without blocking the main execution thread.
Any other details?
To illustrate the potential of coroutine support, I have implemented a sample code that utilizes the PhotonLibOS library, which provides coroutine capabilities. Below is a simplified version of the code:
I believe that adding coroutine support to Mojo would not only improve the language's usability but also attract more developers looking for efficient ways to handle asynchronous programming. I look forward to your thoughts on this proposal and am happy to assist in any way to help implement this feature.
Thank you for considering this request!
The text was updated successfully, but these errors were encountered:
Mojo already has very WIP support for coroutines and async/await, but there's a group of us arguing over how exactly they should be implemented since Mojo aims to use the state of the art and solve all of the problems as best we can, instead of rushing toward familiar solutions. I personally lean away from stackful coroutines (what Photon has) due to the cost of maintaining the stack. There's also discussion around whether we want a form of structured concurrency to help manage async cancellation and similar problems that show up in most languages with coroutines.
I recommend considering the thread-per-core model used in the Monoio library developed by ByteDance. This approach might provide valuable insights as the team continues to explore coroutine implementation. You can find more information about Monoio here: https://github.com/bytedance/monoio.
I recommend considering the thread-per-core model used in the Monoio library developed by ByteDance. This approach might provide valuable insights as the team continues to explore coroutine implementation. You can find more information about Monoio here: https://github.com/bytedance/monoio.
I am aware of this. However, my current design is likely going to bend everything towards the state of the art (io_uring, DPDK, SPDK, etc) and make less capable APIs eat the costs. The POSIX-style API has a lot of disadvantages and starts to eat large amounts of memory bandwidth at higher IO rates. Something which does a better job of encouraging zero-copy, such as an abstraction over io_uring provided buffers, should work better for most people even if the API looks foreign at first. kTLS is also something we want to support, since crypto-capable NICs are far more common than they used to be.
Review Mojo's priorities
What is your request?
I would like to propose the addition of coroutine support in the Mojo programming language. I believe that integrating coroutine functionality would significantly enhance the language's capabilities, particularly for asynchronous programming and concurrent task management.
What is your motivation for this change?
Coroutines allow for writing asynchronous code in a more sequential and readable manner. They enable developers to pause and resume functions, making it easier to manage tasks that involve waiting for I/O operations or other time-consuming processes without blocking the main execution thread.
Any other details?
To illustrate the potential of coroutine support, I have implemented a sample code that utilizes the PhotonLibOS library, which provides coroutine capabilities. Below is a simplified version of the code:
I believe that adding coroutine support to Mojo would not only improve the language's usability but also attract more developers looking for efficient ways to handle asynchronous programming. I look forward to your thoughts on this proposal and am happy to assist in any way to help implement this feature.
Thank you for considering this request!
The text was updated successfully, but these errors were encountered: