3 ms·
Lack of multi-threading simplifies a lot, but is at odds with performance.
by neonsunset 2y ago
Lack of multi-threading simplifies a lot, but is at odds with performance.
- wongarsu 2y agoYou can still have multithreading, you just have to forbid shared data. You can move data between threads at thread creation and termination, and for everything else the language can provide channels/queues to move data between threads. Erlang operates under that model and is great at multithreading
- hu3 2y ago"just have to forbid shared data" That's a too severe constraint to be qualified as "just".
- sph 2y agoThat is indeed the goal I am working towards, but a bit more relaxed than Erlang: mutability is possible only within a single actor/thread, but anything sent in a message to another actor is deep copied. So no memory is ever shared, but the language allows single-threaded mutation for performance.
- neonsunset 2y agoIt might be great, just not performant. CSP often locks you into a single consumer style of pattern, which is highly problematic and scales poorly for anything that isn't statically partitionable. Once you go to MPMC, you start sharing data which immediately forces you to have proper ARC with the high synchronization cost it entails (even without using atomics, RC forces cacheline eviction between cores meaning it acts as a brutal bottleneck on many-core systems per Amadhal's law).