Process and Task Manager Explorer¶
Specification¶
The full specification below is extracted from Chapter 12: File Management, Packages, and Remote Access on the Pi 500+.
Type: microsim
**sim-id:** process-task-manager-explorer<br/>
**Library:** p5.js<br/>
**Status:** Specified
Learning objective: Students will *analyze* (Bloom L4: Analyze) how multiple processes share processor time under multitasking, and how a task manager reports and can end a running process.
Canvas: 700x420px, responsive — recompute the process-list table and the CPU-timeline strip widths as fractions of `width` inside `windowResized()`.
Layout: a task-manager-style table listing five sample processes (e.g., "Web Browser," "Code Editor," "Terminal," "System Service," "Runaway Script") each with a simulated CPU % and memory (MB) column that updates slightly every couple of seconds. Above the table, a horizontal timeline strip shows short colored segments representing the operating system rapidly switching which process is actively using the processor, visualizing multitasking as fast alternation rather than true simultaneity.
Controls: a `createButton()` labeled "End Process" appears next to each row; clicking it removes that process from the table and from the timeline strip, simulating ending a misbehaving process. A "Restore All" button resets the table to its starting five processes.
Interaction: clicking anywhere on a table row (other than the End Process button) opens an infobox explaining process management in the context of that specific row, e.g., clicking "Runaway Script" (shown with an unusually high, still-climbing CPU % to make it visually stand out) explains why a task manager is useful for spotting exactly this kind of problem.
Implementation: p5.js. Store processes as an array of `{name, cpuPercent, memoryMB}` objects, updated on a timer via `millis()` with small randomized deltas to simulate realistic fluctuation. Render the table using `text()` at fixed row positions recalculated on resize. Render the timeline strip as short colored rectangles cycling through the active process list on a fixed interval to simulate scheduling.