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

General docs update -- braindump to be written up #73

Open
joshring opened this issue Oct 10, 2024 · 2 comments
Open

General docs update -- braindump to be written up #73

joshring opened this issue Oct 10, 2024 · 2 comments

Comments

@joshring
Copy link
Contributor

joshring commented Oct 10, 2024

  • Async code has its problems, we are planning to implement more flexible concept which should generalise well across not just IO, but work well for task queues, embedded realtime programming and distributed systems.
  • C3 can work with C++ if C++ exposes a C-compatible interface to it's code hiding the C++ specific symantics.

Async Design Problems

  • Async code solves the problem of single threaded code wanting to execute non-blocking tasks concurrently and was popularised by Javascript.
  • This design has lead to concepts like function colour, where async functions only works with other async functions and this is common in Javascript and Python where it has caused extra complexity and has split their ecosystems.
  • This design does not work well for other use-cases, like multithreaded compute or hard realtime applications.

Coroutines

  • The approach used by Go in contrast is to create cheap coroutines (aka "goroutines" or "green threads") and allow code running on those coroutines which would wait on IO to give the thread to another piece of work which needs to make progress while it waits on IO.
  • This design works well for IO, but does not work nearly as well for other use-cases, like multithreaded compute or hard realtime applications.

The General Solution Proposal

  • Flexible syntax to allow you to make the trade-offs appropriate to your use-case.
  • Customise your own scheduler, with options suitable to your use-case.
  • Control dependencies between tasks
  • Control timeouts
  • Control what can be cancelled and when
  • Control task priority
  • Control interrupts to prioritise tasks
  • Define actions on failure, eg logging, restart task etc.
  • This is at proposal stage and needs your help, more details of the proposal.

TODO:

  • We should add “how to iterate over a map” to the FAQ
  • Probably also something why interfaces are limited and how they should be used
@joshring joshring changed the title General docs update General docs update -- braindump to be written up Oct 10, 2024
@lerno
Copy link
Contributor

lerno commented Oct 11, 2024

I would say that there is no general solution, and trying to find general solutions are doomed to failure.

What we should / can do is to provide different library features, with varying degrees of control and behaviour. For example, we might provide different kinds of thread pools, event handlers/listeners etc. These should come from proven solutions.

EVERYONE wants to solve concurrency, but what people tend to forget is that there will be no on-size-fits-all solution.

Let's instead focus on providing good niche solutions and good libraries to support those solutions and others that people might want to create.

@joshring
Copy link
Contributor Author

flexible syntax to allow you to make the trade-offs appropriate to your use-case.
Customise your own scheduler, with options suitable to your use-case.

I think we agree, let's find some suitable schedulers we can borrow from

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