Next article in the series: now that you know about the dangerous/complicated primitives, don't ever touch them again. Instead use the high-level safe concurrency/parallelism mechanisms in your programming language: futures/promises, nurseries, channels, observers, actors, monitors. Ideally, these should be built-in, but a library whose API composes well into most programs will also do.
I am just getting into concurrency. Is there any point to use threads or forkjoinpool in Java anymore? Should you always just use CompletableFutures and Suppliers?
Somebody has to maintain the operating systems and a metric ton of system software written in C. It cannot be magically all switched to Pony or Rust overnight.
Comments
Next article in the series: now that you know about the dangerous/complicated primitives, don't ever touch them again. Instead use the high-level safe concurrency/parallelism mechanisms in your programming language: futures/promises, nurseries, channels, observers, actors, monitors. Ideally, these should be built-in, but a library whose API composes well into most programs will also do.
Data races can be statically removed by carefully restricting certain parts of the language design, see Pony. https://tutorial.ponylang.io/#what-s-pony-anyway
Bonus: learn aspects of deadlocking by playing a game: https://deadlockempire.github.io/
I disagree, first you need to program a few toy projects with the dangerous primitives, to really internalize how tricky they are.
It's because of my concurrent C homework assignments that I was able to really appreciate Go's channels in my first internship.
“Never touch them again” means don’t reach for those primitives when higher level tools are available. Learning about them is fine.
It’s like with cryptography - don’t roll your own solutions just because you know what xor is. You’ll fail miserably.
I am just getting into concurrency. Is there any point to use threads or forkjoinpool in Java anymore? Should you always just use CompletableFutures and Suppliers?
Somebody has to maintain the operating systems and a metric ton of system software written in C. It cannot be magically all switched to Pony or Rust overnight.
See also Rust for the data races portion.
Though IIUC Pony is also supposed to prevent deadlocks.
There are no locks in Pony, so yes: no deadlocks. (livelocks / other kinds of "lack of progress" are of course still possible tho)