This page lists synchronization invariants that hold in Chickadee. See also spinlocks.
A CPU’s run queue, which is implemented by members in
cpustate
andproc
(cpustate::current_
,cpustate::runq_
, andproc::runq_links_
), is protected bycpustate::runq_lock_
. Reading or writing a CPU’s run queue requires that lock.cpustate::current_
is read-only, except thatcpustate::schedule
can modify it.A process may be the current process for some CPU, and simultaneously on the run queue for that same CPU.
The
proc::yields_
member may be accessed only byproc::yield
andproc::resume
.A newly-initialized user process has a nonnull
proc::regs_
pointer. It is safe to access that member and modify its contents, but only up to the point that the process is scheduled.Running processes must not access their
proc::regs_
members, except that if interrupts are disabled, the current process may setregs_
and callproc::yield_return
. (Seeproc::exception
’s timer interrupt case.)proc::yield
must be called with no spinlocks held.proc::yield_noreturn
must be called with no spinlocks held and with interrupts disabled.cpustate::schedule
must be called with no spinlocks held and with interrupts disabled.Read or write access to the process table
ptable
requires theptable_lock
spinlock.You may free a process’s page table pages only if (1) the process is not present in
ptable
, or (2) the process’s page table lock is locked for writing (forcingproc::lock_pagetable_read
to block).