Merge complete code base into master #15

Merged
ed1223 merged 4 commits from merged-complete into master 2024-10-23 19:05:46 +00:00
2 changed files with 72 additions and 75 deletions
Showing only changes of commit 20be75748c - Show all commits

View File

@@ -474,12 +474,8 @@ thread_recalculate_priority (void)
{ {
struct thread *t = thread_current (); struct thread *t = thread_current ();
if (thread_mlfqs) ASSERT(!thread_mlfqs)
{
t->priority = calculate_bsd_priority (t->recent_cpu, t->nice);
return;
}
enum intr_level old_level = intr_disable (); enum intr_level old_level = intr_disable ();
t->priority = t->base_priority; t->priority = t->base_priority;
@@ -732,6 +728,9 @@ thread_schedule_tail (struct thread *prev)
static int static int
calculate_bsd_priority (fp32_t recent_cpu, int nice) calculate_bsd_priority (fp32_t recent_cpu, int nice)
{ {
ASSERT(thread_mlfqs);
int priority = PRI_MAX - (fp_round (recent_cpu) / 4) - (nice * 2); int priority = PRI_MAX - (fp_round (recent_cpu) / 4) - (nice * 2);
if (priority < PRI_MIN) if (priority < PRI_MIN)
return PRI_MIN; return PRI_MIN;