1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 19:05:08 +00:00

Kernel: Implement software context switching and Processor structure

Moving certain globals into a new Processor structure for
each CPU allows us to eventually run an instance of the
scheduler on each CPU.
This commit is contained in:
Tom 2020-06-27 13:42:28 -06:00 committed by Andreas Kling
parent 10407061d2
commit fb41d89384
22 changed files with 1002 additions and 513 deletions

View file

@ -34,14 +34,12 @@ void FinalizerTask::spawn()
Process::create_kernel_process(g_finalizer, "FinalizerTask", [] {
Thread::current->set_priority(THREAD_PRIORITY_LOW);
for (;;) {
{
InterruptDisabler disabler;
if (!g_finalizer_has_work)
Thread::current->wait_on(*g_finalizer_wait_queue);
ASSERT(g_finalizer_has_work);
g_finalizer_has_work = false;
}
Thread::finalize_dying_threads();
dbg() << "Finalizer task is running";
Thread::current->wait_on(*g_finalizer_wait_queue);
bool expected = true;
if (g_finalizer_has_work.compare_exchange_strong(expected, false, AK::MemoryOrder::memory_order_acq_rel))
Thread::finalize_dying_threads();
}
});
}