Re: What is CPU Utilization, anyway?

  • From: Hemant K Chitale <hkchital@xxxxxxxxxxxxxx>
  • To: oracledbawannabe@xxxxxxxxx
  • Date: Sat, 03 Jul 2010 00:40:37 +0800

Not really that way. A process would be on the CPU for a certain number of cycles, after which it would relinquish the CPU. Of course, if it makes an I/O call, it does relinquish the CPU. But even otherwise, it can be pre-empted by the scheduler and taken off the CPU.


What "top" reports is that it was on the CPU for 60% of the time in the refresh interval --- typically 5 seconds. With 5 minute snapshots, as you rightly compute, it would seem that the process was on the CPU for 3minutes. But then again, time on the runqueue also has to be accounted. Most "clients" (i.e. clients to the OS scheduler) would think that they are "on CPU" when, in fact, some of the time may actually be "in the runqueue".

Also, note that "top" shows two lists -- the first part is CPU utilisation, by CPU. The second part, listing individual processes, shows CPU utilisation (among many other columns) by each individual process.

Unix based schedulers may also apply ageing. A process that has been long running may get fewer CPU cycles the older it gets -- the schduler may preemptively take it off the CPU. But you'd have to check with your OS as to how this is implemented. Another complication is when a process is "nice"d or "renice"d -- to increase or decrease the prirority. The scheduler will also factor the nice value when deciding if a process should be put onto a CPU -- if there are multiple competing processes and fewer CPUs, processes that have been "nice"d lower may be "starved" of the CPU.

Hemant K Chitale


At 04:00 AM Friday, you wrote:
Keeping things simple, on a one 1 CPU box I pop up task manager or run 'top' and see CPU Utilization at 60% what does this really mean? We cannot consume 60% of a CPU, right? your process is either on CPU which means it consumes the entire CPU or it does not, a procoess cannot consume half of a CPU or 60% for that matter. With that said, does the 60% then show me the CPU time my process has consumed? So if over a 5 minute interval I see that the CPU utilized was 60%, I would say the process during the 5 minute interval consumed 60/100*(5) = 3 minutes of CPU Time. This may not be 3 minutes of continuous time - assuming waits for i/o in between, but generally speaking its 3 minutes of CPU time, correct? If this is true, with 'top' running or task manager on windows running - when I see these figures in real time what are they in reference to? I mean what is the time interval that CPU utilization is being based on? is it that particular second in time? - if that makes sense? For example 60% of that 1 second when I look at the tool that is reporting these values to me? Would it depend on when the process was created, when it lasted used CPU?
Thanks anyone.


Hemant K Chitale

http://hemantoracledba.blogspot.com
l




--
//www.freelists.org/webpage/oracle-l


Other related posts: