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.
Mix burst time
- 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 |
|---|---|---|---|---|---|
| P1 | 0 | 2 | 1 | 5 | 3 |
| P2 | 2 | 3 | 3 | 3 | 1 |
| P3 | 3 | 1 | 2 | 3 | 1 |
| P4 | 3 | 4 | 2 | 4 | 1 |
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 for1unit of time, because after1unit of time it has to perform I/O operation for5unit of time. - As,
P1got preempted at time unit1and next processP2arrives at time unit2that’s why CPU remain idle for1unit of time. -
P2arrive at CPU at time unit2, but got executed for only1unit of time becauseP3arrives at time unit3and have higher priority thanP2. -
P3starts its execution and got executed for2unit of time and then to perform I/O operation it got preempted. -
P2andP4are present in ready queue but P2’s priority is higher than that of P4’s priority soP2starts its execution. WhenP2executed for1unit for time at that time P1’s I/O operation got completed. - So,
P2got preempted asP1has higher priority and P1’s execution got started. -
P1got executed for2units of time and then the I/O operation ofP3got completed soP1got preempted. -
P3got terminated after executing for1unit of time. AndP1again start executing, after executing for1unit of time it also gets terminated. - Again
P2has higher priority so P2’s execution started and after executing for1unit of timeP2got preempted to perform I/O operation. -
P4is the only process remaining in the ready queue so its execution starts and after2unit of timeP4get preempted to perform I/O operation. - CPU will remain idle as
P2andP4are busy in I/O for1unit 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 for2unit 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 |
|---|---|---|---|---|---|---|
| P1 | 0 | 2 | 1 | 5 | 3 | 10 |
| P2 | 2 | 3 | 3 | 3 | 1 | 15 |
| P3 | 3 | 1 | 2 | 3 | 1 | 9 |
| P4 | 3 | 4 | 2 | 4 | 1 | 18 |
Some observations from the table.
Ratio of CPU idleness = 4/18Ratio 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.
📱 Contact Me
Twitter
LinkedIn
Telegram
Instagram

Top comments (0)