Working on scheduling
This commit is contained in:
parent
cfcb806ebf
commit
edfbfdad14
9 changed files with 19 additions and 39 deletions
|
|
@ -16,20 +16,15 @@ int next_pid = 1;
|
|||
|
||||
void idle_task(){
|
||||
for(;;){
|
||||
kprintf("Idle!!1\n");
|
||||
}
|
||||
}
|
||||
|
||||
void test_task(){
|
||||
for(;;){
|
||||
kprintf("Hello world from scheduled task!\n");
|
||||
}
|
||||
kprintf("Hello world from scheduled task!\n");
|
||||
}
|
||||
|
||||
void best_task(){
|
||||
for(;;){
|
||||
kprintf("Hello world I am best\n");
|
||||
}
|
||||
kprintf("Hello world I am best\n");
|
||||
}
|
||||
|
||||
/* Setup a process structure */
|
||||
|
|
@ -115,19 +110,18 @@ void scheduler_init(){
|
|||
for(;;){
|
||||
for(; i < PROC_MAX; i++){
|
||||
if(proc_list[i].state == READY){
|
||||
asm("sti");
|
||||
proc *prev = state->current_process;
|
||||
prev->state = READY;
|
||||
state->current_process = &proc_list[i];
|
||||
state->current_process->state = RUNNING;
|
||||
switch_context(&(get_cpu_struct()->scheduler_context), get_cpu_struct()->current_process->context);
|
||||
|
||||
}
|
||||
}
|
||||
i = 1;
|
||||
i = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void enter_scheduler(){
|
||||
switch_context(&get_cpu_struct()->current_process->context, (get_cpu_struct()->scheduler_context));
|
||||
|
||||
switch_context(&get_cpu_struct()->current_process->context, get_cpu_struct()->scheduler_context);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue