3

I'm waiting for Excel to finish a recalculation and I notice that the CPU usage as reported by Task Manager occasionally spikes to 51% or 52% on a Pentium 4 with hyper-threading. How is a single-threaded application like Excel 2003 doing this?

Is it just a rounding/estimation error on the part of Task Manager? Or is it something to do with HT allocation i.e. I wouldn't see this happening on a genuine dual-core or dual-CPU machine?

3 Answers 3

6

I would be surprised if Excel 2003 is single threaded. It's likely to have at least a UI thread and a worker thread. Does the UI repaint while the calculation is going on? If so, Excel is not single-threaded.

4
  • Exactly, it's most likely from a repaint, or an input thread. Excel 2003 is not "multi-threaded" in its calculations, but that doesn't mean that the whole program run on a single thread, of course.
    – Gnoupi
    Mar 25, 2010 at 16:50
  • 1
    Rather than arguing about the inner workings of a closed-source program, why don't you just tell Task Manager to show you the "Threads" column? It lists the number of threads in an application...
    – marcusw
    Mar 25, 2010 at 17:48
  • 1
    I see that Excel has 5 threads, so this makes perfect sense. I made the assumption that because pre 2007 versions of Excel only have 1 calculation thread that the program only uses 1 thread, a bit silly in retrospect! :)
    – Lunatik
    Mar 25, 2010 at 22:05
  • Also, the OS is multi-threaded. While Excel is running, it's telling the OS to do all kinds of things. The OS can do all kinds of things in its own threads such as pre-fetching files, flushing modified pages to disk, zeroing pages of memory that have been returned, redrawing the screen, and so on. Jan 14, 2012 at 2:18
1

MS Windows does not by default lock an application to one core, so what you're seeing is the manifestation of Excel being executed on one core or the other.

You CAN (temporarily) change this behavior via the Task Manager.

If you have Excel running, start taskmgr.exe, go to the Process list, and right-click on the process, you can elect to set the Affinity for the process.

Marking it specific to one core or the other will let you see (again in taskmgr) that it's running only on one core.

1

Well, what if you had a single core/thread processor? How could Excel use more than 50% of that? If you have 2 cores, and each can run one thread, and Excel runs on one core, then it can use up to 100% of that core.

With hyper-threading, you don't have 2 "real" threads per cpu core, but 2 "virtual" threads. The 2 threads have to share their execution resources. So it's possible for one of the threads to use more resources than the other, which may show as usage above 50%.

1
  • 1
    Just tried it on my home machine, a C2D, and the same is observed, hence it can't have anything to do with HT as such.
    – Lunatik
    Mar 25, 2010 at 22:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .