Thursday, April 9, 2020

OS Multiple choice interview questions

MCQ in operating systems with answers, OS interview questions, solved Gate questions in OS


Operating systems MCQ interview questions - Set 8



1. The difference between preemptive and non-preemptive scheduling is

(a) Whether or not a ready process can be involuntarily terminated
(b) Whether or not a running process is involuntarily removed from the ready state
(c) Whether or not a blocked process can have its resources involuntarily taken away from it
(d) Waiting time is more in preemptive scheduling and less in non-preemptive
Answer: (b)           

Preemptive scheduling - Processor can be preempted to execute a different process in the middle of execution of any current process.

Non-preemptive scheduling - Once Processor starts to execute a process it must finish it before executing the other. It cannot be paused in middle.


2. The four conditions that must hold in order for deadlock to occur are
(a) Mutual exclusion, hold-and-wait, circular wait, and no preemption
(b) No preemption, no starvation, circular wait, and mutual exclusion
(c) Hold-and-wait, circular wait, no starvation and mutual exclusion
(d) All of the above
Answer: (a)            

What are the four conditions that are necessary and sufficient to cause a deadlock?

Mutual exclusion - At least one process must be held in a non-sharable mode. At least one non-sharable resource in the system which can be used by only one process at a time.
Hold and wait – there must be a process holding one resource and waiting for another.
Circular wait – there exist a set of circular chain of processes with each process holding resources which are currently being requested by the next process in the chain.
No preemption – Resources cannot be preempted. Previously granted resources cannot forcibly taken away

3. When does preemption take place?

(a) When a quantum expires.
(b) When a process issues an I/O request.
(c) When a process exits.
(d) All of the above.
Answer: (a)            
Preemption means the operating system moves a process from running state to ready state without the process requesting it. Preemption takes place when a process switches from the running state to the ready state due to timer interrupt (time slice or quantum), or when a process switches from the waiting state to the ready state due to the completion of I/O.

4. What does interrupt do?
(a) Allow the CPU to notify devices that it needs attention
(b) Allow the devices to notify the device controller that they need attention
(c) Allow the devices to notify the CPU that they need attention
(d) None of the above
Answer: (c)            

An interrupt is a signal to the processor emitted by hardware or software indicating an event that needs immediate attention.


5. In contrast to a cooperative scheduler, a preemptive scheduler supports the following state transition
(a) Ready → running
(b) Running → ready
(c) Ready → blocked
(d) Blocked → running
Answer: (b)           

Cooperative scheduler is the non-preemptive scheduler.

Preemption means the operating system moves a process from running to ready without the process requesting it.

Ready → blocked or blocked → running are not valid state transitions. Ready → running is a state transition that happens both in preemptive and non-preemptive scheduling.
Running → ready is supported by preemptive scheduler.

*************


Go to Operating Systems MCQ home page

Go to Operating Systems home page


Go to Operating Systems TRUE/FALSE questions page




what is the difference between preemptive and non-preemptive scheduling

four necessary condition for deadlock to happen in OS

Solved GATE exam questions in operating systems

Solved exercise in OS scheduling

Valid state transition in preemptive scheduler

Solved GATE multiple choice questions in operating systems

OS MCQ with answers explained

Solved OS MCQ questions







No comments:

Post a Comment

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents