diff options
author | Marvin Borner | 2020-05-11 22:45:08 +0200 |
---|---|---|
committer | Marvin Borner | 2020-05-11 22:45:08 +0200 |
commit | fe4280eb69fbeb386b5442b3aeb515dde1c117ec (patch) | |
tree | 5837a5af36629ddad0215c248f30cd8ce6bb385c /src/kernel/tasks | |
parent | 9b959a402f1998a9c608b917034cae81bd03b088 (diff) |
Some scheduling improvements
And other stuff..
Diffstat (limited to 'src/kernel/tasks')
-rw-r--r-- | src/kernel/tasks/process.c | 16 | ||||
-rw-r--r-- | src/kernel/tasks/process.h | 1 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/kernel/tasks/process.c b/src/kernel/tasks/process.c index e1a6006..a361355 100644 --- a/src/kernel/tasks/process.c +++ b/src/kernel/tasks/process.c @@ -22,7 +22,7 @@ extern u32 stack_hold; void scheduler(struct regs *regs) { - log("%d", quantum); + serial_put('.'); if (quantum == 0 || current_proc->state != PROC_RUNNING) { quantum = 42; // For next process } else { @@ -54,6 +54,12 @@ void scheduler(struct regs *regs) paging_switch_directory(current_proc->cr3); } +void process_force_switch(struct regs *regs) +{ + quantum = 0; + scheduler(regs); +} + void process_init(struct process *proc) { log("Initializing process %d", pid); @@ -71,8 +77,8 @@ void process_init(struct process *proc) u32 process_spawn(struct process *process) { debug("Spawning process %d", process->pid); - process->next = root->next; - root->next = process; + process->next = current_proc->next; + current_proc->next = process; process->state = PROC_RUNNING; process->parent = current_proc; @@ -209,8 +215,6 @@ u32 uexec(char *path) if (proc == NULL) return -1; - proc->parent = current_proc; - proc->gid = current_proc->pid; process_spawn(proc); log("Spawned"); return 0; @@ -224,8 +228,6 @@ u32 uspawn(char *path) if (proc == NULL) return -1; - proc->parent = current_proc; - proc->gid = current_proc->pid; process_spawn(proc); log("Spawned"); return 0; diff --git a/src/kernel/tasks/process.h b/src/kernel/tasks/process.h index 4220d1e..c015df9 100644 --- a/src/kernel/tasks/process.h +++ b/src/kernel/tasks/process.h @@ -31,6 +31,7 @@ struct process { }; void scheduler(struct regs *regs); +void process_force_switch(struct regs *regs); u32 process_spawn(struct process *process); void process_suspend(u32 pid); |