mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:28:11 +00:00
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
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::State: return process.current_state.state;
|
||||||
case Column::User: return process.current_state.user;
|
case Column::User: return process.current_state.user;
|
||||||
case Column::Priority:
|
case Column::Priority:
|
||||||
if (process.current_state.priority == "Low")
|
if (process.current_state.priority == "Idle")
|
||||||
return 0;
|
return 0;
|
||||||
if (process.current_state.priority == "Normal")
|
if (process.current_state.priority == "Low")
|
||||||
return 1;
|
return 1;
|
||||||
if (process.current_state.priority == "High")
|
if (process.current_state.priority == "Normal")
|
||||||
return 2;
|
return 2;
|
||||||
|
if (process.current_state.priority == "High")
|
||||||
|
return 3;
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
return 3;
|
return 3;
|
||||||
case Column::Linear: return (int)process.current_state.linear;
|
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::State: return process.current_state.state;
|
||||||
case Column::User: return process.current_state.user;
|
case Column::User: return process.current_state.user;
|
||||||
case Column::Priority:
|
case Column::Priority:
|
||||||
|
if (process.current_state.priority == "Idle")
|
||||||
|
return String::empty();
|
||||||
if (process.current_state.priority == "High")
|
if (process.current_state.priority == "High")
|
||||||
return *m_high_priority_icon;
|
return *m_high_priority_icon;
|
||||||
if (process.current_state.priority == "Low")
|
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)
|
const char* to_string(Process::Priority priority)
|
||||||
{
|
{
|
||||||
switch (priority) {
|
switch (priority) {
|
||||||
|
case Process::IdlePriority: return "Idle";
|
||||||
case Process::LowPriority: return "Low";
|
case Process::LowPriority: return "Low";
|
||||||
case Process::NormalPriority: return "Normal";
|
case Process::NormalPriority: return "Normal";
|
||||||
case Process::HighPriority: return "High";
|
case Process::HighPriority: return "High";
|
||||||
|
|
|
@ -43,6 +43,7 @@ public:
|
||||||
static Vector<Process*> all_processes();
|
static Vector<Process*> all_processes();
|
||||||
|
|
||||||
enum Priority {
|
enum Priority {
|
||||||
|
IdlePriority,
|
||||||
LowPriority,
|
LowPriority,
|
||||||
NormalPriority,
|
NormalPriority,
|
||||||
HighPriority,
|
HighPriority,
|
||||||
|
|
|
@ -18,6 +18,8 @@ static dword time_slice_for(Process::Priority priority)
|
||||||
return 15;
|
return 15;
|
||||||
case Process::LowPriority:
|
case Process::LowPriority:
|
||||||
return 5;
|
return 5;
|
||||||
|
case Process::IdlePriority:
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
@ -385,7 +387,7 @@ void Scheduler::initialize()
|
||||||
initialize_redirection();
|
initialize_redirection();
|
||||||
s_colonel_process = Process::create_kernel_process("colonel", nullptr);
|
s_colonel_process = Process::create_kernel_process("colonel", nullptr);
|
||||||
// Make sure the colonel uses a smallish time slice.
|
// 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);
|
load_task_register(s_redirection.selector);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue