in Operating System
69 views
1 vote
1 vote

Consider a process P running on a system with non-preemptive Kernel design. Consider following actions by P :
(i) A blocking system call.
(ii) Servicing a timer interrupt.
(iii) Exit system call.
(iv) Servicing a disk interrupt, that results in another blocked process being marked as ready.
Which of the above actions always result in context-switch of P?

in Operating System
69 views

1 Answer

0 votes
0 votes
Option (i) , Option (ii) , Option (iii)

Excerpt from Tannebum book ( Modern operating system ) :

A nonpreemptive scheduling algorithm picks a process to run and then just lets it run until it blocks (either on I/O or waiting for another process) or voluntarily releases the CPU. Even if it runs for many hours, it will not be forcibly suspended. In effect, no scheduling decisions are made during clock interrupts. After clock-interrupt processing has been finished, the process that was running before the interrupt is resumed, unless a higher-priority process was waiting for a now-satisfied timeout .

 

I’ve marked option (ii) considering that scheduler does run on every clock interrupt , but does not schedule any process . Hence , running of scheduler requires a context switch .

An system call will always result in context switch , hence (iii) is also  correct.

As for option ( 4) , cpu can decide not to choose to serivce an IO interrupt . hence that will be false .

.
ago

2 Comments

according to made easy-

Please explain action (i), (ii) and (iv)

1
1
“A timer interrupt cannot lead context-switch always”

It might not lead to context switch to another process , but won’t it lead to context switch to the OS’s SCHEDULER process ?
0
0

Related questions

0 votes
0 votes
1 answer
2