better scheduler time allocation, proper quota tracking
This commit is contained in:
1 parent
03bf767ac2
commit
b3569a2b90
6 files changed
+362
-235
No files matched your search
+16
-1
@@ -87,6 +87,10 @@ __declspec(dllexport) KSTATUS KeCreateThread(PROCESS* owner, uintptr_t entry, ui
|
||||
thread->State = ThreadReady;
|
||||
thread->Priority = priority;
|
||||
thread->QuantaConsumed = 0;
|
||||
thread->QuantumTicks = 0;
|
||||
thread->QuantumRemaining = 0;
|
||||
thread->CpuBurstTicks = 0;
|
||||
thread->LastRunTicks = 0;
|
||||
thread->WaitObject = (OBJECT *)0;
|
||||
thread->WaitStatus = STATUS_SUCCESS;
|
||||
thread->WaitListHead = (LIST_ENTRY*)0;
|
||||
@@ -241,6 +245,10 @@ __declspec(dllexport) KSTATUS KeCreateKernelThread(uintptr_t fn, uintptr_t arg,
|
||||
thread->State = ThreadReady;
|
||||
thread->Priority = priority;
|
||||
thread->QuantaConsumed = 0;
|
||||
thread->QuantumTicks = 0;
|
||||
thread->QuantumRemaining = 0;
|
||||
thread->CpuBurstTicks = 0;
|
||||
thread->LastRunTicks = 0;
|
||||
thread->WaitObject = (OBJECT*)0;
|
||||
thread->WaitStatus = STATUS_SUCCESS;
|
||||
thread->WaitListHead = (LIST_ENTRY*)0;
|
||||
@@ -344,6 +352,7 @@ KSTATUS KeCommitBlockThread(THREAD* thread, uint8_t alertable) {
|
||||
return STATUS_USER_APC;
|
||||
}
|
||||
|
||||
KiSchedulerNoteVoluntaryBlock(thread);
|
||||
KeYield();
|
||||
|
||||
// Kernel APCs are delivered before an alertable wait returns
|
||||
@@ -369,6 +378,9 @@ void KeUnblockThreadWithStatus(THREAD* thread, KSTATUS status) {
|
||||
// instead of inserting the running thread into the ready queue.
|
||||
if (thread == KeGetCurrentThread()) {
|
||||
KiFinishWait(thread, status);
|
||||
thread->CpuBurstTicks = 0;
|
||||
thread->QuantaConsumed = 0;
|
||||
thread->QuantumRemaining = 0;
|
||||
if (thread->State == ThreadWaiting)
|
||||
thread->State = ThreadRunning;
|
||||
return;
|
||||
@@ -385,9 +397,12 @@ void KeUnblockThreadWithStatus(THREAD* thread, KSTATUS status) {
|
||||
KiFinishWait(thread, status);
|
||||
thread->State = ThreadReady;
|
||||
|
||||
thread->CpuBurstTicks = 0;
|
||||
thread->QuantaConsumed = 0;
|
||||
thread->QuantumRemaining = 0;
|
||||
|
||||
if (thread->Priority < PriorityHigh) {
|
||||
thread->Priority = (THREAD_PRIORITY)(thread->Priority + 1);
|
||||
thread->QuantaConsumed = 0;
|
||||
}
|
||||
|
||||
KeReadyThread(thread);
|
||||
|
||||
Reference in new issue
Block a user