1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

Kernel: Also add a process boosting mechanism

Let's also have set_process_boost() for giving all threads in a process
the same boost.
This commit is contained in:
Andreas Kling 2019-12-30 20:10:00 +01:00
parent 0dea0fd06f
commit a69734bf2e
6 changed files with 33 additions and 2 deletions

View file

@ -235,6 +235,7 @@ public:
void* sys$get_kernel_info_page();
int sys$futex(const Syscall::SC_futex_params*);
int sys$set_thread_boost(int tid, int amount);
int sys$set_process_boost(pid_t, int amount);
static void initialize();
@ -308,6 +309,8 @@ public:
int icon_id() const { return m_icon_id; }
u32 priority_boost() const { return m_priority_boost; }
private:
friend class MemoryManager;
friend class Scheduler;
@ -396,6 +399,8 @@ private:
int m_icon_id { -1 };
u32 m_priority_boost { 0 };
WaitQueue& futex_queue(i32*);
HashMap<u32, OwnPtr<WaitQueue>> m_futex_queues;
};
@ -520,3 +525,8 @@ inline const LogStream& operator<<(const LogStream& stream, const Process& proce
{
return stream << process.name() << '(' << process.pid() << ')';
}
inline u32 Thread::effective_priority() const
{
return m_priority + m_process.priority_boost() + m_priority_boost + m_extra_priority;
}