In the very hot days which we experienced in Germany the last week my old ventilation cooled PC suffers a bit when all of my CPU cores get under full load. Temperatures up to 70&grad; Celsius despite an Alpenföhn ventilator are beyond my normal experience and tolerance. The culprit was Eclipse with PyDev.
I had installed the latest Eclipse version (4.32.0) some days before. And opened a new Python project based on a directory with tons of code for Machine Learning classes. As a default the PyDev validator started to check the code for problems. It does so by using all available CPU cores and threads in parallel. Yeah, Eclipse works highly parallelized with its underlying Java VM. As I had a lot of complex code the code analysis lasted for some minutes – putting an extreme load on my PC.
So, my question was: How can one limit the number of CPU cores/threads used by Eclipse?
For Linux the answer is surprisingly simple:
We can use the “taskset” command. E.g., if I wanted to use the first 4 CPU cores (or recognized threads) we would write on the command line:
taskset -c 0-3 ./eclipse &
This works perfectly! The initial code analysis takes a bit longer – but the load on the PC got down. Happy coding!