BCA 4th sem
Home/BCA 4th sem
BCA 4th semester long question solution 2078, BCA , Operating System

BCA 4th sem

9. What is CPU Scheduling? Write does the criteria for CPU scheduling? Consider the following set of processes, with the length of the CPU burst given in millisecond , draw Gant chart illustrating their execution and calculate average waiting time using:

a) First come First serve

b) Shortest Job first

c) None-preemptive priority (smaller number implies higher priority)

d) Round robin (quantum=1)

ProcessBurst TimePriority
P0103
P111
P225
P314
P452

BCA 4th semester long question solution 2078

a)  First Come First Serve

Solution

ProcessArrival Time   (AT)Burst Time (BT)Completion time (CT)Turned around Time (TAT)Waiting Time (WT)
P001010100
P101111110
P202131311
P301141413
P4051919
Total=67
14
Total= 48

Note:- CT=From Gantt chart

                        TAT= CT-AT

                        WT=TAT-BT

                        P0=This process come first so we start at first AT=0 here in BT= 10

                        P1= P0 को BT लाई P1मा जोडनु पार्ने हुन्छ । Eg, [ P0 Burst time (BT)=10+P1(1)=11]

Gantt chart

P0P1P2P3P4
0     10      11     13      14    19

Total Waiting Time= 0+10+11+13+14

                                                =48

Average waiting time=Total waiting time/ process

                                                   48/6

                                                   =9.6

Total turn around Time= 10+11+13+14+19

                                                =67

Average turn around time= Total turn around time/ Process

                                           = 67/5

                                         = 13.4

b) Short job first

Solution

ProcessBurst Time   (BT)PriorityCompletion time (CT)Turned around Time (TAT)Waiting Time (WT)
P010310100
P111111110
P225141412
P314121211
P4521515
Total=62
10
Total= 43
Gantt chart
P0P1P2P3P4
0     10      11     12      14    15

Total waiting Time=0+10+12+11+10

=43

Average waiting time= Total waiting time/process

=43/5

=8.6

Total turnaround time= 10+11+14+12+15

=62

Average turn around time= total trunaround time/Process

=62/5

=12.4

C) Non-preemptive priority (small number implies higher)

ProcessBurst Time   (BT)PriorityCompletion time (CT)Turned around Time (TAT)Waiting Time (WT)
P010310100
P111111110
P225191917
P314171716
P4521616
Total=73
11
Total= 54
Gantt chart
P0P1P2P3P4
0     10      11     16      17    19

Total waiting Time=0+10+17+16+11

=54

Average waiting time= Total waiting time/process

=54/5

=10.8

Total turnaround time= 10+11+19+17+16

=73

Total turn around time= total trunaround time/Process

=73/5

=14.6

d) Round Robin (quantum = 1)

ProcessBurst Time   (BT)Completion time (CT)Turned around Time (TAT)Waiting Time (WT)
P01010100
P11111110
P22151513
P31131312
P451919
Total=68
15
Total= 50
Gantt chart
P0P1P2P3P4P2P4
0     10      11     12      13    14 15 19

Total waiting Time=0+10+13+12+15

=50

Average waiting time= Total waiting time/process

=50/5

=10

Total turnaround time= 10+11+15+13+19

=68

Total turn around time= total trunaround time/Process

=68/5

=13.6

BCA 4th semester long question solution 2078

BCA 4th sem BCA 4th sem BCA 4th sem

error: Content is protected !!!