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
37{
38 public:
39
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 */
Represents a process which may run on the host.
Definition Process.h:45
Array of items as a First-In-First-Out (FIFO) datastructure.
Definition Queue.h:37
Responsible for deciding which Process may execute on the local Core.
Definition Scheduler.h:37
Queue< Process *, MAX_PROCS > m_queue
Contains processes ready to run.
Definition Scheduler.h:93
Result dequeue(Process *proc, bool ignoreState)
Remove a Process from the run schedule.
Definition Scheduler.cpp:44
Scheduler()
Constructor function.
Definition Scheduler.cpp:22
Process * select()
Select the next process to run.
Definition Scheduler.cpp:69
Size count() const
Get number of processes on the schedule.
Definition Scheduler.cpp:27
Result enqueue(Process *proc, bool ignoreState)
Add a Process to the run schedule.
Definition Scheduler.cpp:32
Result
Result code.
Definition Scheduler.h:44
@ InvalidArgument
Definition Scheduler.h:46
unsigned int Size
Any sane size indicator cannot go negative.
Definition Types.h:128