Summary
-------
Add diagnostic VM flag "UseOWSTTaskTerminator" to set the task terminator protocol to be used.
Problem
-------
The current task termination protocol (called ParallelTaskTerminator, or PTT here) is inefficient in the number of waiting threads it wakes up for a given observed amount of remaining work and in some situations takes a very long time to find out that all threads are done with their work to actually terminate a given parallel phase.
The Shenandoah project has implemented an improved termination protocol called Optimized Work Stealing Threads (OWST) that fixes the shortcomings of PTT based on some work Google conducted earlier.
While we think the implementation of OWST is stable because it has not shown issues for 2+ years of use in the Shenandoah project for the Shenandoah collector, significantly wider use by adopting it for all Hotspot collectors may expose unknown issues. So we want a way to provide the user a way to fall back to the PTT protocol in case of issues.
Solution
--------
Introduce a new diagnostic VM flag called "UseOWSTTaskTerminator" that selects the termination protocol to use. The default is set to true, meaning that all GCs will use the OWST protocol by default. In case of issues it allows a user to switch back to the PTT protocol by setting this flag to false.
Specification
-------------
From gc_globals.hpp:
diagnostic(bool, UseOWSTTaskTerminator, true, \
"Use Optimized Work Stealing Threads task termination " \
"protocol") \