Merge contributions from gleb-bsd to main merged repo #6

Merged
ed1223 merged 11 commits from gleb/BSD into BSD-merged 2024-10-17 15:55:24 +00:00
3 changed files with 40 additions and 7 deletions
Showing only changes of commit 7a1aa21e1e - Show all commits

View File

@@ -208,6 +208,7 @@ timer_interrupt (struct intr_frame *args UNUSED)
else else
break; break;
} }
thread_increment_recent_cpu ();
thread_tick (); thread_tick ();
} }

View File

@@ -382,6 +382,19 @@ calculate_recent_cpu (void)
return { 0 }; return { 0 };
} }
void
thread_increment_recent_cpu (void)
{
struct thread *t = thread_current ();
if (t == idle_thread)
{
return;
}
fp32_t old_recent_cpu = t->recent_cpu;
old_recent_cpu.raw = old_recent_cpu.raw + 1;
t->recent_cpu = old_recent_cpu;
}
/* Sets the current thread's nice value to NICE. */ /* Sets the current thread's nice value to NICE. */
void void
thread_set_nice (int nice) thread_set_nice (int nice)