Skip to content

Bug: process PID table is not populated #426

Description

@pbalduino

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingkernelKernel-level implementation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions