A lightweight multi-container runtime implemented in C on Linux, integrating user-space process management with kernel-space monitoring.
This project demonstrates core operating system concepts including process isolation, inter-process communication, logging, kernel interaction, scheduling behavior, and resource cleanup.
A supervisor process manages multiple containers concurrently, ensuring isolation using namespaces and chroot, while communicating through FIFO-based IPC. A kernel module is used to monitor container processes via IOCTL.
The runtime is also used as an experimental platform to study Linux scheduling behavior under different workloads and configurations.
- Container isolation using UTS and mount namespaces with chroot
- FIFO-based IPC (
cmd_pipe) for command handling - Pipe-based logging system for container output
- Kernel module integration via character device and IOCTL
- Scheduler experiments with CPU-bound and I/O-bound workloads
- Proper resource cleanup with no zombie processes
- Long-running supervisor process
- Container lifecycle management (start, stop, ps)
- IPC using FIFO
- Logging via pipes
- IOCTL communication with kernel module
- Character device:
/dev/container_monitor - Handles IOCTL calls from user space
- Registers container PIDs
- Logs monitoring information
- Execution of CPU-bound processes with different priorities (nice values)
- Execution of CPU-bound and I/O-bound processes simultaneously
- Observation of CPU utilization and responsiveness
makesudo insmod monitor.ko
sudo mknod /dev/container_monitor c 239 0
sudo chmod 666 /dev/container_monitormkfifo cmd_pipe
gcc engine.c -o enginesudo ./engineecho "start alpha" > cmd_pipe
echo "start beta" > cmd_pipe
echo "ps" > cmd_pipecat alpha.logecho "stop alpha" > cmd_pipesudo rmmod monitorThe system ensures proper cleanup of all resources:
- Child processes are reaped using
waitpid() - No zombie processes remain after execution
- Logging processes terminate correctly
- File descriptors are closed properly
- Kernel module releases resources on unload
- Containers run in isolated environments
- Logging continuously captures container output
- Kernel module successfully registers and tracks processes
- System performs clean shutdown without residual resources
- engine.c
- monitor.c
- monitor_ioctl.h
- Makefile
- cpu_test.c
- mem_test.c
- rootfs-alpha/
- rootfs-beta/
- README.md
This project demonstrates a functional container runtime combining user-space container management with kernel-space monitoring. It highlights key OS concepts while ensuring reliable execution and complete resource cleanup.