SJF and SRTF scheduling programs with Gantt charts and captured output

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b5v46dt7TVsHZxtoYC
This commit is contained in:
asmhatre
2026-11-12 20:45:02 +05:30
co-authored by Claude Sonnet 5.5
commit abaf3840f2
18 changed files with 393 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
Non-preemptive SJF
PID AT BT CT TAT WT
P1 0 5 12 12 7
P2 0 3 3 3 0
P3 0 8 20 20 12
P4 0 4 7 7 3
Average waiting time : 5.50
Average turnaround time : 10.50
Gantt chart:
| P2 | P4 | P1 | P3 |
0 3 7 12 20
+15
View File
@@ -0,0 +1,15 @@
Non-preemptive SJF
PID AT BT CT TAT WT
P1 0 7 7 7 0
P2 2 4 15 13 9
P3 4 1 8 4 3
P4 5 4 19 14 10
P5 6 3 11 5 2
Average waiting time : 4.80
Average turnaround time : 8.60
Gantt chart:
| P1 | P3 | P5 | P2 | P4 |
0 7 8 11 15 19
+15
View File
@@ -0,0 +1,15 @@
Preemptive SJF (SRTF)
PID AT BT CT TAT WT
P1 0 7 19 19 12
P2 2 4 7 5 1
P3 4 1 5 1 0
P4 5 4 14 9 5
P5 6 3 10 4 1
Average waiting time : 3.80
Average turnaround time : 7.60
Gantt chart:
| P1 | P2 | P3 | P2 | P5 | P4 | P1 |
0 2 4 5 7 10 14 19
+13
View File
@@ -0,0 +1,13 @@
Non-preemptive SJF
PID AT BT CT TAT WT
P1 0 8 8 8 0
P2 1 4 14 13 9
P3 2 2 10 8 6
Average waiting time : 5.00
Average turnaround time : 9.67
Gantt chart:
| P1 | P3 | P2 |
0 8 10 14
+13
View File
@@ -0,0 +1,13 @@
Preemptive SJF (SRTF)
PID AT BT CT TAT WT
P1 0 8 14 14 6
P2 1 4 7 6 2
P3 2 2 4 2 0
Average waiting time : 2.67
Average turnaround time : 7.33
Gantt chart:
| P1 | P2 | P3 | P2 | P1 |
0 1 2 4 7 14
+13
View File
@@ -0,0 +1,13 @@
Non-preemptive SJF
PID AT BT CT TAT WT
P1 0 2 2 2 0
P2 6 3 9 3 0
P3 7 1 10 3 2
Average waiting time : 0.67
Average turnaround time : 2.67
Gantt chart:
| P1 | idle | P2 | P3 |
0 2 6 9 10
+9
View File
@@ -0,0 +1,9 @@
Result (sorted by burst time — shortest first)
PNO AT WT BT TT
P3 4 0 1 1
P2 2 3 4 7
P4 5 4 4 8
P1 0 13 7 20
Total Burst Time: 16
Average Waiting Time : 5
Average Turnaround Time : 9
@@ -0,0 +1,14 @@
Non-preemptive SJF
PID AT BT CT TAT WT
P1 0 7 7 7 0
P2 2 4 12 10 6
P3 4 1 8 4 3
P4 5 4 16 11 7
Average waiting time : 4.00
Average turnaround time : 8.00
Gantt chart:
| P1 | P3 | P2 | P4 |
0 7 8 12 16