diff options
author | Robert Morris <[email protected]> | 2019-07-10 09:28:00 -0400 |
---|---|---|
committer | Robert Morris <[email protected]> | 2019-07-10 09:28:00 -0400 |
commit | c0266a877a25fdc0d73016bc7e7bf0f1800b3e0e (patch) | |
tree | 9f98d3647c3777a7f217607d288a5878925a0839 | |
parent | 5eb1685700a7665814f1bcf63fc26f5dbf0f719a (diff) | |
download | xv6-labs-c0266a877a25fdc0d73016bc7e7bf0f1800b3e0e.tar.gz xv6-labs-c0266a877a25fdc0d73016bc7e7bf0f1800b3e0e.tar.bz2 xv6-labs-c0266a877a25fdc0d73016bc7e7bf0f1800b3e0e.zip |
document which proc fields are protected by p->lock
-rw-r--r-- | kernel/proc.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/kernel/proc.h b/kernel/proc.h index 373b605..1524c74 100644 --- a/kernel/proc.h +++ b/kernel/proc.h @@ -87,16 +87,20 @@ enum procstate { UNUSED, SLEEPING, RUNNABLE, RUNNING, ZOMBIE }; // Per-process state struct proc { struct spinlock lock; + + // p->lock must be held when using these: + enum procstate state; // Process state + struct proc *parent; // Parent process + void *chan; // If non-zero, sleeping on chan + int killed; // If non-zero, have been killed + int pid; // Process ID + + // these are private to the process, so p->lock need not be held. char *kstack; // Bottom of kernel stack for this process uint64 sz; // Size of process memory (bytes) pagetable_t pagetable; // Page table - enum procstate state; // Process state - int pid; // Process ID - struct proc *parent; // Parent process struct trapframe *tf; // data page for trampoline.S struct context context; // swtch() here to run process - void *chan; // If non-zero, sleeping on chan - int killed; // If non-zero, have been killed struct file *ofile[NOFILE]; // Open files struct inode *cwd; // Current directory char name[16]; // Process name (debugging) |