This page lists synchronization invariants that hold in Chickadee. See also spinlocks.
A CPU’s run queue, which is implemented by members in
cpustateandproc(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::schedulecan 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::yieldandproc::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::yieldmust be called with no spinlocks held.proc::yield_noreturnmust be called with no spinlocks held and with interrupts disabled.cpustate::schedulemust be called with no spinlocks held and with interrupts disabled.Read or write access to the process table
ptablerequires theptable_lockspinlock.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_readto block).