Why do the CFS chase fairness?

Parmenides mobile.parmenides at gmail.com
Mon Sep 19 10:22:18 EDT 2011


2011/9/18 Mulyadi Santosa <mulyadi.santosa at gmail.com>:
> Hi...
>
> This would take us back to the days of comp science bachelor seat :)
>
>>
>>   1. How to understand unfairness?
>
> IMHO, the easiest meaning is that:
> one task gets proportionally more time slice than the other.

   Well, even with the CFS scheduler, tasks still can have different
processor shares according to their priorities. Conceptually, for
examp, suppose that there are three tasks with priorities 1, 2, 3,
respectively. For some fixed schedule period (targeted latency), which
determined by the number of tasks in run queue, the three tasks obtain
their CPU shares: 1/6, 2/6, 3/6 of the schedule period. Of course, in
reality, CPU share of each tasks also needs its weight (determined by
task's priority) be taken into account.

   However, it is said that we can consider this manner of allocating
CPU time is still fair because the scheduler approaches (at least
approximately) user's intension, that is: tasks with different
priorities get relevant CPU shares in terms of the their priorities.
If so,  IMHO it is also not hard for traditional schedulers to achieve
fairness. For the above three tasks, the scheduler may allocate 5ms,
10ms, 15ms timeslice for each. That way, each task would receive the
intended CPU shares as the CFS scheduler does.

   So, I can not see the differences between traditional schedulers,
which are based on timeslice, and the CFS scheduler, which divide some
schedule period into shares in proportion to tasks' priorities. It
seems that both take the same effect.

   I think the clear idea of what fairness is may help us understand unfairness.

>
>>   2. Why do processes need fairness?
>>
> To achieve highest response time IMHO.

   How does fairness give tasks more higher response time?



More information about the Kernelnewbies mailing list