0

A while back, I did some playing around with new Win2008 virtual machine and found some serious concerns.

The server is Dell T610. 16gig, 4 core, 8 logical, 2.4ghz Xeon, 5600 series. ESXi 4.1.0 The guest is 2008 64bit, with 2vCPU's

I've been testing CPU performance using 7Zip on a 400meg file. Our server requirements have a particular need for single-thread performance, so I run 7Zip with only one thread.

7zip takes 4:50 on the VM. For comparison, on a recent 2ghz, 4core server this process takes 4:00.

Obviously a problem here.

So I tried setting process affinity on the 7Zip.exe process. This time the compression only took 3:20. Note that setting affinity on a physical machine makes no difference. (Just as fast, on or off) On both physical and virtual machines, when affinity is not set, you can see the process being thrown between all cores in taskman)

The irony is that on a heavily loaded machine, tasks will complete quicker, because they are more likely to remain on the same cpu.

The question is, why does Windows have such a lose processor affinity when linux does not?

5
  • I think what you define as "context switching frequency" is not. What you're describing could be described as loose process affinity in that the process threads gets bounced around cores. This is not context switching. – hookenz May 14 '13 at 3:43
  • Ahh so context switching is a thread being told to wait. I wonder what it is called when threads get thrown to another cpu? – Michael May 14 '13 at 3:56
  • I've called it 'loose processor affinity', after reading en.wikipedia.org/wiki/Processor_affinity, and what you said matt, lol – Michael May 14 '13 at 4:03
  • Context switching is a thread yielding to another thread, or the operating system yielding to a user-space process, or the reverse. Technically it means reloading the virtual memory mapping registers, register sets, PC, etc. – user207421 May 14 '13 at 4:42
  • @EJP, given that this bouncing between cpus has no effect on a physical machine, i'm guessing that bouncing a process between idle CPUs is done in such away that cache misses etc are avoided. But I wonder why the impact is so severe when the cpus are virtual? – Michael May 14 '13 at 4:46
1

"Therefore, for primarily single (or limited) thread applications, it is sometimes best to set the CPU affinity to a specific core, or subset of cores. This will allow the 'Turbo' processor frequency scaling to kick in and be sustained (instead of skipping around to various cores that may not be scaled up, and could even be scaled down)."

"As of now no OS scheduler does takes the active clock speed of individual cores into consideration (afaik). Perhaps that will change in a future release of Windows, but it seems unlikely at least for several years."

https://bitsum.com/pl_when_cpu_affinity_matters.php

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.