Implementation of signal handling and custom scheduling in xv6. Features include signal delivery (SIGINT, SIGBG, SIGFG, SIGCUSTOM), a new process creation model with custom_fork and scheduler_start, a scheduler profiler for turnaround/waiting/response times, and a dynamic priority boosting scheduler with tunable α, β parameters.
This project extends the xv6 operating system to enhance process management through:
- Signal handling for keyboard interrupts (Ctrl+C/B/F/G).
- A custom scheduler with new system calls.
- A scheduler profiler to measure performance metrics.
- A priority boosting scheduler with tunable parameters.
It demonstrates low-level systems programming, OS kernel modification, and performance optimization.
Ctrl+C → SIGINT: Kills user processes (pid > 2).Ctrl+B → SIGBG: Suspends user processes.Ctrl+F → SIGFG: Resumes suspended processes.Ctrl+G → SIGCUSTOM: Invokes registered user-space signal handler if available.
custom_fork(start_later, exec_time)- Creates a process with deferred execution and limited run-time.
scheduler_start()- Starts execution of all processes created with
start_later = true.
- Starts execution of all processes created with
- Reports per-process:
- Turnaround Time (TAT)
- Waiting Time (WT)
- Response Time (RT)
- Context Switches (#CS)
- Dynamic priority model:
πi(t) = πi(0) − α·Ci(t) + β·Wi(t)
yaml Copy Edit
- Avoids starvation by boosting waiting processes.
- Tunable parameters α, β set in Makefile.
- Modified kernel files:
proc.c,proc.h,syscall.c,trap.c, etc. - Added system calls for signals and custom scheduling.
- Updated keyboard interrupt handler to generate signals.
- Integrated profiling counters into process structures.
- Implemented dynamic priority evaluation in the scheduler loop.
- CPU-bound Fibonacci test for signal handling.
- Parent-child processes for background/foreground control.
- Scheduler profiler validation using controlled workloads.
- Priority boosting effects compared for CPU-bound vs I/O-bound tasks.
- Clone xv6 repository with this project code.
- Build and run inside QEMU:
make clean
make qemu
Run test programs (test1, test2, test_sched) to validate functionality.
Observe kernel logs for profiler and priority outputs.
📊 Results
Verified correct signal handling (Ctrl+C/B/F/G).
Scheduler profiler reports consistent metrics for TAT, WT, RT, #CS.
Priority boosting prevents starvation in I/O-heavy workloads.