summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-20 15:58:45 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-20 15:58:45 +0200
commitec365b82d5e05ec419aa917a8ec43abe496b655a (patch)
tree5a89d96ec1ee01aa28a11d04a36963bd79cac8a5 /Kernel
parent45a30b4dfa2d1edce4a4dbe789f8678077880592 (diff)
downloadserenity-ec365b82d5e05ec419aa917a8ec43abe496b655a.zip
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. :^)
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Process.cpp1
-rw-r--r--Kernel/Process.h1
-rw-r--r--Kernel/Scheduler.cpp4
3 files changed, 5 insertions, 1 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index af7716c0bd..2a841a1089 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -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";
diff --git a/Kernel/Process.h b/Kernel/Process.h
index 6c95fc644e..3029533852 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -43,6 +43,7 @@ public:
static Vector<Process*> all_processes();
enum Priority {
+ IdlePriority,
LowPriority,
NormalPriority,
HighPriority,
diff --git a/Kernel/Scheduler.cpp b/Kernel/Scheduler.cpp
index 66f91c8871..52b6cc3965 100644
--- a/Kernel/Scheduler.cpp
+++ b/Kernel/Scheduler.cpp
@@ -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);
}