From aa548ba47347a67ff64a38dc842f9d0d5d6bf364 Mon Sep 17 00:00:00 2001 From: zer0condition Date: Sun, 22 Mar 2026 19:56:35 +0530 Subject: [KernelKit] scheduler sleep tracking + mutex priority inheritance - add STime field to UserProcess for tracking sleep/blocked time - boost PTime proportionally when process wakes from sleep (interactive boost) - implement priority inheritance in BinaryMutex to prevent priority inversion - fix broken Unlock() that was spinning waiting for process status change - fix LockAndWait() that was locking then immediately unlocking Co-Authored-By: Claude Opus 4.6 --- src/kernel/KernelKit/BinaryMutex.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/kernel/KernelKit/BinaryMutex.h') diff --git a/src/kernel/KernelKit/BinaryMutex.h b/src/kernel/KernelKit/BinaryMutex.h index 2fb390d3..d97ab854 100644 --- a/src/kernel/KernelKit/BinaryMutex.h +++ b/src/kernel/KernelKit/BinaryMutex.h @@ -8,12 +8,14 @@ #include #include +#include #include namespace Kernel { class UserProcess; /// @brief Access control class, which locks a task until one is done. +/// Implements priority inheritance to prevent priority inversion. class BinaryMutex final { public: using LockedPtr = UserProcess*; @@ -37,6 +39,7 @@ class BinaryMutex final { private: LockedPtr fLockingProcess{nullptr}; + AffinityKind fOwnerOriginalAffinity{AffinityKind::kInvalid}; // for priority inheritance }; } // namespace Kernel -- cgit v1.2.3