diff --git a/src/threads/thread.c b/src/threads/thread.c index e4d392b..230789e 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -155,7 +155,7 @@ thread_tick (void) /* Update system load_avg and all threads recent_cpu every second. */ int64_t ticks = timer_ticks (); - if (ticks % TIMER_FREQ == 0) + if (thread_mlfqs && (ticks % TIMER_FREQ == 0)) { fp32_t old_coeff = fp_mul (fp_div_int (int_to_fp (59), 60), load_avg); fp32_t new_coeff = fp_div_int (int_to_fp (threads_ready ()), 60); @@ -165,7 +165,7 @@ thread_tick (void) } /* Update current thread's recent_cpu. */ - if (t != idle_thread) + if (thread_mlfqs && (t != idle_thread)) { t->recent_cpu = fp_add_int (t->recent_cpu, 1); if (ticks % 4 == 0) // recent_cpu was updated, update priority.