MentOS
0.8.0
The Mentoring Operating System
|
Scheduler structures and functions. More...
Go to the source code of this file.
Classes | |
struct | runqueue_t |
Structure that contains information about live processes. More... | |
struct | sched_param_t |
Structure that describes scheduling parameters. More... | |
Typedefs | |
typedef struct runqueue_t | runqueue_t |
Structure that contains information about live processes. | |
typedef struct sched_param_t | sched_param_t |
Structure that describes scheduling parameters. | |
Functions | |
void | scheduler_initialize (void) |
Initialize the scheduler. | |
uint32_t | scheduler_getpid (void) |
Returns a non-decreasing unique process id. More... | |
task_struct * | scheduler_get_current_process (void) |
Returns the pointer to the current active process. More... | |
time_t | scheduler_get_maximum_vruntime (void) |
Returns the maximum vruntime of all the processes in running state. More... | |
size_t | scheduler_get_active_processes (void) |
Returns the number of active processes. More... | |
task_struct * | scheduler_get_running_process (pid_t pid) |
Returns a pointer to the process with the given pid. More... | |
void | scheduler_enqueue_task (task_struct *process) |
Activate the given process. More... | |
void | scheduler_dequeue_task (task_struct *process) |
Removes the given process from the queue. More... | |
void | scheduler_run (pt_regs *f) |
The RR implementation of the scheduler. More... | |
void | scheduler_store_context (pt_regs *f, task_struct *process) |
Values from pt_regs to task_struct process. More... | |
void | scheduler_restore_context (task_struct *process, pt_regs *f) |
Values from task_struct process to pt_regs. More... | |
void | scheduler_enter_user_jmp (uintptr_t location, uintptr_t stack) |
Switch CPU to user mode and start running that given process. More... | |
task_struct * | scheduler_pick_next_task (runqueue_t *runqueue) |
Picks the next task (in scheduler_algorithm.c). More... | |
int | sys_sched_setparam (pid_t pid, const sched_param_t *param) |
Set new scheduling settings for the given process. More... | |
int | sys_sched_getparam (pid_t pid, sched_param_t *param) |
Gets the scheduling settings for the given process. More... | |
int | sys_waitperiod (void) |
Puts the process on wait until its next period starts. More... | |
int | is_orphaned_pgrp (pid_t gid) |
Returns 1 if the given group is orphaned, the session leader of the group is no longer alive. More... | |
void | do_exit (int status) |
Exit the current process with status. More... | |
Scheduler structures and functions.
void do_exit | ( | int | status | ) |
Exit the current process with status.
status | The exit status of the current process |
int is_orphaned_pgrp | ( | pid_t | gid | ) |
Returns 1 if the given group is orphaned, the session leader of the group is no longer alive.
gid | ID of the group |
void scheduler_dequeue_task | ( | task_struct * | process | ) |
Removes the given process from the queue.
process | Process that has to be activated. |
void scheduler_enqueue_task | ( | task_struct * | process | ) |
Activate the given process.
process | Process that has to be activated. |
Switch CPU to user mode and start running that given process.
location | The instruction pointer of the process we are starting. |
stack | Address of the stack of that process. |
size_t scheduler_get_active_processes | ( | void | ) |
Returns the number of active processes.
task_struct* scheduler_get_current_process | ( | void | ) |
Returns the pointer to the current active process.
time_t scheduler_get_maximum_vruntime | ( | void | ) |
Returns the maximum vruntime of all the processes in running state.
task_struct* scheduler_get_running_process | ( | pid_t | pid | ) |
Returns a pointer to the process with the given pid.
pid | The pid of the process we are looking for. |
uint32_t scheduler_getpid | ( | void | ) |
Returns a non-decreasing unique process id.
The current unused PID.
task_struct* scheduler_pick_next_task | ( | runqueue_t * | runqueue | ) |
Picks the next task (in scheduler_algorithm.c).
runqueue | Pointer to the runqueue. |
void scheduler_restore_context | ( | task_struct * | process, |
pt_regs * | f | ||
) |
Values from task_struct process to pt_regs.
process | The process for which we are restoring the registers in CPU . |
f | The set of registers we are restoring. |
void scheduler_run | ( | pt_regs * | f | ) |
The RR implementation of the scheduler.
f | The context of the process. |
void scheduler_store_context | ( | pt_regs * | f, |
task_struct * | process | ||
) |
Values from pt_regs to task_struct process.
f | The set of registers we are saving. |
process | The process for which we are saving the CPU registers status. |
int sys_sched_getparam | ( | pid_t | pid, |
sched_param_t * | param | ||
) |
Gets the scheduling settings for the given process.
pid | ID of the process we are manipulating. |
param | Where we store the parameters. |
int sys_sched_setparam | ( | pid_t | pid, |
const sched_param_t * | param | ||
) |
Set new scheduling settings for the given process.
pid | ID of the process we are manipulating. |
param | New parameters. |
int sys_waitperiod | ( | void | ) |
Puts the process on wait until its next period starts.