[go: up one dir, main page]

0% found this document useful (0 votes)
32 views5 pages

Numerical - Cpu Scheduling

The document outlines various CPU scheduling algorithms including FCFS, SJF, Priority Scheduling, and Round Robin, providing numerical questions for each. It includes tasks such as calculating Completion Time, Turnaround Time, Waiting Time, and drawing Gantt Charts for different scenarios. Additionally, it compares the performance of these algorithms based on average waiting and turnaround times.

Uploaded by

dathri1501
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)
32 views5 pages

Numerical - Cpu Scheduling

The document outlines various CPU scheduling algorithms including FCFS, SJF, Priority Scheduling, and Round Robin, providing numerical questions for each. It includes tasks such as calculating Completion Time, Turnaround Time, Waiting Time, and drawing Gantt Charts for different scenarios. Additionally, it compares the performance of these algorithms based on average waiting and turnaround times.

Uploaded by

dathri1501
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/ 5

NUMERICAL QUESTION ON CPU Scheduling Algorithm

FCFS (First-Come, First-Served)


1. Basic FCFS Calculation
• Calculate Completion Time (CT), Turnaround Time (TAT), Waiting Time (WT) for each process.
• Find Average Waiting Time and Average Turnaround Time.

Process Burst Time (ms)


P1 6
P2 8
P3 3
P4 10

2. FCFS with Arrival Times


Given Data

Process Arrival Time (ms) Burst Time (ms)


P1 0 5
P2 2 7
P3 4 3
P4 6 9
Question:
• Draw the Gantt Chart for execution.
• Compute Completion Time, Turnaround Time, and Waiting Time.
• Calculate the Average Waiting Time.

3. FCFS with Idle CPU Time


Given Data
Process Arrival Time (ms) Burst Time (ms)
P1 0 8
P2 5 4
P3 10 6
P4 12 2

Question:
• What happens when a process arrives after the CPU was idle?
• Compute Completion Time, Turnaround Time, and Waiting Time.
• Find CPU Utilization percentage.

4. Comparing FCFS with Other Algorithms


Given Data
Process Arrival Time (ms) Burst Time (ms)
P1 0 3
P2 1 7
P3 2 2
P4 3 5

Question:
• Compute scheduling using FCFS, Shortest Job First (SJF), and Round Robin (Quantum = 3 ms).
• Compare the Average Waiting Time and Turnaround Time for each algorithm.

SJF Scheduling
1. Basic SJF Scheduling (Non-Preemptive)
Given data:
Process Arrival Time (ms) Burst Time (ms)
P1 0 6
P2 2 8
P3 4 3
P4 6 5
Question:
• Calculate Completion Time (CT), Turnaround Time (TAT), and Waiting Time (WT) for each process
using Non-Preemptive SJF.
• Find Average Waiting Time and Average Turnaround Time.
• Draw the Gantt Chart representation of execution.

2. SJF with Arrival Times


given data:
Process Arrival Time (ms) Burst Time (ms)
P1 0 5
P2 3 9
P3 5 2
P4 6 7
Question:
• Compute Completion Time, Turnaround Time, and Waiting Time using Non-Preemptive SJF.
• Compare with FCFS scheduling and analyze differences in average waiting time.
• Show the Gantt Chart for execution order.

3. Preemptive SJF Scheduling


given data:
Process Arrival Time (ms) Burst Time (ms)
P1 0 8
P2 1 4
P3 2 9
P4 3 5
Question:
• Apply Preemptive SJF (Shortest Remaining Time First - SRTF) scheduling.
• Calculate Completion Time, Turnaround Time, and Waiting Time for each process.
• Compare Preemptive vs Non-Preemptive SJF in terms of response time and efficiency.
• Show the Gantt Chart with preemptions.
4. SJF with Idle CPU Time
given data:
Process Arrival Time (ms) Burst Time (ms)
P1 0 7
P2 5 4
P3 10 6
P4 12 2
Question:
• What happens when a process arrives after CPU was idle?
• Compute Completion Time, Turnaround Time, and Waiting Time using Non-Preemptive SJF.
• Find CPU Utilization percentage.
• Compare this with Round Robin Scheduling.

Priority Scheduling
1. Non-Preemptive Priority Scheduling
Given data:
Process Arrival Time (ms) Burst Time (ms) Priority
P1 0 6 3
P2 2 8 1
P3 4 3 4
P4 6 5 2
Question:
• Compute Completion Time (CT), Turnaround Time (TAT), and Waiting Time (WT) for each process
using Non-Preemptive Priority Scheduling.
• Find Average Waiting Time and Average Turnaround Time.
• Draw the Gantt Chart for execution order.

2. Preemptive Priority Scheduling


Given data:
Process Arrival Time (ms) Burst Time (ms) Priority
P1 0 5 2
P2 1 4 1
P3 2 9 3
P4 3 5 2
Question:
• Implement Preemptive Priority Scheduling, where a higher priority process interrupts execution.
• Compute Completion Time, Turnaround Time, and Waiting Time for each process.
• Draw the Gantt Chart and explain process switching.
3. Priority Scheduling with Equal Priorities
given data:
Process Arrival Time (ms) Burst Time (ms) Priority
P1 0 3 1
P2 2 7 1
P3 4 4 1
P4 6 6 1
Question:
• Since all processes have the same priority, how does the scheduler determine execution order?
• Compute Completion Time, Turnaround Time, and Waiting Time.
• Compare FCFS vs Priority Scheduling in this scenario.

4. Priority Scheduling with Aging (Starvation Prevention)


Given data:
Process Arrival Time (ms) Burst Time (ms) Initial Priority
P1 0 6 4
P2 3 8 1
P3 5 3 5
P4 6 4 2
Question:
• Implement an ageing mechanism to prevent starvation (increase priority over time).
• Compute Completion Time, Turnaround Time, and Waiting Time.
• Compare with a standard Non-Preemptive Priority Scheduling strategy.

Round Robin Scheduling


1. Basic Round Robin Scheduling
Given data:
Process Arrival Time (ms) Burst Time (ms)
P1 0 10
P2 1 6
P3 2 8
P4 3 4
Time Quantum = 3 ms
Question:
• Determine the order of execution using Round Robin scheduling.
• Compute Completion Time (CT), Turnaround Time (TAT), and Waiting Time (WT) for each process.
• Find Average Waiting Time and Average Turnaround Time.
• Draw the Gantt Chart showing process execution.
2. Round Robin with Different Time Quantum
Given data:
Process Arrival Time (ms) Burst Time (ms)
P1 0 12
P2 2 7
P3 4 9
P4 6 5
Time Quantum = 4 ms
Question:
• How does the choice of time quantum affect process execution?
• Compute Completion Time, Turnaround Time, and Waiting Time using Round Robin (TQ = 4 ms).
• Compare results with TQ = 2 ms and analyze the difference.

3. Round Robin with Idle Time in CPU


Given data:
Process Arrival Time (ms) Burst Time (ms)
P1 0 7
P2 5 6
P3 10 8
P4 12 4
Time Quantum = 3 ms
Question:
• How does CPU idle time affect scheduling efficiency?
• Compute Completion Time, Turnaround Time, and Waiting Time using Round Robin (TQ = 3 ms).
• Analyze CPU utilization in this scenario.

4. Comparing Round Robin with Other Algorithms


Given data:
Process Arrival Time (ms) Burst Time (ms)
P1 0 5
P2 1 9
P3 2 6
P4 3 7
Time Quantum = 3 ms
Question:
• Compute scheduling using Round Robin, FCFS, and SJF algorithms.
• Compare Average Waiting Time and Turnaround Time for each method.
• Analyse which algorithm provides the best balance between response time and efficiency.

You might also like