3 ms·
I'm not sure how it's implemented in the JVM, but in general, multithreading is notoriously difficult to reason about. Entire books are devoted to the pitfalls
by olalonde 1y ago
I'm not sure how it's implemented in the JVM, but in general, multithreading is notoriously difficult to reason about. Entire books are devoted to the pitfalls (race conditions, deadlocks, livelocks, starvation, memory visibility issues, and more). Compared to that, single threaded async programming is a walk in the park. I’d rather deal with "function color" than try to debug a heisenbug in a multithreaded app.
- pton_xd 1y agoShare-nothing via message passing ala Erlang makes multithreading much more tractable. I daresay it's enjoyable. Async is a decent syntax for simple tasks but that simplicity falls apart when composing larger structures and dealing with error handling and whatnot. I find it more difficult to understand what's going on compared to explicit threading.
- olalonde 1y ago> Async is a decent syntax for simple tasks but that simplicity falls apart when composing larger structures and dealing with error handling and whatnot. Do you have a concrete example? It has just never really been an issue for me since async/await (callback hell was a thing though).
- vips7L 1y agoYou don’t know how it works and are commenting on it?? Peak HN.
- olalonde 1y agoMultithreading works similarly across most programming languages, and that was my assumption here as well. Your comment made me second-guess myself a bit, so I went back and checked the spec. Turns out it is indeed just standard multithreading, as I originally thought.
- afiori 1y agoThe implementation and the observable behaviour are two different things