Question: What to do for this Project ( Implementation of Fair Scheduler ) : Change ready queue from unsorted list to list sorted by vruntime and
What to do for this Project
Implementation of Fair Scheduler
:
Change ready queue from unsorted list to list sorted by vruntime and tid
Each tick calculate the ideal runtime and compare time running
If time running is longer yield and add to ready queue
unless ready to terminate
Thread block
Remove from ready queue
Thread Unblock
Add to ready queue
Cause current thread to yield if CPU was idle or if get sleeping boost
What to do
variables
Variables to think about :
Vruntime
for each thread
Weight table
for scheduler to use
Min
vruntime
for each ready queue
vruntime
for each thread
CPU time consumed
for each thread
Thread
s time slice
ideal runtime
for each thread
Number of threads running or ready for each ready queue
Weight of thread
for each thread
Sum of weights
for each ready queue
What to do
Initialization
Some variables need to be initialized when each CPU first thread is initialized and ready queue is set
up
Some variables need to be initialized when threads are created
Each Tick
Thread
tick calls sched
tick
Determine if thread needs to yield
Calculate and compare ideal runtime to the amount of time that thread has been running
Then thread
yield calls sched
yield
Update how long thread has been running
Add to ready
queue in order by runtime and tid
Update number of threads in ready queue
Update sum of weights
Then thread
tick calls schedule
Calls next thread to run which calls sched
pick
next
Remove from ready queue just like before but also
Update any variables about when it was last run or runtime was calculated etc if you are using them
Update number of threads in ready queue
Update sum of weights
Calls switch thread
Calls thread
schedule
tail
Thread Block
Unblock
Block
Remove from ready queue
Update variables
Unblock
Add to ready queue
Update variables
Trigger schedule if CPU was NULL or if thread got a sleeping boost
Theory :
CFS
Niceness :
Niceness
in thread struct
indication of priority
Higher niceness
lower priority
Function: int thread
get
nice
void
Returns the current thread's nice value.
Function: void thread
set
nice
int new
nice
Sets the current thread's nice value to new
nice.
CFS Weights :
static const uint
t prio
to
weight
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
