in Operating System
3,420 views
3 votes
3 votes

There are three processes in the ready queue. When the currently running process requests for I/O how many process switches take place?

  1. 1
  2. 2
  3. 3
  4. 4
in Operating System
by
19 45 67
3.4k views

4 Comments

edited by
ya it is two
0
0

@Arjun Sir check this qus.I already written same ans as given in pdf .I changed it .

Is process switch is same as context switch.?

0
0

i think i got the clue....here in above question  process switching...is not same context switching.....

thatswhy...they mentioned....

" SOMETIMES" CONTEXT SWITCHING IS  REFFERED AS  PROCESS SWITCHING"  that means not always ......check it

http://www.linfo.org/context_switch.html

0
0
@arjun sir please clarify what's the correct answer.
0
0

Subscribe to GO Classes for GATE CSE 2022

7 Answers

7 votes
7 votes
 
Best answer

First Given that currently running process requests for IO so First switch will occur from running state to block state .Now run state is empty we can schedule another process so another process will be scheduled from ready state to running state.

But anyhow this is one context switch to store the state of old process and restore the saved state of new process.

Alternative:

Two.  In  the  first  switch,  the  process   to  be  switched  is  taken  out  and  the  scheduler starts executing. Then the next process is brought to execution. So there are two process switches.

Reference:http://nptel.ac.in/courses/106108101/pdf/Worked_Out_Problems/Mod_3.pdf.

So option B is correct.

selected by
by
64 160 378

5 Comments

i found a link which verified the answer by manojk q7

http://nptel.ac.in/courses/106108101/pdf/Worked_Out_Problems/Mod_3.pdf

0
0
@Tauhin @Digvijay sir can you check this.
0
0
edited by
yes...i already checked...it ...they have considered process switching and context switching as different task...

///ambiquity is there...we need to confirm..from some standard resources....ask from arjun sir
0
0
yes, it is ambiguous. CPU has to execute the code of the scheduler and then that of the new process. Now, what all to count as the process is ambiguous. As per the terms used in standard books I go with 1. But obviously the answer here is 2 as the question seems like taken from the NPTEL PDF.
2
2
4 votes
4 votes

According to me now , on learning and focussing the points of vivek the answer is one . one context switch takes.

saving one process context and then loading the another process context and then running it . its all in one context switch.

now if u can understand then i may define it in the way we have read till now. 

in the grant chat how many context switch does we count if we switch one process and select another process. only one . if this question is taking two context switch then we must have to take 2 context switch between p1 and p2 . one to push it in the wait/ suspended . and second to put p1 in running state that is not happening . so answer is one. 

thanks vivek for asking again and again. 

by
42 73 161

1 comment

thanx ravi for giving attention to my query :-)
0
0
2 votes
2 votes

I THINK 

2 process switches occur . 

by
21 50 117

2 Comments

i think it should be 1 as process switch is a task to store the state of old process( i.e p4) and restore the saved state of new process( i.e p1).
1
1
This whole procedure you showed in diagram constitutes one context switch.
2
2
2 votes
2 votes

One.

The currently running process will be sent in blocked state and a process from ready queue will come in.

edited by
by
31 65 103

2 Comments

Is waiting and blocked state different? I think they are same.
0
0
They are same. My bad. I got confused between Blocked and suspended. Edited my answer.
1
1
0 votes
0 votes
For me its 2 switchings. On requestiong I/O, the process will be shifted to wait queue and the CPU time will be allotted to the very next process in the ready queue. So two switching.
by
1 4
0 votes
0 votes
Correct Answer is two context switches. first , from running to block state for IO, 2nd, from ready queue to running .
by
4 25 40
0 votes
0 votes
Option (b) 2 is correct. First context switch will happen when we move the currently executing state to blocked state. Second, to move the process of ready queue to execute state after serving the I/O request. So, 2 context switches will be required. Hope this helps.
by
1 1 1
Answer:

Related questions