CPU ticks_executed question

Till Straumann strauman at slac.stanford.edu
Tue Aug 22 21:18:44 UTC 2006


It seems that the 'ticks_executed' counter
is incremented

  1 when the CPU is given to a thread
    (_Thread_Dispatch(): heir->ticks_executed++)
  2 at every clock tick (_Thread_Tickle_Timeslice()), the
    executing thread is billed 1 tick

Shouldn't 2) happen only if the CPU is not taken away
from the executing thread as a result of the 'tickle timeslice'
operation? Currently, the executing thread is billed 1 tick
even if it's timeslice expired or if it is not ready.

>From looking at the code, it seems to me that e.g., a
thread 't' with a timeslice of 1 tick could experience:

  clock -> CPU dispatched to 't' ; ticks_executed++; [result of 1)]
  clock -> ticks_executed++; [result of 2)]; timeslice has expired,
           't' loses CPU.

Hence, although 't' had the CPU only for 1 tick it got billed 2.

(Anyways, the coarse granularity of the accounting mechanism
doesn't yield very accurate usage information)

-- Till




More information about the users mailing list