From 67702cf706bce7adef472f0caa48d81ddfaeb33a Mon Sep 17 00:00:00 2001 From: Frans Kaashoek Date: Tue, 2 Jul 2019 09:14:47 -0400 Subject: Checkpoint switching to per-process locks, in attempt clarify xv6's locking plan, which is a difficult to understand because ptable lock protects many invariants. This implementation has a bug: once in a while xv6 unlocks a proc lock that is locked by another core. --- kernel/proc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'kernel/proc.h') diff --git a/kernel/proc.h b/kernel/proc.h index 278e4cd..0fa61ff 100644 --- a/kernel/proc.h +++ b/kernel/proc.h @@ -82,6 +82,7 @@ enum procstate { UNUSED, EMBRYO, SLEEPING, RUNNABLE, RUNNING, ZOMBIE }; // Per-process state struct proc { + struct spinlock lock; char *kstack; // Bottom of kernel stack for this process uint64 sz; // Size of process memory (bytes) pagetable_t pagetable; // Page table -- cgit v1.2.3 From 9d34838b4f7c859b753a32124002d7d845140b0a Mon Sep 17 00:00:00 2001 From: Robert Morris Date: Mon, 8 Jul 2019 11:11:00 -0400 Subject: holding p->lock all the way through state=RUNNABLE means we don't need EMBRYO --- kernel/proc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'kernel/proc.h') diff --git a/kernel/proc.h b/kernel/proc.h index 0fa61ff..687fdd1 100644 --- a/kernel/proc.h +++ b/kernel/proc.h @@ -78,7 +78,7 @@ struct trapframe { /* 280 */ uint64 t6; }; -enum procstate { UNUSED, EMBRYO, SLEEPING, RUNNABLE, RUNNING, ZOMBIE }; +enum procstate { UNUSED, SLEEPING, RUNNABLE, RUNNING, ZOMBIE }; // Per-process state struct proc { -- cgit v1.2.3