What does CPU Time consist of?

2

1

What does CPU time exactly consist of?

For instance, is the time taken to access a page from the RAM (at which point, the CPU is most likely idling) part of the CPU time? I'm not talking about fetching the page from the disk here, just fetching it from the RAM.

Thanks

Opt

Posted 2010-05-01T16:41:31.627

Reputation: 241

Answers

2

CPU "time" is mostly thought of in clock cycles, or the time it takes the processor to execute its smallest instruction (usually integer addition/subtraction). Other instructions, like ram fetching or floating point divides take multiple CPU cycles. Ram load/store typically take more than 1 clock cycle.

parallelism also comes into play. A ram load/store instruction takes a few clock cycles of a memory resource, time where the processor doesn't necessarily have to be idle. Instructions can be ordered to make maximum use of all the resources to get maximum speed. :D

Gordon Gustafson

Posted 2010-05-01T16:41:31.627

Reputation: 1 767

2

If you are thinking CPU Time in sense of what you can see in Task Manager, it is total time scheduler gave to process.

Each thread in system gets some time to run. If there is no work to do, it will return immediately and thus it will not use that time. In case there is work to do, it will run until scheduler stops it and gives control to another one. That slices of time that thread was actually running are cumulated together and this is CPU time. As thread does more work, more time slices it spends and thus CPU time is higher.

CPU time is not defined in CPU cycles but in "natural" time units (hours, minutes, seconds...).

Josip Medved

Posted 2010-05-01T16:41:31.627

Reputation: 8 582