News for hackers. Stuff that matters.
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by pjmlp on Thursday July 02, 2026 @04:11PM (#48766719)
This looks kind of outdated, especially since we are on C++23 as latest approved standard, and co-routines would be a better approach since C++20.

Also how is the supposed Swift rewrite going on?

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by hiyfsch on Thursday July 02, 2026 @09:04PM (#48769406)
Just because coroutines exist doesn’t mean everything should use them for concurrency.

Why would it be better? It’s pretty easy to set up threads in general.

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by Rohansi on Thursday July 02, 2026 @10:12PM (#48769912)
Threads use more system resources than coroutines so it can be a big deal when you can potentially have thousands of them running.
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by hiyfsch on Friday July 03, 2026 @10:12AM (#48775307)
Yeah I guess also depends on the problem space. For example, dedicated threads doing something versus a bunch of short-lived asynchronous tasks that need scheduling anyhow.

If a bunch of tasks need to be schedule best not to have to reinvent the wheel on that if possible.

If there’s longer running tasks the benefits probably are less noticeable.

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by alfiedotwtf on Friday July 03, 2026 @01:19AM (#48771076)
The management to handle Threading and IO and not get it wrong is pretty high unless you’re using something like Rust because it guarantees you’re safe, vs letting the routine runtime management handle everything for you for free
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by whizzter on Friday July 03, 2026 @04:02AM (#48772234)
Nah, coroutines/async/etc often lives in various threads (ie, the workers can schedule one of them on different threads during the lifetime and they live concurrently), so you still have all the issues of threading (+ new ones since things like thread-local variables aren't reliable if an async/coroutines moves threads between calls).

The main benefit is not having the cost of threads, f.ex. a default thread on Windows has something like 500k of stack iirc, scale that to 10000 concurrent requests and you're looking at 5gb of memory _just for stacks_, compared to a couroutine,etc that has perhaps a few kb's of usage (even if in deep stack-traces).

This is why we have stuff like io_uring these days, the bottleneck moved to the kernel calls (especially with Spectre style attacks) when concurrent costs in the applications went down.

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by menaerus on Friday July 03, 2026 @04:55AM (#48772616)
> Nah, coroutines/async/etc often lives in various threads (ie, the workers can schedule one of them on different threads during the lifetime and they live concurrently), so you still have all the issues of threading (+ new ones since things like thread-local variables aren't reliable if an async/coroutines moves threads between calls).

In cooperative scheduling how is it possible to have two coroutines running concurrently?

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by whizzter on Friday July 03, 2026 @07:34AM (#48773797)
You're thinking of older early coroutines or in singlethreaded runtimes (JS).

It's M:N threading, most logical threads/tasks are more lightweight than full OS threads, the logical ones should preferably behave cooperatively but they can be scheduled onto any number of real worker threads (usually these systems picks something like 2x worker threads compared to real CPU/Core count to manage some codepaths not being as well behaved).

Erlang and .NET(with Task/async) uses this model, iirc modern Java does this also (but hides it) and I'd be surprised if the modern async Rust or C++ variations didn't do this as well.

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by pjmlp on Saturday July 04, 2026 @01:40AM (#48782908)
C++20 co-routines model is based on .NET ones, as the original model was proposed by Microsoft and inspired on WinRT work.

If you know how to create asyncable types on .NET, the magic methods expected by C++ compiler will feel familiar.

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by whizzter on Monday July 06, 2026 @09:30AM (#48804315)
You mean in the sense that async methods return "awaitable" (Value)Task objects that contains the actual activation machinery that can be queried for liveness status?

It's funny that they're actually revamping the entire machinery for .NET 11 to defer allocations by default for non-waiting codepaths (Not sure, but iirc that machinery might require JIT compilation so would've perhaps not been possible to use for C++).

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by ddorian43 on Friday July 03, 2026 @05:13AM (#48772773)
> aren't reliable if an async/coroutines moves threads between calls

Then just don't move them between threads and you're good with thread locals, no?

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by whizzter on Friday July 03, 2026 @07:35AM (#48773809)
Iirc often the frameworks don't have worker affinity, anyhow environments like .NET has "AsyncLocal" to provide an aware alternative.
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by jwolfe on Thursday July 02, 2026 @09:48PM (#48769733)
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by pjmlp on Friday July 03, 2026 @01:14AM (#48771036)
Thanks!
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by RossBencina on Friday July 03, 2026 @06:15AM (#48773230)
Agree that the code examples look like communicating sequential processes (CSP) and/or async/await-style concurrency (i.e. co-routines in C++). To me this is not "Actors" at all. Actors don't "wait", they receive and send messages, and optionally specify the behavior for handling the next message.
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by d4ng on Friday July 03, 2026 @06:51AM (#48773481)
What are actors doing between finishing processing the last message and receiving the next one?
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by mgaunard on Friday July 03, 2026 @07:19AM (#48773690)
yield to the event loop
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by d4ng on Friday July 03, 2026 @07:24AM (#48773729)
So they're waiting.
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by mgaunard on Friday July 03, 2026 @07:46AM (#48773881)
not really, they yield to other event sources, which is the opposite of waiting (which blocks forward progress and is a violation of real-time guarantees)
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by DSingularity on Friday July 03, 2026 @08:04AM (#48774020)
I think these things can be equivalent. It all depends on the definition of wait.

The simple example can be x86 with monitor/mwait instructions. These will suspend a hardware thread until it can be awoken when the memory write happens to the monitored address. Nothing happens on that cpu thread in the meanwhile. Yet at the same time if things are being virtualized the higher authority exists and it can do something else with the CPU until the write. Same for OS type of event synchronization like Linux futex.

I would argue that the wait abstraction is more powerful. The alternative isn’t powerful enough to enable these kinds of “wake me when I can be useful again” behaviors.

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by d4ng on Friday July 03, 2026 @12:51PM (#48777125)
The actor itself can be said to be waiting. When it yields, the thread is then able to run another actor which was waiting on a message, and which then has a message on the queue.
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by mgaunard on Saturday July 04, 2026 @08:56AM (#48785092)
That sounds like a misunderstanding of how the actor model works. An actor doesn't wait. It's an event-driven system, it doesn't get to own and decide when messages get fed to it.
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by d4ng on Saturday July 04, 2026 @12:32PM (#48786663)
Are there any actor system implementations that you know of that work differently?
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by mgaunard on Saturday July 04, 2026 @08:47PM (#48790343)
Well in mine for example, threads are pinned to a core and always spin, and actors are pinned to a given thread (you can have an arbitrary number of actors per thread, they're just objects), so "waiting" is certainly not something you'd use to describe the setup in any capacity.
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by d4ng on Saturday July 04, 2026 @09:40PM (#48790597)
What happens when there are no messages on the queue for a given actor?
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by mgaunard on Sunday July 05, 2026 @05:48AM (#48792747)
An actor does not have a queue; that's again the whole point I already made: it's event-driven, things are decoupled and the actor is not aware of how control flow happens.

Regardless, when the queue which exists and is per-thread is empty, the program terminates.

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by mgaunard on Friday July 03, 2026 @07:16AM (#48773660)
Coroutines aren't great, even C++26 is explicitly avoiding them for its foundational concurrency model.

In any case a good concurrency library doesn't need more than C++14.

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by spacechild1 on Friday July 03, 2026 @08:36AM (#48774279)
In my understanding, senders/receivers is a more generalized concurrency model, but it has been designed to play well with coroutines.
Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by pjmlp on Friday July 03, 2026 @10:03AM (#48775204)
Is it? Senders/receivers is based on NVidias experience using them on CUDA.

Naturally I haven't followed them that much, given how far away C++26 is from being usable for portable code.

Compilers are finally getting good enough with C++20 support for updating the default version.

Re:FoundationDB's Flow – Bringing Actor-Based Concurrency to... by mgaunard on Tuesday July 07, 2026 @11:52AM (#48819516)
There is no shared lineage here. Some of the people who worked on sender/receivers indeed also worked at Nvidia on Thrust, which never had anything to do with coroutines.