Answer to Question #259398 in C for Anuj Yadav

Question #259398

Let us say that you have a program that uses SCHED_FIFO scheduling. How


would the vruntime variable for such a program be computed or updated ?





How is this different from how vruntime would be updated for SCHED_RR and


SCHED_NORMAL ?


1
Expert's answer
2021-11-01T19:38:40-0400

Tasks run to completion in SCHED FIFO, while tasks in SCHED RR (Round Robin) run until they exhaust a predetermined timeslice and are then preempted. FCFS stands for First In First Out (FIFO) (First Come First Serve). FIFO or FCFS is based on the principle that whichever job arrives first in the run queue must be handled or executed first, with the other processes in the run queue getting a chance only after it has finished. SCHED NORMAL is the scheduling class for normal processes, sometimes known as CFS or Completely fair scheduling (CFS). Each processor in CFS has its own run queue (a data structure that specifies a timetable for scheduled tasks), which is a red-black tree. Internal nodes in the tree represent tasks or task groups, and these nodes are indexed by virtual runtime values, with internal nodes on the left having lower virtual runtime values than those on the right:

In other words, tasks with the shortest runtime (i.e., those that require the most processing power) are found in the left subtree, while those with longer runtimes are found in the right subtree. A preemption work would also be moved to the right subtree, allowing other tasks to move left in the tree. The job with the shortest virtual runtime must be at the tree's leftmost node, which is the run queue's front.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS