This repository contains enhancements made to the xv6 operating system, including new system calls, scheduling policies, and features such as copy-on-write fork.
- Added the system call
getreadcount
to xv6. - Returns the value of a counter which is incremented every time any process calls the
read()
system call.
int getreadcount(void);
- Implemented a feature to periodically alert a process as it uses CPU time.
- Added a new system call
sigalarm(interval, handler)
:- Calls the application function
handler
after everyinterval
ticks of CPU time.
- Calls the application function
- Added system call
sigreturn()
to reset the process state after the handler is called.
- Implemented a policy that selects the process with the lowest creation time.
- Process runs until it no longer needs CPU time.
- Implemented a preemptive MLFQ scheduler with four priority queues.
- Time slices:
- Priority 0: 1 timer tick
- Priority 1: 3 timer ticks
- Priority 2: 9 timer ticks
- Priority 3: 15 timer ticks
- Processes move between queues based on behavior and CPU bursts.
- Aging implemented to prevent starvation.
- Round-robin scheduler used for processes at the lowest priority queue.
- Implemented a preemptive priority-based scheduler.
- Dynamic Priority (DP) based on Static Priority (SP) and Recent Behavior Index (RBI).
- RBI measures recent behavior (Running Time, Sleeping Time, Waiting Time).
set_priority()
system call to change Static Priority and reset RBI.- User program
setpriority
to change priority via syscall.
- Implemented copy-on-write (COW) fork in xv6.
- Parent and child initially share all physical pages, mapped read-only.
- On write, kernel makes a copy of the page, updating page tables.
- Child and parent have separate copies for modified pages.