Is it possible to force an existing Java application to use no more than x cores?

Daniel Lemire picture Daniel Lemire · Jan 16, 2012 · Viewed 15k times · Source

We are benchmarking existing Java programs. They are threaded applications designed to benefit from multi-core CPUs. We would like to measure the effect of the number of cores on the running speed, but we are unwilling (and unable) to change the code of these applications.

Of course, we could test the software on different machines, but this is expensive and complicated. We would rather have a software solution.

Note: you can assume that the testing platform is either Windows, Linux or Mac. Ideally, we would like to be able to run the tests on either of these platforms.

Answer