Use red-black trees to store process run queue and process list
All checks were successful
Build documentation / build-and-deploy (push) Successful in 43s

This commit is contained in:
2026-01-05 18:30:58 +01:00
parent b1579e4ac1
commit fcd5658a80
4 changed files with 320 additions and 34 deletions

View File

@@ -3,6 +3,7 @@
#include <aux/compiler.h>
#include <aux/elf.h>
#include <libk/rbtree.h>
#include <libk/std.h>
#include <sync/spin_lock.h>
#include <sys/mm.h>
@@ -29,13 +30,16 @@ struct proc_mapping {
struct procw;
struct proc {
struct proc* next;
int pid;
struct rb_node_link proc_tree_link;
struct rb_node_link cpu_run_q_link;
struct proc_mapping* mappings; /* pd.lock implicitly protects this field */
struct proc_platformdata pdata;
struct pd pd;
spin_lock_t lock;
struct cpu* cpu;
struct procw* procw; /* link to it's global struct */
// struct procw* procw; /* link to it's global struct */
atomic_int state;
};
@@ -44,10 +48,10 @@ struct proc {
* struct procw is a process wrapper that is a member of
* a global process list.
*/
struct procw {
struct procw* next;
struct proc* proc;
};
/* struct procw { */
/* struct procw* next; */
/* struct proc* proc; */
/* }; */
void proc_sched (void);
void proc_kill (struct proc* proc);