Kernel: Optimize scheduler idling

Now after each interrupt we will ask the scheduler to reschedule
if the current thread is the idle thread. This allows semaphore
unblocking to be practically instant when there is only one thread
executing.

Now disk reading is back to ~3 MB/s for single threaded process
This commit is contained in:
Bananymous
2023-04-03 01:51:05 +03:00
parent 46d65471d9
commit c936aac777
4 changed files with 21 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
#include <kernel/InterruptController.h>
#include <kernel/kmalloc.h>
#include <kernel/Panic.h>
#include <kernel/Scheduler.h>
#define REGISTER_ISR_HANDLER(i) register_interrupt_handler(i, isr ## i)
#define REGISTER_IRQ_HANDLER(i) register_interrupt_handler(IRQ_VECTOR_BASE + i, irq ## i)
@@ -129,6 +130,8 @@ namespace IDT
// NOTE: Scheduler sends PIT eoi's
if (irq != PIT_IRQ)
InterruptController::get().eoi(irq);
Kernel::Scheduler::get().reschedule_if_idling();
}
static void flush_idt()