thread accounting in libpthread

Kazuaki Oda kaakun at highway.ne.jp
Fri Feb 18 08:56:05 PST 2005


Daniel Eischen wrote:

>On Fri, 18 Feb 2005, Kazuaki Oda wrote:
>
>  
>
>>Hi,
>>
>>thr_accounting function (libpthread/thread/thr_kern.c) calculates
>>thread->slice_usec, and it uses tm_uticks, tm_sticks and _clock_res_usec.
>>I think that kernel counts up tm_uticks and tm_sticks at statclock interrupt
>>time, and on -CURRENT _clock_res_usec is 1000 and on 5-STABLE it is 10000.
>>
>>Does thr_accounting calculate thread->slice_usec correctly?
>>    
>>
>
>I just fixed this.  It didn't really affect anything, though, since
>it's all relative.  You could have used any bogus number for the
>resolution of a tick.
>
>  
>
Thanks.

And while looking at thr_kern.c, I've had one more question.
In kse_switchout_thread, after calling thr_accounting thread is placed 
at the tail of run queue or at the head of it according to 
thread->slice_usec.
But in kse_check_completed, thread is just placed at the tail of run queue.
Is there any reason why thread is not placed at the head of run queue in 
case of thread->slice_usec != -1?

--------------------
Kazuaki Oda



More information about the freebsd-threads mailing list