An Example

This lesson introduces the unfairness metric with the help of an example and also briefly touches upon how to assign​ tickets.

We'll cover the following

Unfairness metric

To make the dynamics of lottery scheduling more understandable, we now perform a brief study of the completion time of two jobs competing against one another, each with the same number of tickets (100) and the ​same run time (RR, which we will vary).

In this scenario, we’d like for each job to finish at roughly the same time, but due to the randomness of lottery scheduling, sometimes one job finishes before the other. To quantify this difference, we define a simple unfairness metric, UU which is simply the time the first job completes divided by the time that the second job completes. For example, if R=10R = 10, and the first job finishes at time 10 (and the second job at 20), U=1020=0.5U = \frac {10}{20} =0.5. When both jobs finish at nearly the same time, UU will be 20 quite close to 1. In this scenario, that is our goal: a perfectly fair scheduler would achieve U=1U = 1.

The figure below plots the average unfairness as the length of the two jobs (RR) is varied from 1 to 1000 over thirty trials (results are generated via the simulator provided at the end of the chapter).

Get hands-on with 1200+ tech skills courses.