0% found this document useful (0 votes)
4 views

CPU Scheduling Algorithms

Operating system 2 module
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

CPU Scheduling Algorithms

Operating system 2 module
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CPU Scheduling Algorithms Analysis

Given Data:

Processes: P1, P2, P3, P4

Burst Time (BT): 10, 8, 2, 4 ms

Priorities: 3, 4, 1, 2 (Lower number indicates higher priority)

Time Quantum (Round Robin): 2 ms

1. First-Come, First-Served (FCFS):

Order of Execution: P1 -> P2 -> P3 -> P4

| Process | Burst Time (BT) | Completion Time (CT) | Turnaround Time (TAT) | Waiting Time (WT) |

|---------|------------------|----------------------|-----------------------|-------------------|

| P1 | 10 | 10 | 10 |0 |

| P2 |8 | 18 | 18 | 10 |

| P3 |2 | 20 | 20 | 18 |

| P4 |4 | 24 | 24 | 20 |

Average Waiting Time (AWT): 12

Average Turnaround Time (ATAT): 18

2. Shortest Job First (SJF, Non-Preemptive):

Order of Execution: P3 -> P4 -> P2 -> P1


| Process | Burst Time (BT) | Completion Time (CT) | Turnaround Time (TAT) | Waiting Time

(WT) |

|---------|------------------|----------------------|-----------------------|-------------------|

| P3 |2 |2 |2 |0 |

| P4 |4 |6 |6 |2 |

| P2 |8 | 14 | 14 |6 |

| P1 | 10 | 24 | 24 | 14 |

Average Waiting Time (AWT): 5.5

Average Turnaround Time (ATAT): 11.5

3. Priority Scheduling (Non-Preemptive):

Order of Execution: P3 -> P4 -> P1 -> P2

| Process | Priority | Burst Time (BT) | Completion Time (CT) | Turnaround Time (TAT) |

Waiting Time (WT) |

|---------|----------|------------------|----------------------|-----------------------|-------------------|

| P3 |1 |2 |2 |2 |0 |

| P4 |2 |4 |6 |6 |2 |

| P1 |3 | 10 | 16 | 16 |6 |

| P2 |4 |8 | 24 | 24 | 16 |

Average Waiting Time (AWT): 6

Average Turnaround Time (ATAT): 12


4. Round Robin (Time Quantum = 2ms):

Order of Execution: P1 (2) -> P2 (2) -> P3 (2) -> P4 (2) -> P1 (2) -> P2 (2) -> P4 (2) -> P1 (2) -> P2

(2) -> P1 (2)

| Process | Burst Time (BT) | Completion Time (CT) | Turnaround Time (TAT) | Waiting Time

(WT) |

|---------|------------------|----------------------|-----------------------|-------------------|

| P1 | 10 | 22 | 22 | 12 |

| P2 |8 | 20 | 20 | 12 |

| P3 |2 |6 |6 |4 |

| P4 |4 |8 |8 |4 |

Average Waiting Time (AWT): 8

Average Turnaround Time (ATAT): 14

Summary of Results:

| Algorithm | Average Waiting Time (AWT) | Average Turnaround Time (ATAT) |

|------------------|----------------------------|--------------------------------|

| FCFS | 12 | 18 |

| SJF (Non-Preemptive) | 5.5 | 11.5 |

| Priority |6 | 12 |

| Round Robin |8 | 14 |

You might also like