Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am watching my CPU percent utilization by a process. How does a process use only 50% CPU? Doesn't a process use 100% then 0%, then 100%? Its not like every other instruction is a different program.

share|improve this question

migrated from Sep 14 '09 at 19:59

This question came from our site for professional and enthusiast programmers.

Got a dual processor by any chance? – rdkleine Sep 14 '09 at 19:54
Definitely a question for SuperUser. – Noldorin Sep 14 '09 at 19:56

It only polls totals about once per second. You're looking at how much of the last second it used.

If you see a cpu sitting at 50% for a little while, what's likely going on is that it's using 100% of one cpu in a dual cpu system.

share|improve this answer
"one core of a dual core system" -- ... or even a single CPU with 'hyperthreading'. – ChrisW Sep 14 '09 at 19:57
@ChrisW: fixed. – Joel Coehoorn Sep 14 '09 at 20:00
CPU usage percentages are often reported out of 100% for each CPU individually, so the total amount of CPU power to be used in a dual core system is 200%, in a quad core 400%, etc. – David Z Sep 15 '09 at 3:57
Not in windows task manager they're not. – Joel Coehoorn Sep 16 '09 at 1:21

Technically you are correct. At any given time, the CPU is either being used, or not used. But displaying that in a graph wouldn't be very helpful, so the graph is averaging CPU utilization over some period of time, probably each second.

share|improve this answer

The OS schedules the process for a certain time period. So if the process is scheduled for (say) 1ms out of 10ms, then it will be using 10% CPU.

It's a little counterintuitive, since (in a single-threaded, single-CPU system), the process is either running, or not running. i.e. it's using 100% or 0%. The percentage that you see is measured over a time window and is a measure of the OS allocating time slots to your process to run.

Note that your process will not contribute to this if you're accessing I/O. So if you're doing a huge calculation, you'll register 100% (assuming nothing else runs). If you then wait for a network packet/disk access etc. your CPU figure will go down, despite the fact that your process is still running.

share|improve this answer

At a very low level, you're basically right. At any given instant, the processor is either executing an instruction for a given process or it isn't.

But your OS is sitting in between your processes and the processor, making them share time. The percentage you see is the percentage of recent processing time the OS has granted that process.

share|improve this answer

It based on the average time. Despite all threads can have the same parcel of CPU time (based on priority), the threads can just say "thanks but I'm idle", and pass it's turn to the next thread. Thats why programs are not always using the same % time, and most programs are consuming 0% CPU, and programs which really need CPU can take near 100% of time for itself.

Why is it capping at 50%? You probably have two CPU cores, and its using only one.

Or, as suggested, it is using hyperthreading, but I don't know how this one behaves exactly.

share|improve this answer

You program might be doing a lot of I/O (disk or network reads/writes). That would keep the program busy but need little to no CPU time.

share|improve this answer

System utilization is sampled and averaged, which is the only sensible thing to do.

E.g. a record of how much time a process/thread spent running during 1 second is kept. If it spent 1 second on the CPU, that's 100% CPU (or 50% if you have 2 CPUs and so on), if it spent 100ms that's 10% CPU utilization.

share|improve this answer

You must log in to answer this question.

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