Operating System Overview2
Operating System Overview2
Gantt Chart:
| P2 | P5 | P1 | P3 | P4 |
0 1 2 12 14 15
Execution Sequence:
Gantt Chart:
| P1 | P2 | P3 | P4 | P1 | P5 | P1 | P5 | P1 | P5 | P1 |
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Execution Sequence:
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 21/90
Completion Times:
P1: 17
P2: 2
P3: 19
P4: 20
P5: 7
P4 18 20 - 2 = 18
P5 4 7-3=4
Completion Times:
P1: 14
P2: 2
P3: 4
P4: 4
P5: 15
P2 1 2-1=1
P3 2 4-2=2
P4 2 4-2=2
P5 12 15 - 3 = 12
P2 0 1-1=0
P3 15 17 - 2 = 15
P4 17 18 - 1 = 17
P5 2 4-5=2
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 22/90
Round Robin Scheduling
Summary
To analyze the given set of processes with their CPU burst times, we will create Gantt charts for both
First-Come-First-Serve (FCFS) and Round Robin (RR) scheduling with a time quantum of 5 milliseconds.
We will also calculate the average waiting time for each scheduling method.
Given Data
P4 10
| P1 | P2 | P3 | P4 |
0 15 20 27 37
Completion Times:
P1: 15 ms
P2: 20 ms
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 23/90
P3: 27 ms
P4: 37 ms
P2 20 5 20 - 5 = 15
P3 27 7 27 - 7 = 20
P4 37 10 37 - 10 = 27
Execution Order: Each process runs for 5 ms until completion. If a process does not finish within the
time quantum, it goes back to the queue.
Gantt Chart:
| P1 | P2 | P3 | P4 | P1 | P3 | P4 |
0 5 10 15 20 25 30 37
Execution Breakdown:
Completion Times:
P1: 30 ms
P2: 10 ms
P3: 27 ms
P4: 37 ms
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 24/90
Average Waiting Time (RR) = (15 + 5 + 20 + 27) / 4 = 16.75 ms
Summary
FCFS Scheduling:
Average Waiting Time: 15.5 ms
Round Robin Scheduling (Quantum = 5 ms):
Average Waiting Time: 16.75 ms
To calculate the average turnaround time and average waiting time for the given processes using Round
Robin (RR) scheduling with a time quantum of 2 milliseconds and Shortest Remaining Time First (SRTF)
scheduling, we will follow these steps:
Given Data
Gantt Chart
1. Execution Sequence:
Time 0: P1 runs for 2 ms (remaining 1 ms).
Time 2: P2 runs for 2 ms (remaining 4 ms).
Time 4: P1 runs for 1 ms (completes).
Time 5: P3 runs for 2 ms (remaining 2 ms).
Time 7: P4 runs for 2 ms (completes).
Time 9: P2 runs for 2 ms (remaining 2 ms).
Time 11: P3 runs for 2 ms (completes).
Time 13: P2 runs for 2 ms (completes).
Gantt Chart:
| P1 | P2 | P1 | P3 | P4 | P2 | P3 | P2 |
0 2 4 5 7 9 11 13 15
Completion Times
P1: 4 ms
P2: 15 ms
P3: 13 ms
P4: 9 ms
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 25/90
Turnaround Time (TAT)
P4 9 6 9-6=3
P1 4 3 4-3=1
P2 14 6 14 - 6 = 8
P3 9 4 9-4=5
P4 3 2 3-2=1
Gantt Chart
1. Execution Sequence:
Time 0: P1 runs (remaining 3 ms).
Time 1: P2 arrives (remaining 6 ms).
Time 4: P3 arrives (remaining 4 ms).
Time 6: P4 arrives (remaining 2 ms).
Time 6: P4 runs (completes) as it has the shortest remaining time.
Time 8: P1 runs (remaining 1 ms).
Time 9: P2 runs (remaining 4 ms).
Time 11: P3 runs (remaining 2 ms).
Time 13: P2 runs (completes).
Gantt Chart:
| P1 | P4 | P1 | P2 | P3 | P2 |
0 1 4 6 8 11 13 15
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 26/90
Completion Times
P1: 8 ms
P2: 15 ms
P3: 13 ms
P4: 6 ms
P2 14 6 14 - 6 = 8
P3 9 4 9-4=5
P4 0 2 0 - 2 = -2 (not possible, but it finished immediately)
Final Results:
To analyze the given set of processes with their CPU burst times, we will create Gantt charts for both
First-Come-First-Serve (FCFS) and Round Robin (RR) scheduling with a time quantum of 5 milliseconds.
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 27/90
We will also calculate the average waiting time for each scheduling method.
Given Data
P3 7
P4 10
Gantt Chart
Gantt Chart:
| P1 | P2 | P3 | P4 |
0 15 20 27 37
Completion Times:
P1: 15 ms
P2: 20 ms
P3: 27 ms
P4: 37 ms
Gantt Chart
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 28/90
Execution Order: Each process runs for 5 ms until completion. If a process does not finish within the
time quantum, it goes back to the queue.
Execution Breakdown:
Gantt Chart:
| P1 | P2 | P3 | P4 | P1 | P3 | P4 |
0 5 10 15 20 25 27 32
Completion Times
P1: 32 ms
P2: 10 ms
P3: 27 ms
P4: 30 ms
Completion Times:
P1: 32 ms
P2: 10 ms
P3: 27 ms
P4: 30 ms
P4 30 10 30 - 10 = 20
Final Results:
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 29/90
FCFS Scheduling:
Average Waiting Time: 15.5 ms
Round Robin Scheduling (Quantum = 5 ms):
Average Waiting Time: 15.5 ms
Both FCFS and Round Robin (with a quantum of 5 ms) yield the same average waiting time in this
scenario.
To analyze the given processes using different scheduling algorithms (FCFS, SJF, SRTF, and Round Robin),
we'll create Gantt charts for each and calculate the average turnaround time (TAT) and average waiting
time (WT) for all the processes.
Given Data
1. First-Come-First-Serve (FCFS)
Gantt Chart
css
| A | B | C | D |
0 8 12 21 26
Completion Times
A: 8
B: 12
C: 21
D: 26
Process Completion Time Arrival Time Burst Time Turnaround Time Waiting Time
A 8 0 8 8-0=8 8-8=0
Printed using Save ChatGPT as PDF, powered by PDFCrowd HTML to PDF API. 30/90