pub struct ProcessDescriptor {Show 26 fields
pub compiled: Mutex<Box<dyn CompiledProcess>>,
pub queued_this_pass: AtomicBool,
pub started: AtomicBool,
pub wait_state: Option<WaitSpec>,
pub fork_parent: Option<ProcessId>,
pub disable_names: Vec<String>,
pub fork_children: Vec<ProcessId>,
pub fork_gen: u64,
pub fork_group: u64,
pub registration_order: u64,
pub fork_join_kind: Option<JoinKind>,
pub fork_remaining: u32,
pub fork_any_signaled: bool,
pub wait_fork_remaining: Option<u32>,
pub wait_order: Option<(Vec<ProcessId>, usize)>,
pub wait_order_violated: bool,
pub region_id: u32,
pub suspended: bool,
pub parked: Option<ResumeArg>,
pub awaiting: Option<ProcessId>,
pub sync_blocked: bool,
pub waiting: bool,
pub wait_set: Option<EventWaitSet>,
pub desensitized: bool,
pub reactive: bool,
pub program_thread: bool,
}Expand description
One resumable process’s scheduler-owned bookkeeping (scheduler.md §5; ledger
SC-063’s named shape, plus the fork/join fields Task 11/D1a add and the
Mutex/AtomicBool review fix Task 11 records for SC-061 — see the plan’s
Task 11 “Review fix (SC-061 concurrency, Task 12)” note).
Fields§
§compiled: Mutex<Box<dyn CompiledProcess>>The compiled kernel this descriptor drives. Mutex-wrapped (not a bare
Box) so ResumeDriver can reach it through a shared &ProcessTable
and still get exclusive &mut access for the duration of one resume()
call — the actual SC-061 guarantee (Mutex<T>: Sync since
CompiledProcess: Send).
queued_this_pass: AtomicBool§started: AtomicBoolResumeDriver::start’s once-only CAS (SC-059, Task 12, resume.rs).
Not written by this file.
wait_state: Option<WaitSpec>§fork_parent: Option<ProcessId>§disable_names: Vec<String>The name(s) a disable <label>; anywhere may single this live
process out by (LRM 9.6.2) – set once, at Suspend::ForkJoin
handling time, from the spawning SpawnSpec::disable_name this
process’s own fork branch carried (sched::control::Engine’s own
Suspend::ForkJoin arm, its one writer); empty for a process no
label could ever single out (an unnamed branch of an unnamed fork,
or a process not spawned by a fork at all). Engine:: collect_disable_named is its one reader.
fork_children: Vec<ProcessId>Every live-or-recently-live immediate child of this process, across
ALL of its forks (LRM 9.6.1: wait fork waits for every immediate
child, 9.6.3: disable fork ends every descendant), oldest fork
first. handle_fork prunes entries already reclaimed.
fork_gen: u64How many forks this process has executed: the generation of its
MOST RECENT fork. The join bookkeeping below (fork_join_kind,
fork_remaining, fork_any_signaled) belongs to that fork only; a
child of an earlier fork (fork_group != this) never touches it.
fork_group: u64On a fork child: the parent’s fork_gen at the moment this child was
spawned, i.e. which fork of the parent it belongs to.
registration_order: u64§fork_join_kind: Option<JoinKind>§fork_remaining: u32§fork_any_signaled: bool§wait_fork_remaining: Option<u32>Task 9 (B-sched wave, SC-125): Some(n) while this process is
suspended via Suspend::WaitFork, counting how many of its own
fork_children were still live (not yet Suspend::Done + reclaimed)
at the moment Engine::apply_suspend installed this wait
(apply_wait_fork, sched/control.rs). Independent of
fork_join_kind/fork_remaining above (a real wait fork; is
always preceded by a fork ... join_none, which leaves
fork_join_kind permanently at Some(JoinKind::None) – see
handle_fork’s own doc comment – so there is no real overlap
between the two mechanisms). None when not currently waiting;
cleared back to None by ResumeDriver::on_child_done the instant
it reaches 0 and the parent has been notified via
ResumeArg::AllForkChildrenDone.
wait_order: Option<(Vec<ProcessId>, usize)>Task 9 (SC-125): Some((order, next_index)) while this process is
suspended via Suspend::WaitOrder(order) (apply_wait_order,
sched/control.rs) – next_index is the index into order of the
next completion this parent expects. None when not currently
waiting on an ordered join.
wait_order_violated: boolTask 9 (SC-125): latched true the first time a wait_order-
suspended parent observes an out-of-order completion
(ResumeDriver::on_child_done). Once set, no later completion can
ever satisfy this parent’s wait – every subsequent on_child_done
call against it returns Ok(None), never re-fires the violation and
never silently accepts a reordering. The violation itself is
surfaced exactly once, as Err(ResumeError::WaitOrderViolated(child))
from the on_child_done call that first set this flag.
region_id: u32Task 9 (A2-part2, CG-102): this process’s own ProcessSideTable:: region_id, threaded from SchedulerControl::register_process’s new
parameter (sched/control.rs’s own doc comment) – defaults to 0
for a process registered directly through ProcessTable::register
(fork children, and every Task 11/12-owned unit test in this file/
finals.rs/resume.rs, none of which has any notion of region_id
– see set_region_id’s own doc comment for why this field’s
initial value is set here rather than by widening register’s own
signature), which is also v1’s own real, correct value for every one
of those processes (ARCHITECTURE §4 item 1: a single conservative
partition).
suspended: boolClasses plan Task 13 (LRM 9.7): true between p.suspend() and
p.resume(). A suspended process’s activations are parked (see
parked) instead of dispatched.
parked: Option<ResumeArg>The activation argument that arrived while suspended; replayed by
p.resume(). Later arrivals coalesce into it (the last one wins).
awaiting: Option<ProcessId>Some(t) while this process is blocked in t.await().
sync_blocked: boolClasses plan Task 17 (LRM 15.3): true while this process is blocked
in a synchronisation-object call (semaphore.get) that the matching
put has not yet released (super::ProcessRequest::SyncBlock/
SyncWake).
waiting: booltrue while the process is yielded on a wait (#, @, wait,
join, …) – process::WAITING. Maintained only once some process
handle exists (Engine::any_tracked), so programs that never use the
class pay nothing.
wait_set: Option<EventWaitSet>The event wait this process is blocked in (Suspend::WaitEvents),
kept while waiting so p.suspend() can desensitise it (LRM 9.7.4)
and p.resume() resensitise it (LRM 9.7.5). Maintained under the
same gate as waiting.
desensitized: booltrue while wait_set’s dynamic sensitivity is removed because the
process is suspended; resume() reinstalls it.
reactive: boolWhether this process runs in the Reactive region (LRM 17.7.3: a
checker’s procedures, continuous assignments and output formal
connections are “scheduled in the Reactive region, similarly to
programs”). Every wake-up of such a process – a sensitivity match,
including the one a write made by another Reactive process causes –
lands in the Reactive queue instead of Active. false for every
design process.
program_thread: boolA program initial thread or a fork descendant of one (LRM 24.3).