- Compute the solutions for simulations with 3 jobs and random seeds of 1, 2, and 3.
$ ./lottery.py -j 3 -s 1
ARG jlist
ARG jobs 3
ARG maxlen 10
ARG maxticket 100
ARG quantum 1
ARG seed 1
Here is the job list, with the run time of each job:
Job 0 ( length = 1, tickets = 84 )
Job 1 ( length = 7, tickets = 25 )
Job 2 ( length = 4, tickets = 44 )
Here is the set of random numbers you will need (at most):
Random 651593
tickets = 84 + 25 + 44 = 153 651593 % 153 = 119 -> run 2
$ ./lottery.py -j 3 -s 1 -c
ARG jlist
ARG jobs 3
ARG maxlen 10
ARG maxticket 100
ARG quantum 1
ARG seed 1
Here is the job list, with the run time of each job:
Job 0 ( length = 1, tickets = 84 )
Job 1 ( length = 7, tickets = 25 )
Job 2 ( length = 4, tickets = 44 )
** Solutions **
Random 651593 -> Winning ticket 119 (of 153) -> Run 2
Jobs:
( job:0 timeleft:1 tix:84 ) ( job:1 timeleft:7 tix:25 ) (* job:2 timeleft:4 tix:44 )
- Now run with two specific jobs: each of length 10, but one (job 0) with just 1 ticket and the other (job 1) with 100 (e.g.,
-l 10:1,10:100
). What happens when the number of tickets is so imbalanced? Will job 0 ever run before job 1 completes? How often? In general, what does such a ticket imbalance do to the behavior of lottery scheduling?
$ ./lottery.py -l 10:1,10:100 -c
ARG jlist 10:1,10:100
ARG jobs 3
ARG maxlen 10
ARG maxticket 100
ARG quantum 1
ARG seed 0
Here is the job list, with the run time of each job:
Job 0 ( length = 10, tickets = 1 )
Job 1 ( length = 10, tickets = 100 )
** Solutions **
Random 844422 -> Winning ticket 62 (of 101) -> Run 1
Jobs:
( job:0 timeleft:10 tix:1 ) (* job:1 timeleft:10 tix:100 )
What happens when the number of tickets is so imbalanced?
Job 1 will have more opportunities to run.
Will job 0 ever run before job 1 completes? How often?
1/100
In general, what does such a ticket imbalance do to the behavior of lottery scheduling?
- Probability of selection: process with more tickets will have a higher probability of being selected
- Fairness: uneven distribution of resources and reduces fairness
- Performance implications: reduce throughput and increase response time for processes with lower tickets.