4,742 views
2 votes
2 votes

In which of the following scheduling policies does context switching never take
place?
A) Round-robin
B) Shortest job first
C) Pre-emptive
D) All of the above

2 Answers

4 votes
4 votes

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:

  1. suspending the progression of one process and storing the CPU's state (i.e., the context) for that process somewhere in memory, 
  2. retrieving the context of the next process from memory and restoring it in the CPU's registers
  3. 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

–2 votes
–2 votes

in context switching we save the context of current process...and load the context of next process......

process1 c process2 c process3

C in the above gantt chart is the context switching & it actually takes time for loading context of process....and is an overhead....context switching takes place in every cpu scheduling algorithms...whatever is the case whether it is preemptive or non-preemptive

plz check the link for FCFS & SJF context switch takes place...

https://en.wikipedia.org/wiki/Scheduling_(computing)

for round robin

http://www.sciencehq.com/computing-technology/round-robin-scheduling.html

User and kernel mode switching ///but mode switching is different from context switching..

When a transition between user mode and kernel mode is required in an operating system, a context switch is not necessary; a mode transition is not by itself a context switch. However, depending on the operating system, a context switch may also take place at this time.

 

srestha is still genius

edited by

Related questions

1 votes
1 votes
1 answer
1
iarnav asked Jan 12, 2022
386 views
Does non preemptive CPU scheduling needs hardware support.kindly explain.
0 votes
0 votes
1 answer
2
0 votes
0 votes
3 answers
3
Chaitanya Kale asked Sep 22, 2022
629 views
If we are using non-preemptive CPU scheduling then can there be process state transition from running to ready state?
0 votes
0 votes
3 answers
4
manisha11 asked May 7, 2019
1,222 views
In Multi-processing Operating Systems:(a) Maximum utilization of CPU can be achieved(b) Maximum throughput is achieved(c) Maximum security can be achieved(d) Not suitable...