priority fields in a thread
John Baldwin
jhb at freebsd.org
Mon Sep 29 17:26:20 UTC 2008
On Friday 26 September 2008 07:15:48 pm Murty, Ravi wrote:
> Hello,
>
> I was wondering what all these different priority related fields in a
> thread structure meant. This is the 8.0 kernel tree.
>
> Td_base_pri
What the thread's priority should be while it is in the kernel. Doing a
*sleep(..., PFOO) sets this to PFOO. On return to userland it gets set back
to td_user_pri. The purpose of this field is to hold the "real" priority of
a thread and is used when undoing the effects of priority propagation.
> Td_user_pri
This is the user priority of the thread. This is always >= PZERO for normal
processes (real-time processes are different, though). When exiting the
kernel, any priority "boost" from *sleep() is given up by dropping the
priority back to this value.
> Td_base_user_pri
This is like td_base_pri in that it is a saved copy of the "real" userland
priority of a thread. The umtx locks now support a userland version of
priority propagation and this field is used to restore the user priority of a
thread when it drops the locks other user threads need.
> Td_priority
This is the actual priority of the thread right now. When the thread is in
userland, this should equal td_user_pri. When the thread is in the kernel,
this should equal td_base_pri except for when the thread has been lent
another thread's priority because it holds a lock that other thread needs.
--
John Baldwin
More information about the freebsd-hackers
mailing list