Simple CPU affinity system

This commit is contained in:
Alex
2023-02-25 03:58:11 +02:00
parent 14aa071e7f
commit 5e72d81a8f
2 changed files with 17 additions and 3 deletions

View File

@ -140,6 +140,9 @@ namespace Tasking
if (tcb->Status != TaskStatus::Ready)
continue;
if (tcb->Info.Affinity[CurrentCPU->ID] == false)
continue;
CurrentCPU->CurrentProcess = pcb;
CurrentCPU->CurrentThread = tcb;
return true;
@ -178,6 +181,9 @@ namespace Tasking
goto RetryAnotherThread;
}
if (thread->Info.Affinity[CurrentCPU->ID] == false)
continue;
CurrentCPU->CurrentThread = thread;
gnat_schedbg("[thd 0 -> end] Scheduling thread %d parent of %s->%d Procs %d", thread->ID, thread->Parent->Name, CurrentCPU->CurrentProcess->Threads.size(), ListProcess.size());
return true;
@ -238,6 +244,9 @@ namespace Tasking
continue;
}
if (tcb->Info.Affinity[CurrentCPU->ID] == false)
continue;
CurrentCPU->CurrentProcess = pcb;
CurrentCPU->CurrentThread = tcb;
gnap_schedbg("[cur proc+1 -> first thd] Scheduling thread %d %s->%d (Total Procs %d)", tcb->ID, tcb->Name, pcb->Threads.size(), ListProcess.size());
@ -290,6 +299,9 @@ namespace Tasking
continue;
}
if (tcb->Info.Affinity[CurrentCPU->ID] == false)
continue;
CurrentCPU->CurrentProcess = pcb;
CurrentCPU->CurrentThread = tcb;
sspt_schedbg("[proc 0 -> end -> first thd] Scheduling thread %d parent of %s->%d (Procs %d)", tcb->ID, tcb->Parent->Name, pcb->Threads.size(), ListProcess.size());