Earlier quoted context omitted.
Do you have a reference on that? I want to make sure you're talking about the same thing.
Clojure does hot code reloading as a built in. You essentially send code to a running system and you change it. It’s enabled by a dynamic class loader. I wouldn’t say it’s common outside of Clojure though, the whole language and ecosystem is built around this concept. To be clear: JVM enables the feature, so “technically” JVM allows hot code reload. Not sure how useful this is in practice for non-Clojure JVM users.
Optimising for Concurrency: Comparing the BEAM and JVM virtual machines
21–30 of 114 posts
Re: Optimising for Concurrency: Comparing the BEAM and JVM virtual machines
#22Re: Optimising for Concurrency: Comparing the BEAM and JVM virtual machines
#23> Programming with concurrency primitives is a difficult task because of the challenges created by its shared memory model. I never understood this often repeated point. As junior / mid-level developer I had the privilege to run self written .jar files on government scale systems with more than 50 cores. I used Java thread pools and concurrent data structures to do heavy cross thread caching. It was all pretty simple…
Potentially-racey stuff:
* Synchronized primitives don't compose. You can safely `synchronized get(...)` and safely `synchronized put(...)`. But their composition put(get(...)+1) isn't synchronized. And it's hard to mentally revisit it at the end of the day: if you have a class with some methods marked synchronized, nothing will tell whether you've synchronized the right methods. You just have to think it through again and hope you reach the same conclusions as before.
Other (non-racey) stuff:
* Threads are heavy, CompletableFutures are light. But CFs lack the functionality of Threads. A CF can't decide to sleep for a while, nor can it be cancelled. (As an aside, BEAM threads are super light).
Re: Optimising for Concurrency: Comparing the BEAM and JVM virtual machines
#24The JVM supports hot code loading, although this article seems to imply only BEAM supports it.
Do you have a reference on that? I want to make sure you're talking about the same thing.
Re: Optimising for Concurrency: Comparing the BEAM and JVM virtual machines
#25> Programming with concurrency primitives is a difficult task because of the challenges created by its shared memory model. I never understood this often repeated point. As junior / mid-level developer I had the privilege to run self written .jar files on government scale systems with more than 50 cores. I used Java thread pools and concurrent data structures to do heavy cross thread caching. It was all pretty simple…
> When is concurrency in Java ever hard? Potentially-racey stuff: * Synchronized primitives don't compose. You can safely `synchronized get(...)` and safely `synchronized put(...)`. But their composition put(get(...)+1) isn't synchronized. And it's hard to mentally revisit it at the end of the day: if you have a class with some methods marked synchronized, nothing will tell whether you've synchronized the right metho…
Re: Optimising for Concurrency: Comparing the BEAM and JVM virtual machines
#26> Programming with concurrency primitives is a difficult task because of the challenges created by its shared memory model. I never understood this often repeated point. As junior / mid-level developer I had the privilege to run self written .jar files on government scale systems with more than 50 cores. I used Java thread pools and concurrent data structures to do heavy cross thread caching. It was all pretty simple…
Take a look at dated, but still relevant book by Brian Goetz - Java Concurrency in Practice - many problems are illustrated with a code section.
Re: Optimising for Concurrency: Comparing the BEAM and JVM virtual machines
#27The JVM supports hot code loading, although this article seems to imply only BEAM supports it.
Do you have a reference on that? I want to make sure you're talking about the same thing.
There are limits to how much you can change in existing loaded class code, but if you are just loading up new dynamically generated code you can do pretty much anything.
Its a big reason why some of these Java frameworks are so fast. They can generate highly optimized code on the fly, load it, and have it running alongside the existing app code within a few hundred milliseconds. And the Java JIT will optimize it as if the code was there the whole time.
This makes performance optimizations easy that would be impossible in AOT languages like Go, C, C++, Rust, etc
Re: Optimising for Concurrency: Comparing the BEAM and JVM virtual machines
#28Apparently this is an Erlang BEAM, not Apache BEAM https://beam.apache.org/ ?
Re: Optimising for Concurrency: Comparing the BEAM and JVM virtual machines
#29> Programming with concurrency primitives is a difficult task because of the challenges created by its shared memory model. I never understood this often repeated point. As junior / mid-level developer I had the privilege to run self written .jar files on government scale systems with more than 50 cores. I used Java thread pools and concurrent data structures to do heavy cross thread caching. It was all pretty simple…
Without more information this is the likely scenario, going by my own experience.
BTW, if it turns out you are a concurrent programming genius please write about it, eh? (Like a blog or book or something.)
Re: Optimising for Concurrency: Comparing the BEAM and JVM virtual machines
#30Earlier quoted context omitted.
> When is concurrency in Java ever hard? Potentially-racey stuff: * Synchronized primitives don't compose. You can safely `synchronized get(...)` and safely `synchronized put(...)`. But their composition put(get(...)+1) isn't synchronized. And it's hard to mentally revisit it at the end of the day: if you have a class with some methods marked synchronized, nothing will tell whether you've synchronized the right metho…
Java has a large set of higher level abstractions for concurrency. You don't have to use low level locks but you can. (And that's just Java, there's also Scala, clojure ...)