Use RW spin locks
All checks were successful
Build documentation / build-and-deploy (push) Successful in 39s

This commit is contained in:
2026-01-09 19:53:08 +01:00
parent a5283283f6
commit 6a474c21a0
9 changed files with 198 additions and 39 deletions

View File

@@ -15,10 +15,12 @@
#include <amd64/proc.h> /* USTACK_SIZE */
#endif
/// Process is ready to run
/* Process is ready to run */
#define PROC_READY 0
/// Process marked garbage collection
/* Process marked garbage collection */
#define PROC_DEAD 1
/* Process is suspended */
#define PROC_SUSPENDED 2
#define PROC_RESOURCES_MAX 1024
@@ -36,6 +38,7 @@ struct proc {
int pid;
struct rb_node_link proc_tree_link;
struct rb_node_link cpu_run_q_link;
struct rb_node_link suspension_link;
struct list_node_link* mappings; /* pd.lock implicitly protects this field */
struct proc_platformdata pdata;
@@ -45,8 +48,15 @@ struct proc {
atomic_int state;
struct rb_node_link* resource_tree;
atomic_int rids;
struct proc_suspension_q* suspension_q;
};
struct proc_suspension_q {
struct rb_node_link* proc_tree;
spin_lock_t lock;
};
void proc_suspend (struct proc* proc, struct proc_suspension_q* sq);
void proc_sched (void);
void proc_kill (struct proc* proc);
bool proc_map (struct proc* proc, uintptr_t start_paddr, uintptr_t start_vaddr, size_t pages,