3

I'm curious to understand what could be the motivation behind the fine-grained detail of each virtual processor that the Windows 8 task manager seems to be focusing on.

Here's a screenshot (from here):

                Windows 8 task manager

I know this setup could only exist in a non-standard, costly, important server environment (1TB RAM!), but what is the use of a heatmap? Or, setting processor affinity:

        processor affinity

What I'm asking is, under what circumstances a developer would care if specific processor X is being used more than processor Y (instead of just knowing that a single non-multithreaded process is maxing out a core, which would be better shown as a process heatmap, instead of a processor heatmap), or care whether a process will use this or that processor (which I can't expect a human to guess better than an auto-balancing algorithm)?

Camilo Martin
  • 37,236
  • 20
  • 111
  • 154

3 Answers3

3

In most cases, it doesn't matter, and the heatmap does nothing more than look cool.

Big servers, though, are different. Some processors have a "NUMA", or Non-Uniform Memory Access, architecture. In these cases, some processor cores are able to access some chunks of memory faster than other cores. In these cases, adjusting the process affinity to keep the process on the cores with faster memory access might prove useful. Also, if a processor has per-core caches (as many do), there might be a performance cost if a thread were to jump from one core to another. The Windows scheduler should do a good job avoiding switches like these, but I could imagine in some strange workloads you might need to force it.

These settings could also be useful if you want to limit the number of cores an application is using (say to keep some other cores free for another dedicated task.) It might also be useful if you're running a stress test and you are trying to determine if you have a bad CPU core. It also could work around BIOS/firmware bugs such as the bugs related to high-performance timers that plagued many multi-core CPUs from a few years back.

Jason Malinowski
  • 18,148
  • 1
  • 38
  • 55
  • Didn't know about NUMA. Does this mean some processors can access bigger chunks of memory faster, or all processors have their own "fast chunk"? Also, setting the affinity through a task manager GUI (instead of being done by benchmark/testing/server process code) wouldn't ever be actually used, right? – Camilo Martin Mar 11 '12 at 03:11
  • NUMA generally means that accessing some memory is slower than others. Windows has other functions to get NUMA data, and so I'm sure most apps that must scale to that level will configure themselves appropriately. That said, having the task manager functionality there is still useful. – Jason Malinowski Mar 11 '12 at 03:21
  • Your answer seems comprehensive, and I'm seeing its presence in task manager is just to look cool really. No other reason to be *especially there*, right? – Camilo Martin Mar 11 '12 at 03:59
  • I'm accepting your answer because I don't think there's any real reason for it, and you actually said something I didn't knew already (NUMA). – Camilo Martin Mar 11 '12 at 19:40
2

I can't give you a good use case for this heat map (except that it looks super awesome), but I can tell you a sad story about how we used CPU affinity to fix something. We were automating some older version of MS Office to do some batch processing of Word documents and Word was occasionally crashing. After a while of troubleshooting and desperation, we tried setting Word process' affinity to just one CPU to reduce concurrency and hence reduce the likelihood of race conditions. It worked. Word stopped crashing.

MK.
  • 33,605
  • 18
  • 74
  • 111
  • I agree it looks super awesome (at least with many virtual processors) :) So, Word was crashing just because it was multi-threading? How curious, that would be the last place I'd look for (I'd expect them to test it thoroughly). It must have been painful to find! – Camilo Martin Mar 11 '12 at 03:02
  • Well, it was probably multithreading on single core just as well, but having 2 *real* cores to multithread enables more race conditions which are not possible on single core and makes others more likely to happen. – MK. Mar 11 '12 at 03:57
  • Race conditions always puzzled me. Good thing in .NET multithreading is so easy, or at least I think it must be terribly harder in C++. – Camilo Martin Mar 11 '12 at 04:03
1

One possible scenario would be a server that is running multiple VMs where each client is paying to have access to their VM.

The administrator may set the processor affinities so that each VM has guaranteed access to X number of cores (and would charge the client appropriately).

Now, suppose that the administrator notices that the cores assigned to ABC Company Inc.'s VMs are registering highly on the heatmap. This would be a perfect opportunity to upsell ABC Company Inc and get them to pay for more cores.

Both the administrator and ABC Company Inc win - the administrator makes more money, and ABC Company Inc experience better performance.

In this way, the heatmap can function as a Decision Support System which helps ABC Company Inc decide whether their needs merit more cores, and helps the administrator to target their advertising better to the their customers that can benefit.

ose
  • 4,065
  • 2
  • 24
  • 40
  • This seems like a scenario, but still, I would think hosting companies would use logs and some third-party analytic software or even just scripts to know the status and usage history of (hypotetically many) machines, right? – Camilo Martin Mar 11 '12 at 03:15
  • 1
    It is possible, but of course why pay for expensive third-party analytics software if the same function can be achieved with a free OS-integrated tool. – ose Mar 11 '12 at 03:21
  • Because I don't think there is an admin looking at the task manager all the time, so I guess maybe scripts would be used if no third-party solution was cost-effective. Also, I'm supposing ABC Company Inc has no physical access to the server where their VM is hosted to go there and look at task manager either. And as far as I know prior versions of windows featured the same functions, just didn't show them off like this. – Camilo Martin Mar 11 '12 at 03:54