FreeBSD/sys/kern/sched_4bsd.c
/*
 * Compute the priority of a process when running in user mode.
 * Arrange to reschedule if the resulting priority is better
 * than that of the current process.
 */
Compute the priority of a process when running in user mode.
Arrange to reschedule if the resulting priority is better
than that of the current process.
Compute the priority of a process when running in user mode . Arrange to reschedule if the resulting priority is better than that of the current process .
static void
resetpriority(struct thread *td)
{
	u_int newpriority;
	if (td->td_pri_class != PRI_TIMESHARE)
		return;
	newpriority = PUSER +
	    td_get_sched(td)->ts_estcpu / INVERSE_ESTCPU_WEIGHT +
	    NICE_WEIGHT * (td->td_proc->p_nice - PRIO_MIN);
	newpriority = min(max(newpriority, PRI_MIN_TIMESHARE),
	    PRI_MAX_TIMESHARE);
	sched_user_prio(td, newpriority);
}
static void resetpriority ( struct thread * td ) { u_int newpriority ; if ( td -> td_pri_class != PRI_TIMESHARE ) return ; newpriority = PUSER + td_get_sched ( td ) -> ts_estcpu / INVERSE_ESTCPU_WEIGHT + NICE_WEIGHT * ( td -> td_proc -> p_nice - PRIO_MIN ) ; newpriority = min ( max ( newpriority , PRI_MIN_TIMESHARE ) , PRI_MAX_TIMESHARE ) ; sched_user_prio ( td , newpriority ) ; }
Compute the priority of a process when running in user mode.
Compute the priority of a process when running in user mode .