diff options
| author | Amlal <amlalelmahrouss@icloud.com> | 2024-09-05 19:13:02 +0000 |
|---|---|---|
| committer | Amlal <amlalelmahrouss@icloud.com> | 2024-09-05 19:13:02 +0000 |
| commit | 621e814da6d5005ade8a1fe3f378a363db559cf7 (patch) | |
| tree | 438f1337c0eb2ae83cf3d409c29848d396be08b2 /dev/ZKA/KernelKit/UserProcessScheduler.hxx | |
| parent | cc9ce57cac59bd443e2319e3b8f427172b93f7da (diff) | |
| parent | 3b60a1e87ab02a1b72d8bb9f7392780899d5a0d7 (diff) | |
Merged in major-refactor (pull request #19)
Major refactor
Diffstat (limited to 'dev/ZKA/KernelKit/UserProcessScheduler.hxx')
| -rw-r--r-- | dev/ZKA/KernelKit/UserProcessScheduler.hxx | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/dev/ZKA/KernelKit/UserProcessScheduler.hxx b/dev/ZKA/KernelKit/UserProcessScheduler.hxx index 809dbb7f..9585da29 100644 --- a/dev/ZKA/KernelKit/UserProcessScheduler.hxx +++ b/dev/ZKA/KernelKit/UserProcessScheduler.hxx @@ -14,7 +14,6 @@ #define kSchedMinMicroTime (AffinityKind::kStandard) #define kSchedInvalidPID (-1) -#define kSchedMaxStackSz (4096) /* Max stack sz */ #define kSchedProcessLimitPerTeam (16U) //////////////////////////////////////////////////// @@ -28,7 +27,7 @@ namespace Kernel //! @note Forward declarations. class UserProcess; - class PEFDLLInterface; + class IPEFDLLObject; class UserProcessTeam; class UserProcessScheduler; class UserProcessHelper; @@ -53,12 +52,12 @@ namespace Kernel //! to run. enum class AffinityKind : Int32 { - kRealTime = 0500, - kVeryHigh = 2500, - kHigh = 2000, - kStandard = 1500, - kLowUsage = 1000, - kVeryLowUsage = 5000, + kRealTime = 500, + kVeryHigh = 250, + kHigh = 200, + kStandard = 1000, + kLowUsage = 1500, + kVeryLowUsage = 2000, }; // operator overloading. @@ -147,24 +146,33 @@ namespace Kernel User* Owner{nullptr}; HAL::StackFramePtr StackFrame{nullptr}; AffinityKind Affinity{AffinityKind::kStandard}; - ProcessStatusKind Status{ProcessStatusKind::kDead}; + ProcessStatusKind Status{ProcessStatusKind::kDead}; UInt8* StackReserve{nullptr}; // Memory, images pointers. - HeapPtrKind HeapCursor{nullptr}; ImagePtr Image{nullptr}; - HeapPtrKind HeapPtr{nullptr}; SizeT StackSize{mib_cast(8)}; - // shared library handle, reserved for kDLLKind types of executables only. - PEFDLLInterface* DLLPtr{nullptr}; - UserProcess* Parent{nullptr}; + //! @brief Shared library handle, reserved for kDLLKind types of executables only. + IPEFDLLObject* DLLPtr{nullptr}; + + /// @brief Parent process, reserved for threads only. + UserProcess* Parent{nullptr}; // Memory usage. - SizeT UsedMemory{0}; - SizeT FreeMemory{0}; - SizeT SizeMemory{gib_cast(4)}; + SizeT MemoryCursor{0}; + SizeT MemoryLimit{gib_cast(128)}; + + struct PROCESS_MEMORY_ENTRY + { + VoidPtr MemoryEntry; + + struct PROCESS_MEMORY_ENTRY *MemoryPrev; + struct PROCESS_MEMORY_ENTRY *MemoryNext; + } * MemoryEntryList{nullptr}; + + SizeT MemoryPD{0}; enum { @@ -212,9 +220,9 @@ namespace Kernel //! @return Int32 local error code. Int32& GetLocalCode() noexcept; - const User* GetOwner() noexcept; + const User* GetOwner() noexcept; const ProcessStatusKind& GetStatus() noexcept; - const AffinityKind& GetAffinity() noexcept; + const AffinityKind& GetAffinity() noexcept; private: UInt32 fLastExitCode{0}; @@ -290,6 +298,7 @@ namespace Kernel STATIC bool CanBeScheduled(UserProcess& process); STATIC PID& TheCurrentPID(); STATIC SizeT StartScheduling(); + STATIC Void Init(); }; const UInt32& sched_get_exit_code(void) noexcept; |
