FreeNOS
Scheduler.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009 Niek Linnenbank
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef __KERNEL_SCHEDULER_H
19 #define __KERNEL_SCHEDULER_H
20 #ifndef __ASSEMBLER__
21 
22 #include <Vector.h>
23 #include <Macros.h>
24 #include <Queue.h>
25 #include "Process.h"
26 #include "ProcessManager.h"
27 
36 class Scheduler
37 {
38  public:
39 
43  enum Result
44  {
47  };
48 
49  public:
50 
54  Scheduler();
55 
61  Size count() const;
62 
71  Result enqueue(Process *proc, bool ignoreState);
72 
81  Result dequeue(Process *proc, bool ignoreState);
82 
88  Process * select();
89 
90  private:
91 
94 };
95 
100 #endif /* __ASSEMBLER__ */
101 #endif /* __KERNEL_SCHEDULER_H */
Scheduler::count
Size count() const
Get number of processes on the schedule.
Definition: Scheduler.cpp:27
Scheduler
Responsible for deciding which Process may execute on the local Core.
Definition: Scheduler.h:36
Macros.h
Vector.h
Scheduler::Success
@ Success
Definition: Scheduler.h:45
Process
Represents a process which may run on the host.
Definition: Process.h:44
Scheduler::InvalidArgument
@ InvalidArgument
Definition: Scheduler.h:46
Scheduler::Scheduler
Scheduler()
Constructor function.
Definition: Scheduler.cpp:22
Process.h
Scheduler::m_queue
Queue< Process *, MAX_PROCS > m_queue
Contains processes ready to run.
Definition: Scheduler.h:93
Scheduler::select
Process * select()
Select the next process to run.
Definition: Scheduler.cpp:69
Queue.h
ProcessManager.h
Size
unsigned int Size
Any sane size indicator cannot go negative.
Definition: Types.h:128
Scheduler::enqueue
Result enqueue(Process *proc, bool ignoreState)
Add a Process to the run schedule.
Definition: Scheduler.cpp:32
Queue< Process *, MAX_PROCS >
Scheduler::dequeue
Result dequeue(Process *proc, bool ignoreState)
Remove a Process from the run schedule.
Definition: Scheduler.cpp:44
Scheduler::Result
Result
Result code.
Definition: Scheduler.h:43