4 ms·
Looks cool. One thing though, the page says > Actors are a great model for concurrent programming because they automatically prevent race conditions (thanks to
by tines 6y ago
Looks cool. One thing though, the page says
> Actors are a great model for concurrent programming because they automatically prevent race conditions (thanks to atomicity and encapsulated state) and deadlocks (because execution never blocks)
This isn't really true afaik. You can still have logical race conditions if you don't synchronize messages (but they won't be architectural races), and you can still have deadlocks if two actors wait on messages from each other at the same time.
I feel like people often treat race conditions and deadlocks as small, computer-architecture ideas when really they're quite broad concepts. You may be able to prevent them automatically at certain scales, like say a single uint64, but when you try to treat two uint64s as a single uint128 then suddenly race conditions are possible again, despite the guarantees your language has made on the smaller scale.
- kjeetgill 6y agoI agree completely! And this shows up in just about any language because of that — however — I kinda get where the author is coming from. When a certain amount of state is encapsulated within a single actor (or a single message for that matter) you can act on all of it sorta transactionally since no other actor has access. This is probably more power/control than some programers have had in other languages or paradigms. Your full program state dosn't retain this property once it spans actors but what can ya do.