System Architecture
The project is divided into three primary components:
The Actors (C Programs): Low-level simulations of specific OS behaviors, including CPU-bound tasks, sleeping processes, zombies, orphans, and multithreaded execution.
The Manager (Bash Script): A command-line interface that allows users to interact with the kernel using tools like ps, kill, and renice to monitor and control the "Actors".
The Observer (Java GUI): A JavaFX application that provides real-time visual tracking of process attributes and CPU usage trends.
Process Simulations ("The Actors")
The report details several C programs designed to showcase specific kernel behaviors:
CPU Hog (cpu_hog.c): An infinite loop process that demands 100% of a CPU core, used to demonstrate CPU Scheduling and the effects of renice.
Slow Process (slow_process.c): Demonstrates Signal Handling by listening for SIGTERM to perform a graceful shutdown.
Zombie Process (zombie_process.c): Illustrates the Process Lifecycle by creating a child process that exits while the parent remains active without reaping it.
Orphan Process (orphan_process.c): Shows Init Adoption, where a child process is adopted by PID 1 after its parent terminates.
Threaded Process (threaded_process.c): Highlights the difference between processes and threads by creating multiple execution streams within a single PID using the pthread library.
Management and Observation
Bash Manager: Implements asynchronous execution using the ampersand (&), inter-process communication via pipes, and priority management through nice values.
Java Observer: Uses ProcessBuilder to execute system calls, parses ps output into Java objects (simulating a Process Control Block), and uses background threads to update the UI without freezing it.
Key Learning Outcomes
The project bridges the gap between theoretical textbook concepts and real-world system behavior by focusing on the Linux Scheduler (CFS), process states, and system administration utilities.