4 ms·
There is also an interesting trick added for Shenandoah to make thread synchronization time bounded. Basically, you don't want to check for gc in each (allocat
by Tarean 8y ago
There is also an interesting trick added for Shenandoah to make thread synchronization time bounded.
Basically, you don't want to check for gc in each (allocation free) loop iteration. On top of the overhead it makes optimization harder. But if you have 32+ threads then some are probably stuck in loops for a good while which means spinlocks for everyone waiting for the stop-the-world gc.
The trick to avoid this is to add an inner loop that does a fixed number of iterations and then do a gc check between each inner loop https://bugs.openjdk.java.net/browse/JDK-8186027 https://bugs.openjdk.java.net/browse/JDK-8186027