5 ms·
I’m genuinely curious, What's wrong with Java's model?
by dingi 3y ago
I’m genuinely curious, What's wrong with Java's model?
- mrkeen 3y ago* It's hard to program correctly using the thread model. And saying that locks are the solution to thread safety issues in Java, is like saying that malloc/free is the solution to memory safety issues in C. * Threads are also relatively fat. You'd probably think twice about spinning up 1000 of them. * Futures came in with Java 8 and are lighter weight, but have certain implementation defects - can't cancel them for example. Although there are some instances in which regular threads aren't cancellable. Also, the API isn't terribly popular. I happen to like flatmapping my way around a codebase, but plenty of devs' eyes glaze over when they read that code. * Fibers are released I think - at least in beta. More like JS's model I believe. They're even lighter weight and get rid of the flatmappy stuff again. I assume it's still up to the programmer to get the locking right.