Changing the amount of parallelism dynamically

Here's something I got working today. setNumCapabilities can now reduce the number of active capabilities as well as increase it. The ThreadScope screenshot below shows a program with two threads - one thread is calculating nqueens in parallel, while the other thread is periodically calling setNumCapabilities to change the amount of available parallelism between 1 and 6 cores.

The use case I have in mind for this is to dynamically reduce the number of cores used by the runtime when other processes start up on the machine. Normally when that happens performance drops off a cliff due to the rapid synchronisation we do between all cores, but we should be able to degrade more gracefully and be friendly to other processes on the machine while still making use of all the cores when they're free. That's the idea, anyway.
Shared publiclyView activity