❯ python scheduler.py -h
Usage: scheduler.py [options]
Options:
-h, --help show this help message and exit
-s SEED, --seed=SEED the random seed
-j JOBS, --jobs=JOBS number of jobs in the system
-l JLIST, --jlist=JLIST
instead of random jobs, provide a comma-separated list
of run times
-m MAXLEN, --maxlen=MAXLEN
max length of job
-p POLICY, --policy=POLICY
sched policy to use: SJF, FIFO, RR
-q QUANTUM, --quantum=QUANTUM
length of time slice for RR policy
-c compute answers for me
❯ python scheduler.py -p RR -l 5,10,15 -c
ARG policy RR
ARG jlist 5,10,15
Here is the job list, with the run time of each job:
Job 0 ( length = 5.0 )
Job 1 ( length = 10.0 )
Job 2 ( length = 15.0 )
** Solutions **
Execution trace:
[ time 0 ] Run job 0 for 1.00 secs
[ time 1 ] Run job 1 for 1.00 secs
[ time 2 ] Run job 2 for 1.00 secs
[ time 3 ] Run job 0 for 1.00 secs
[ time 4 ] Run job 1 for 1.00 secs
[ time 5 ] Run job 2 for 1.00 secs
[ time 6 ] Run job 0 for 1.00 secs
[ time 7 ] Run job 1 for 1.00 secs
[ time 8 ] Run job 2 for 1.00 secs
[ time 9 ] Run job 0 for 1.00 secs
[ time 10 ] Run job 1 for 1.00 secs
[ time 11 ] Run job 2 for 1.00 secs
[ time 12 ] Run job 0 for 1.00 secs ( DONE at 13.00 )
[ time 13 ] Run job 1 for 1.00 secs
[ time 14 ] Run job 2 for 1.00 secs
[ time 15 ] Run job 1 for 1.00 secs
[ time 16 ] Run job 2 for 1.00 secs
[ time 17 ] Run job 1 for 1.00 secs
[ time 18 ] Run job 2 for 1.00 secs
[ time 19 ] Run job 1 for 1.00 secs
[ time 20 ] Run job 2 for 1.00 secs
[ time 21 ] Run job 1 for 1.00 secs
[ time 22 ] Run job 2 for 1.00 secs
[ time 23 ] Run job 1 for 1.00 secs ( DONE at 24.00 )
[ time 24 ] Run job 2 for 1.00 secs
[ time 25 ] Run job 2 for 1.00 secs
[ time 26 ] Run job 2 for 1.00 secs
[ time 27 ] Run job 2 for 1.00 secs
[ time 28 ] Run job 2 for 1.00 secs
[ time 29 ] Run job 2 for 1.00 secs ( DONE at 30.00 )
Final statistics:
Job 0 -- Response: 0.00 Turnaround 13.00 Wait 8.00
Job 1 -- Response: 1.00 Turnaround 24.00 Wait 14.00
Job 2 -- Response: 2.00 Turnaround 30.00 Wait 15.00
Average -- Response: 1.00 Turnaround 22.33 Wait 12.33