This is a multipart blog article series, and in this series I am going to explain you the concepts of operating system. This article series is divided into multiple modules and this is the second module which consists of 11 articles.
In this article we will see a question in mix burst, which means that the process will access CUP and then perform some I/O operation.
- The mode is pre-emptive.
- A criterion is pre-emptive.
Let us understand about mix burst time scheduling with an example. We have to complete this table by solving this question by using gantt chart.
|Process No.||Arrival time||Priority||CPU||I/O||Completion time|
Lower the number higher the priority.
Before solving this question you need to keep few points in mind.
- We have to find the completion time of every process.
- The preemption of the processes are related to the priority.
- So, at time unit 0 process
P1arrives at CPU and get executed for
1unit of time, because after
1unit of time it has to perform I/O operation for
5unit of time.
P1got preempted at time unit
1and next process
P2arrives at time unit
2that’s why CPU remain idle for
1unit of time.
P2arrive at CPU at time unit
2, but got executed for only
1unit of time because
P3arrives at time unit
3and have higher priority than
P3starts its execution and got executed for
2unit of time and then to perform I/O operation it got preempted.
P4are present in ready queue but P2’s priority is higher than that of P4’s priority so
P2starts its execution. When
1unit for time at that time P1’s I/O operation got completed.
P2got preempted as
P1has higher priority and P1’s execution got started.
P1got executed for
2units of time and then the I/O operation of
P3got completed so
P3got terminated after executing for
1unit of time. And
P1again start executing, after executing for
1unit of time it also gets terminated.
P2has higher priority so P2’s execution started and after executing for
1unit of time
P2got preempted to perform I/O operation.
P4is the only process remaining in the ready queue so its execution starts and after
2unit of time
P4get preempted to perform I/O operation.
- CPU will remain idle as
P4are busy in I/O for
1unit of time.
- P2’s I/O is completed so it got executed for
1unit of time and got terminated.
- Then again as only
P4is remaining and that too is busy in I/O, CPU will remain idle for
2unit of time.
- When P4’s I/O completed it got executed for
1unit of time and then terminated.
All the processes are now completed. Now we will find the completion time of each process.
|Process No.||Arrival time||Priority||CPU||I/O||CPU||Completion time|
Some observations from the table.
Ratio of CPU idleness = 4/18
Ratio of CPU usage = 14/18
So, this was all about mix burst time scheduling. Hope you like it and learned something new from it.
If you have any doubt, question, queries related to this topic or just want to share something with me, then please feel free to contact me.