0

Forgive me - I'm not a hardware tech, just an app user.

Background: I've observed that when I am running one large process in a singlethreaded program (OCAD, QGIS, usually R, etc), I can see that one of my cores (8 phys, 16 log, i9_9900K CPU) is at or near 100% for a while and then drops to zero just as another core goes from nothing to at or near 100%. While observing this, all of the other cores bump along near zero, so it's clear that the one large process is consuming one core, but that it switches amongst available cores

  1. Is this 'thread switching' slowing down the processing of whatever I'm having the app do?
  2. If "yes" to #1, is there a way that I can make this stop happening?

1 Answers1

1
  1. Yes, but in scales of "a while" it is indiscernible. Since RAM is so slow compared to processor speed, processors automatically remember recently accessed locations in very fast memory (cache) in the hope they will require it again. This operation speeds up the overall processing. When a program switches to another processor, it will take a bit of time repopulating the caches. Again, very small amounts of time, so unless the switching is happening very rapidly, it is not a concern. It is somewhat odd behaviour though.

  2. If you are on linux, you could use taskset to launch your program; for example taskset 4 R would somewhat confusingly run R on cpu 3. The first argument to taskset is a bitwise-set of which processors R should run on. The manual should likely explains it better than I can. If you aren't on linux, your system will likely have some equivalent, you might have to hunt around a bit for it.

mevets
  • 10,070
  • 1
  • 21
  • 33