GWRR should use fair-share scheduling based on each process's UNIX group identification. At each invocation of the scheduler, we will use a hierarchical scheme to choose which task to run: first, a group is chosen, then, a task within that group's set is chosen. If we allow each group's chosen task the same amount of time on the CPU, each group should be represented equally.
Since there are two choices in each scheduling decision, we need two algorithms: Use a Round-Robin scheme to decide which group to choose. We keep a queue of groups, and whichever group was chosen last time we scheduled, we choose the next group in the queue for this schedule. We then choose a task within this group's set of tasks (more on this later), and let it run for a fixed amount of time. Now every group gets an equal amount of CPU time at a relatively fine grain.
Now let's say that some groups are more equal than others. Imagine that we associate an integer, which we'll call a weight, with each group. We then modify the round-robin algorithm above so that we pick the same group for W time quanta (instead of a single time quantum), where W is the group's weight, before moving on to the next group in the queue. In this way, we can specify that some groups get more CPU time than others, and also how much more. A group with a weight of 3 will get 50% more CPU time than a group with weight 2. This is called proportional sharing. More specifically, this implementation of proportional sharing is called Weighted Round-Robin.
We still haven't specified how a task is to be chosen once we choose a group. For simplicity, use a simple round-robin (RR) scheduling algorithm to do that. The intra group RR scheduler should use the same default timeslice as the Linux scheduler uses for a task with the default nice value. Otherwise, the RR scheduler should work the same as GWRR except that it schedules tasks, not groups, and there are no different task weights.
2 freelancers are bidding on average $30 for this job
Hi, We have 5+ years of experience in C++ optimization algorithms and will be happy to get the opportunity to work on the requirement posted by you. We can deliver it within 5 days. Sourabh