Summary
The process table lookup path exists, but newly created processes are not consistently inserted into procs[]. PID-based management can therefore fail to find live tasks.
This affects routines such as proc_find_by_pid, proc_kill_pid, wait/kill/list behavior, and procfs-style process reporting.
Current Notes
Tracked locally in scheduler_issues.md as "PID Table Never Populated".
Relevant code:
src/kernel/proc/proc.c: procs[]
src/kernel/proc/proc.c: proc_find_by_pid
src/kernel/proc/proc.c: proc_kill_pid
- process creation/exec and teardown paths
Expected Behavior
Every live process with a PID should be discoverable through the canonical PID table, and removed from that table exactly once during teardown.
Proposed Fix
Assign each allocated process to a free slot in procs[] during creation/exec, and clear that slot during teardown after no PID lookup should return it.
The implementation should define ownership clearly so that fork/exec/wait/kill/procfs all agree on process lifetime.
Dependencies
Blocks
Related Issues
Validation
- Add or update tests for PID lookup after process creation.
- Validate kill/wait/list behavior against live and terminated processes.
- Boot smoke test with repeated fork/exec/wait workloads.
- Confirm
make test still passes.
Summary
The process table lookup path exists, but newly created processes are not consistently inserted into
procs[]. PID-based management can therefore fail to find live tasks.This affects routines such as
proc_find_by_pid,proc_kill_pid, wait/kill/list behavior, and procfs-style process reporting.Current Notes
Tracked locally in
scheduler_issues.mdas "PID Table Never Populated".Relevant code:
src/kernel/proc/proc.c:procs[]src/kernel/proc/proc.c:proc_find_by_pidsrc/kernel/proc/proc.c:proc_kill_pidExpected Behavior
Every live process with a PID should be discoverable through the canonical PID table, and removed from that table exactly once during teardown.
Proposed Fix
Assign each allocated process to a free slot in
procs[]during creation/exec, and clear that slot during teardown after no PID lookup should return it.The implementation should define ownership clearly so that fork/exec/wait/kill/procfs all agree on process lifetime.
Dependencies
Blocks
Related Issues
Validation
make teststill passes.