1

In reference to whole core to process, I am wondering about real benefits. For example, I have multi-process Qt C++ app, say with 7 processes, including heavily scientific computations and visualizations. The app runs on newest Ubuntu and 8 cores CPU (4 real and 4 virtual). The hint: almost all processes are single threaded. Would assigning single process to dedicated core bring any performance benefits in this case? Ideally I would assign all processes to dedicated core but I have one process which is multi-threaded and drives a device.

Community
  • 1
  • 1
Mateusz
  • 51
  • 5
  • 2
    Measure and tell us what you find? – Kerrek SB Jul 21 '15 at 08:20
  • Note that you don't have "4 virtual cores". All 8 cores are virtual, but each pair of virtual cores shares one physical core. New Linux kernels are aware of this distinction and take this into account when assigning threads to cores. – MSalters Jul 21 '15 at 10:31

3 Answers3

1

There is a benefit, yes, but only if you also keep other processes away from your dedicated cores. The question is do you really need it, or to put otherwise, would you feel it in your case?
The kernel is not bad at assigning processes to cores but it's trying to load balance and it's not aware of your priorities, so sometimes you do have to force its hand.
The benefits are that your processes will suffer less from cache misses and context switches. But if you do many system calls, say for IO, you'd have context switches and I'm not sure you'd feel much of a difference.
Dedicated cores are typically used for time-critical threads that you do not want interrupted by anything else. And often communicate only on shm and/or non-kernel IO.

BitWhistler
  • 1,439
  • 8
  • 12
0

modem cpu does not run in constant speed. There are many factors including the choice of scheduler (which may depends on cpu temperature and fan noise), thermo boost / multiple stepping level, etc. Theoretically, having all CPU core "max out" (hence without boost) does not necessary means you are getting more work done. It may be, but you need to measure.

Now assume we want to "max out" all the CPU cores for CPU bound tasks. Modern ubuntu has decent scheduler to prevent un-necessary transport of a thread between core, which cause all sort of overhead including cross-CPU synchronisation and TLB shoot down. So as long as all thread utilise its own core, they usually stick to it unless there are adjustment on cpu frequency by scheduler.

TL;DR; The system usually have better idea to utilise the machine, let the scheduler to make decision, and it usually stick your cpu-bound thread to specific core unless it's time to cool it down.

The time you want to specify cores to process is to reserve one core for the system to perform I/O operations.

Non-maskable Interrupt
  • 3,841
  • 1
  • 19
  • 26
0

Would assigning single process to dedicated core bring any performance benefits in this case?

it might if your working memory set is small enough. Say, each core has dedicated L1 32K D- and 32K I-cache, then say per module (pair of cores) L2 256K D- and 256K I-cache and then shared 6M L3 cache.

Moving from core to core means throwing out your cache, and reloading it on the different core. It might matter if your given workind memory set is small enough. If you chasing pointers over 16Gb memory set, most likely you won't see anything

But you have to measure really

Severin Pappadeux
  • 18,636
  • 3
  • 38
  • 64