File #1 (fcfs_1.txt
)
@p1;24;0;0;0&
@p2;3;0;0;0&
@p3;3;0;0;0&
$ python schedule.py --fcfs fcfs_1.txt
Process(name='p1', burst=24, arrival_time=0, priority=0, time_slice=0, waiting_time=0, turnaround_time=24)
Process(name='p2', burst=3, arrival_time=0, priority=0, time_slice=0, waiting_time=24, turnaround_time=27)
Process(name='p3', burst=3, arrival_time=0, priority=0, time_slice=0, waiting_time=27, turnaround_time=30)
Average waiting time: 17.0
Average turnaround time: 27.0
File #2 (fcfs_2.txt
)
@p1;3;0;0;0&
@p2;3;0;0;0&
@p3;24;0;0;0&
$ python schedule.py --fcfs fcfs_2.txt
Process(name='p1', burst=3, arrival_time=0, priority=0, time_slice=0, waiting_time=0, turnaround_time=3)
Process(name='p2', burst=3, arrival_time=0, priority=0, time_slice=0, waiting_time=3, turnaround_time=6)
Process(name='p3', burst=24, arrival_time=0, priority=0, time_slice=0, waiting_time=6, turnaround_time=30)
Average waiting time: 3.0
Average turnaround time: 13.0
File #3 (sjf_1.txt
)
@p1;24;0;0;0&
@p2;3;0;0;0&
@p3;3;0;0;0&
$ python schedule.py --sjf sjf_1.txt
Process(name='p2', burst=3, arrival_time=0, priority=0, time_slice=0, waiting_time=0, turnaround_time=3)
Process(name='p3', burst=3, arrival_time=0, priority=0, time_slice=0, waiting_time=3, turnaround_time=6)
Process(name='p1', burst=24, arrival_time=0, priority=0, time_slice=0, waiting_time=6, turnaround_time=30)
Average waiting time: 3.0
Average turnaround time: 13.0
File #4 (sjf_2.txt
)
@p1;6;0;0;0&
@p2;8;0;0;0&
@p3;7;0;0;0&
@p4;3;0;0;0&
$ python schedule.py --sjf sjf_2.txt
Process(name='p4', burst=3, arrival_time=0, priority=0, time_slice=0, waiting_time=0, turnaround_time=3)
Process(name='p1', burst=6, arrival_time=0, priority=0, time_slice=0, waiting_time=3, turnaround_time=9)
Process(name='p3', burst=7, arrival_time=0, priority=0, time_slice=0, waiting_time=9, turnaround_time=16)
Process(name='p2', burst=8, arrival_time=0, priority=0, time_slice=0, waiting_time=16, turnaround_time=24)
Average waiting time: 7.0
Average turnaround time: 13.0
File #5 (sjf_3.txt
)
@p1;8;0;0;0&
@p2;4;1;0;0&
@p3;9;2;0;0&
@p4;5;3;0;0&
$ python schedule.py --sjf sjf_3.txt
Process(name='p1', burst=8, arrival_time=0, priority=0, time_slice=0, waiting_time=0, turnaround_time=8)
Process(name='p2', burst=4, arrival_time=1, priority=0, time_slice=0, waiting_time=7, turnaround_time=11)
Process(name='p4', burst=5, arrival_time=3, priority=0, time_slice=0, waiting_time=9, turnaround_time=14)
Process(name='p3', burst=9, arrival_time=2, priority=0, time_slice=0, waiting_time=15, turnaround_time=24)
Average waiting time: 7.75
Average turnaround time: 14.25
File #6 (srtf_1.txt
)
@p1;8;0;0;0&
@p2;4;1;0;0&
@p3;9;2;0;0&
@p4;5;3;0;0&
$ python schedule.py --srtf srtf_1.txt
Process(name='p2', burst=4, arrival_time=1, priority=0, time_slice=0, waiting_time=0, turnaround_time=4)
Process(name='p4', burst=5, arrival_time=3, priority=0, time_slice=0, waiting_time=2, turnaround_time=7)
Process(name='p1', burst=8, arrival_time=0, priority=0, time_slice=0, waiting_time=9, turnaround_time=17)
Process(name='p3', burst=9, arrival_time=2, priority=0, time_slice=0, waiting_time=15, turnaround_time=24)
Average waiting time: 6.5
Average turnaround time: 13.0
File #7 (srtf_2.txt
)
@p1;5;0;0;0&
@p2;15;3;0;0&
@p3;11;5;0;0&
@p4;5;7;0;0&
$ python schedule.py --srtf srtf_2.txt
Process(name='p1', burst=5, arrival_time=0, priority=0, time_slice=0, waiting_time=0, turnaround_time=5)
Process(name='p4', burst=5, arrival_time=7, priority=0, time_slice=0, waiting_time=0, turnaround_time=5)
Process(name='p3', burst=11, arrival_time=5, priority=0, time_slice=0, waiting_time=5, turnaround_time=16)
Process(name='p2', burst=15, arrival_time=3, priority=0, time_slice=0, waiting_time=18, turnaround_time=33)
Average waiting time: 5.75
Average turnaround time: 14.75
File #8 (rr_1.txt
)
@p1;53;0;0;20&
@p2;17;0;0;20&
@p3;68;0;0;20&
@p4;24;0;0;20&
$ python schedule.py --rr rr_1.txt
Process(name='p1', burst=53, arrival_time=0, priority=0, time_slice=20, waiting_time=81, turnaround_time=134)
Process(name='p2', burst=17, arrival_time=0, priority=0, time_slice=20, waiting_time=20, turnaround_time=37)
Process(name='p3', burst=68, arrival_time=0, priority=0, time_slice=20, waiting_time=94, turnaround_time=162)
Process(name='p4', burst=24, arrival_time=0, priority=0, time_slice=20, waiting_time=97, turnaround_time=121)
Average waiting time: 73.0
Average turnaround time: 113.5
File #9 (rr_2.txt
)
@p1;10;0;0;10&
@p2;10;0;0;10&
@p3;10;0;0;10&
@p4;10;0;0;10&
@p5;10;0;0;10&
@p6;10;0;0;10&
@p7;10;0;0;10&
@p8;10;0;0;10&
@p9;10;0;0;10&
@p10;10;0;0;10&
$ python schedule.py --rr rr_2.txt
Process(name='p1', burst=10, arrival_time=0, priority=0, time_slice=10, waiting_time=0, turnaround_time=10)
Process(name='p2', burst=10, arrival_time=0, priority=0, time_slice=10, waiting_time=10, turnaround_time=20)
Process(name='p3', burst=10, arrival_time=0, priority=0, time_slice=10, waiting_time=20, turnaround_time=30)
Process(name='p4', burst=10, arrival_time=0, priority=0, time_slice=10, waiting_time=30, turnaround_time=40)
Process(name='p5', burst=10, arrival_time=0, priority=0, time_slice=10, waiting_time=40, turnaround_time=50)
Process(name='p6', burst=10, arrival_time=0, priority=0, time_slice=10, waiting_time=50, turnaround_time=60)
Process(name='p7', burst=10, arrival_time=0, priority=0, time_slice=10, waiting_time=60, turnaround_time=70)
Process(name='p8', burst=10, arrival_time=0, priority=0, time_slice=10, waiting_time=70, turnaround_time=80)
Process(name='p9', burst=10, arrival_time=0, priority=0, time_slice=10, waiting_time=80, turnaround_time=90)
Process(name='p10', burst=10, arrival_time=0, priority=0, time_slice=10, waiting_time=90, turnaround_time=100)
Average waiting time: 45.0
Average turnaround time: 55.0
File #10 (rr_3.txt
)
@p1;10;0;0;1&
@p2;10;0;0;1&
@p3;10;0;0;1&
@p4;10;0;0;1&
@p5;10;0;0;1&
@p6;10;0;0;1&
@p7;10;0;0;1&
@p8;10;0;0;1&
@p9;10;0;0;1&
@p10;10;0;0;1&
$ python schedule.py --rr rr_3.txt
Process(name='p1', burst=10, arrival_time=0, priority=0, time_slice=1, waiting_time=81, turnaround_time=91)
Process(name='p2', burst=10, arrival_time=0, priority=0, time_slice=1, waiting_time=82, turnaround_time=92)
Process(name='p3', burst=10, arrival_time=0, priority=0, time_slice=1, waiting_time=83, turnaround_time=93)
Process(name='p4', burst=10, arrival_time=0, priority=0, time_slice=1, waiting_time=84, turnaround_time=94)
Process(name='p5', burst=10, arrival_time=0, priority=0, time_slice=1, waiting_time=85, turnaround_time=95)
Process(name='p6', burst=10, arrival_time=0, priority=0, time_slice=1, waiting_time=86, turnaround_time=96)
Process(name='p7', burst=10, arrival_time=0, priority=0, time_slice=1, waiting_time=87, turnaround_time=97)
Process(name='p8', burst=10, arrival_time=0, priority=0, time_slice=1, waiting_time=88, turnaround_time=98)
Process(name='p9', burst=10, arrival_time=0, priority=0, time_slice=1, waiting_time=89, turnaround_time=99)
Process(name='p10', burst=10, arrival_time=0, priority=0, time_slice=1, waiting_time=90, turnaround_time=100)
Average waiting time: 85.5
Average turnaround time: 95.5
@IdanBanani I've added a bunch of examples. Thanks for the comment.