mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:17:44 +00:00
Kernel: Add basic process priority support.
For now, the WindowServer process will run with high priority, while the Finalizer process will run with low priority. Everyone else gets to be "normal". At the moment, priority simply determines the size of your time slices.
This commit is contained in:
parent
ee2bb98b88
commit
71b9ec1ae0
6 changed files with 46 additions and 7 deletions
|
@ -80,6 +80,12 @@ public:
|
|||
BlockedSelect,
|
||||
};
|
||||
|
||||
enum Priority {
|
||||
LowPriority,
|
||||
NormalPriority,
|
||||
HighPriority,
|
||||
};
|
||||
|
||||
enum RingLevel {
|
||||
Ring0 = 0,
|
||||
Ring3 = 3,
|
||||
|
@ -100,6 +106,9 @@ public:
|
|||
|
||||
static Process* from_pid(pid_t);
|
||||
|
||||
void set_priority(Priority p) { m_priority = p; }
|
||||
Priority priority() const { return m_priority; }
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
pid_t pid() const { return m_pid; }
|
||||
pid_t sid() const { return m_sid; }
|
||||
|
@ -328,6 +337,7 @@ private:
|
|||
dword m_stack_top3 { 0 };
|
||||
FarPtr m_far_ptr;
|
||||
State m_state { Invalid };
|
||||
Priority m_priority { NormalPriority };
|
||||
dword m_wakeup_time { 0 };
|
||||
TSS32 m_tss;
|
||||
TSS32 m_tss_to_resume_kernel;
|
||||
|
@ -464,6 +474,17 @@ static inline const char* to_string(Process::State state)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static inline const char* to_string(Process::Priority state)
|
||||
{
|
||||
switch (state) {
|
||||
case Process::LowPriority: return "Low";
|
||||
case Process::NormalPriority: return "Normal";
|
||||
case Process::HighPriority: return "High";
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extern void block(Process::State);
|
||||
extern void sleep(dword ticks);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue