group/pintos/src/threads/thread.c
// Calculate priority (mlfqs mode) of thread
Calculate priority (mlfqs mode) of thread
Calculate priority ( mlfqs mode ) of thread
int
mlfqs_get_priority (struct thread *t)
{
    fixed_point_t t1;
    int next_p;
    t1 = fix_int(PRI_MAX);
    t1 = fix_sub(t1, fix_div(t->recent_cpu, fix_int(4)));
    t1 = fix_sub(t1, fix_int(t->nice * 2));
    next_p = fix_round(t1);
    return next_p > PRI_MAX ? PRI_MAX:
        (next_p < PRI_MIN ? PRI_MIN : next_p);
}
int mlfqs_get_priority ( struct thread * t ) { fixed_point_t t1 ; int next_p ; t1 = fix_int ( PRI_MAX ) ; t1 = fix_sub ( t1 , fix_div ( t -> recent_cpu , fix_int ( 4 ) ) ) ; t1 = fix_sub ( t1 , fix_int ( t -> nice * 2 ) ) ; next_p = fix_round ( t1 ) ; return next_p > PRI_MAX ? PRI_MAX : ( next_p < PRI_MIN ? PRI_MIN : next_p ) ; }
Calculate priority (mlfqs mode) of thread
Calculate priority ( mlfqs mode ) of thread