0

I have a Linux Machine with 2 X5650 2.7GHZ Processors and I host game servers on it for my gaming community, and there comes my issue: game servers need best 1 core performance, but I have 24 vCORES and 12 Physical Cores. Is it possible to "tell" kernel use 12 physical cores? and then 1 physical core will use 2VCORES?

Thanks, Alex.

  • If you run 12 game servers, wouldn't the operating system distribute the servers such that each gets one physical core? By saying that you want "1 physical core" to use "2VCORES", you're asking that a physical processor run on two threads. – dsstorefile1 Feb 28 '18 at 2:47
  • @dsstorefile I run 15 game servers and my machine have 12 cores and 24 threads. I want the game servers to spread between 12 cores and not between 24 threads - for best performance. – Alex Ulmer Feb 28 '18 at 2:53
  • I believe each of the "servers" are merely separate applications running on one operating system. – Jesse_b Feb 28 '18 at 2:57
  • I see. In that case, you can use taskset to manually assign processes to threads. You can check /proc/cpuinfo to determine which threads belong to which processor and distribute the processes as desired. – dsstorefile1 Feb 28 '18 at 2:58
  • @dsstorefile it cannot be done globally? without pinning processes to a specific core? – Alex Ulmer Feb 28 '18 at 3:14
2

You can use taskset to manually distribute processes across cores by setting their thread affinities. To figure out which threads belong to which cores and processors, check /proc/cpuinfo as shown below:

$ grep -E '^processor|^physical id|^core id' /proc/cpuinfo |sed 's/^processor/\nprocessor/'

processor       : 0
physical id     : 0
core id         : 0

processor       : 1
physical id     : 0
core id         : 1

processor       : 2
physical id     : 0
core id         : 0

processor       : 3
physical id     : 0
core id         : 1
$ _

processor is the thread number, physical id is the physical CPU number, and core id is the core number. The above output comes from a machine with a single CPU with two cores and four threads.

taskset can be used as taskset --all-tasks -p <hex_mask> <pid> to modify the affinity of all threads of an extant process. The hex_mask is a bitmask where each 1 bit represents an assigned CPU thread and numbering starts from the right. For instance, 0xa for the mask means binary 0b1010 which indicates an affinity of thread #1 and thread #3 for the process. The PID, I hope, is self-explanatory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.