Let the processes be $P_1,P_2,P_3$.
$P_1$: arrival time $0$, burst time $10$
$P_2$: arrival time $2$, burst time $20$
$P_3$: arrival time $6$, burst time $30$
At time $0$, $P_1$ starts executing.
At time $2$, $P_2$ arrives, but remaining time of $P_1$ is $8$, which is less than $20$. So, $P_1$ continues.
At time $6$, $P_3$ arrives, but remaining time of $P_1$ is $4$, which is less than $30$. So, $P_1$ continues.
$P_1$ completes at time $10$.
Then context switch occurs from $P_1$ to $P_2$.
$P_2$ completes at time $30$.
Then context switch occurs from $P_2$ to $P_3$.
So, total context switches are
$2$
Online Test Series, Information About Examination,
Syllabus, Notification
and More.
Online Test Series, Information About Examination,
Syllabus, Notification
and More.