Master the fundamental concepts of process management through this focused micro-challenge.
Every runnable entity in the kernel is described by a Process Control Block. It is not a metaphor: schedulers, signal delivery, and /proc readers all walk the same struct fields. Linux calls it task_struct; you will name yours struct process, but the responsibilities match.
A practical PCB for this curriculum:
pid, ppid, command nameFor example, when PID 42 blocks on a pipe read, its state moves from RUNNING to BLOCKED and the scheduler must not select it until the read completes.
The struct you're designing mirrors Linux's real task_struct in sched.h, which has grown to hundreds of fields and is why /proc/[pid]/status can expose dozens of process attributes to tools like ps and top. Getting the fork()-copy semantics right here matters in production: forgetting to reset a field like open file descriptors is exactly the kind of bug that caused real fd-leak incidents in forking servers.
Before you call the implementation done, walk failure modes on purpose. Test empty structures, single-element edge cases, maximum concurrency, and errno paths that must not crash the program. OS code usually fails in production when happy-path tests pass but invariants break under contention or memory pressure.
Keep structures small and name fields after kernel counterparts when possible. That lets you read man pages and kernel source side by side while you work. Print observable events during development; remove noisy logs once tests pass reliably.
You will design and populate struct process and helper functions to allocate, find, and free entries. The PCB you build here is reused by later tasks on context switch and wait(), so treat field layout as a long-lived API.
Design and implement a comprehensive Process Control Block structure.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github