FreeBSD/sys/kern/sched_4bsd.c
/*
 * Recalculate the priority of a process after it has slept for a while.
 * For all load averages >= 1 and max ts_estcpu of 255, sleeping for at
 * least six times the loadfactor will decay ts_estcpu to zero.
 */
Recalculate the priority of a process after it has slept for a while.
For all load averages >= 1 and max ts_estcpu of 255, sleeping for at
least six times the loadfactor will decay ts_estcpu to zero.
Recalculate the priority of a process after it has slept for a while . For all load averages > = 1 and max ts_estcpu of 255 sleeping for at least six times the loadfactor will decay ts_estcpu to zero .
static void
updatepri(struct thread *td)
{
	struct td_sched *ts;
	fixpt_t loadfac;
	unsigned int newcpu;
	ts = td_get_sched(td);
	loadfac = loadfactor(averunnable.ldavg[0]);
	if (ts->ts_slptime > 5 * loadfac)
		ts->ts_estcpu = 0;
	else {
		newcpu = ts->ts_estcpu;
		ts->ts_slptime--;	
		while (newcpu && --ts->ts_slptime)
			newcpu = decay_cpu(loadfac, newcpu);
		ts->ts_estcpu = newcpu;
	}
}
static void updatepri ( struct thread * td ) { struct td_sched * ts ; fixpt_t loadfac ; unsigned int newcpu ; ts = td_get_sched ( td ) ; loadfac = loadfactor ( averunnable . ldavg [ 0 ] ) ; if ( ts -> ts_slptime > 5 * loadfac ) ts -> ts_estcpu = 0 ; else { newcpu = ts -> ts_estcpu ; ts -> ts_slptime -- ; while ( newcpu && -- ts -> ts_slptime ) newcpu = decay_cpu ( loadfac , newcpu ) ; ts -> ts_estcpu = newcpu ; } }
Recalculate the priority of a process after it has slept for a while.
Recalculate the priority of a process after it has slept for a while .
/* was incremented in schedcpu() */