Cpu SCHC Numerical Practice-Group
Cpu SCHC Numerical Practice-Group
Solution:
P1 10 2 8
P2 20 4 16
P3 30 6 24
Since all the processes will first do I/O and then CPU processing, process P1 spends first
20% i.e. 2ms in doing I/O. So CPU is not utilized for the first 2ms. Then P1 spends next
80% i.e. 8ms on processing. By the time P1 finishes with CPU processing P2 has finished
its I/O (4ms) and then it gets turn for CPU processing which it does for 16ms and similarly
P3 does processing for next 24ms.
Solution:
P1 10 2 6 2
P2 15 3 9 3
P3 20 4 12 4
Q3. A uniprocessor computer system has three processes, which alternate 20ms CPU
bursts with 80ms I/O bursts. All the processes were created at nearly the same time. The
I/O of all the processes can proceed in parallel. What will be the CPU utilization (over a
long period of time) using FCFS and Round Robin (time quantum 10ms) for this system?
Solution:
P1 utilizes CPU for 20ms, P2 for next 20ms and P3 for next 20ms. P1 after 20ms goes for
I/O for 80ms. This means it completes I/O at 100ms. After 100ms P1 will again utilize CPU
and then P2 after 120ms and so on. This means the CPU remains idle from 60th to
100thms i.e. it is utilized for first 60ms only. Hence CPU utilization = 60/100 = .60 i.e. 60%
Time slice = 10ms
P1 utilizes 10ms of CPU and then P2 utilizes 10ms of CPU and the P3 for next 10ms.
Hence after 40ms P1 starts with I/O and after 50ms P2 also starts with I/O and P3 after
60ms. Since I/O can be done in parallel, P1 finishes I\O at 120th ms (40 + 80),P2 finishes its
I\O at 130th ms (50 +80) and P3 at 140ms(60+80). Therefore we can see that CPU remains
idle from 60th to 120th ms.
Q4. Consider the set of 5 processes whose arrival time and burst time are given below
If the CPU scheduling policy is priority non-preemptive, calculate the average waiting
time and average turnaround time. (Higher number represents higher priority).
Q5. Find the av. waiting time and av. turnaround time using:
a) FCFS
b) SJF(NP)
c) SJF(P)
d) RR (TQ=3)
P1 2 2
P2 6 5
P3 4 0
P4 7 0
P5 4 7
Q6. Find the av. waiting time and av. turnaround time using: a)
SJF(NP)
b) SJF(P)
P1 3 2
P2 5 0
P3 3 1
P4 4 6