Kernel: Make the colonel run at "Idle" priority (the lowest possible.)
This means it won't hog the CPU for more than a single timeslice. :^)
This commit is contained in:
parent
45a30b4dfa
commit
ec365b82d5
Notes:
sideshowbarker
2024-07-19 14:38:27 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ec365b82d5e
4 changed files with 12 additions and 4 deletions
|
@ -84,12 +84,14 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
|
|||
case Column::State: return process.current_state.state;
|
||||
case Column::User: return process.current_state.user;
|
||||
case Column::Priority:
|
||||
if (process.current_state.priority == "Low")
|
||||
if (process.current_state.priority == "Idle")
|
||||
return 0;
|
||||
if (process.current_state.priority == "Normal")
|
||||
if (process.current_state.priority == "Low")
|
||||
return 1;
|
||||
if (process.current_state.priority == "High")
|
||||
if (process.current_state.priority == "Normal")
|
||||
return 2;
|
||||
if (process.current_state.priority == "High")
|
||||
return 3;
|
||||
ASSERT_NOT_REACHED();
|
||||
return 3;
|
||||
case Column::Linear: return (int)process.current_state.linear;
|
||||
|
@ -110,6 +112,8 @@ GVariant ProcessModel::data(const GModelIndex& index, Role role) const
|
|||
case Column::State: return process.current_state.state;
|
||||
case Column::User: return process.current_state.user;
|
||||
case Column::Priority:
|
||||
if (process.current_state.priority == "Idle")
|
||||
return String::empty();
|
||||
if (process.current_state.priority == "High")
|
||||
return *m_high_priority_icon;
|
||||
if (process.current_state.priority == "Low")
|
||||
|
|
|
@ -2376,6 +2376,7 @@ int Process::sys$get_shared_buffer_size(int shared_buffer_id)
|
|||
const char* to_string(Process::Priority priority)
|
||||
{
|
||||
switch (priority) {
|
||||
case Process::IdlePriority: return "Idle";
|
||||
case Process::LowPriority: return "Low";
|
||||
case Process::NormalPriority: return "Normal";
|
||||
case Process::HighPriority: return "High";
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
static Vector<Process*> all_processes();
|
||||
|
||||
enum Priority {
|
||||
IdlePriority,
|
||||
LowPriority,
|
||||
NormalPriority,
|
||||
HighPriority,
|
||||
|
|
|
@ -18,6 +18,8 @@ static dword time_slice_for(Process::Priority priority)
|
|||
return 15;
|
||||
case Process::LowPriority:
|
||||
return 5;
|
||||
case Process::IdlePriority:
|
||||
return 1;
|
||||
}
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
@ -385,7 +387,7 @@ void Scheduler::initialize()
|
|||
initialize_redirection();
|
||||
s_colonel_process = Process::create_kernel_process("colonel", nullptr);
|
||||
// Make sure the colonel uses a smallish time slice.
|
||||
s_colonel_process->set_priority(Process::LowPriority);
|
||||
s_colonel_process->set_priority(Process::IdlePriority);
|
||||
load_task_register(s_redirection.selector);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue