Here what are the number of context switches ? Is it 5 or 6? Do we consider context switch before P1 (i.e during the start) ?
A context switch occurs when a computer’s CPU switches from one process or thread to a different process or thread.
It should be 5.
X->YZ , Y->XZ , ...