Okay, after a lot of discussion, here is the summary and conclusion :
Trick : LOok at the options; Eliminate unnecesory options.
How to eliminate?
-> Observe the behaviour of given CPU scheduling algo. You can see SJF stands out of rest.
Redefining context switch :
Till now I believed that : p1 | p2 | p1
that "| " is a context switch. But a context switch is
Context switching can be described in slightly more detail as the kernel (i.e., the core of the operating system) performing the following activities with regard to processes (including threads) on the CPU:
- suspending the progression of one process and storing the CPU's state (i.e., the context) for that process somewhere in memory,
- retrieving the context of the next process from memory and restoring it in the CPU's registers
- returning to the location indicated by the program counter (i.e., returning to the line of code at which the process was interrupted) in order to resume the process.
So in SJF, the shortest job gets executed completely and then another shortest job is scheduled. hence there is no suspension of progression of currently executing process. Hence the answer.
F*ck the King, f*ck the kings guard. - a broken man