Bring personal branch up to date #7

Merged
ed1223 merged 6 commits from BSD-merged into ethan-BSD 2024-10-17 15:57:04 +00:00
3 changed files with 79 additions and 52 deletions
Showing only changes of commit eacd93b32d - Show all commits

View File

@@ -155,7 +155,7 @@ thread_tick (void)
/* Update system load_avg and all threads recent_cpu every second. */ /* Update system load_avg and all threads recent_cpu every second. */
int64_t ticks = timer_ticks (); 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 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); 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. */ /* 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); t->recent_cpu = fp_add_int (t->recent_cpu, 1);
if (ticks % 4 == 0) // recent_cpu was updated, update priority. if (ticks % 4 == 0) // recent_cpu was updated, update priority.