Wednesday, April 29, 2020

Operating Systems Question Bank with Answers 09

Compare and contrast on preemptive and non-preemptive scheduling approaches in operating systems


Question:

Compare and contrast on preemptive and non-preemptive scheduling approaches, on issues of simplicity, fairness, performance and required hardware support.


Answer:
Process scheduling can be preemptive or non-preemptive.
Preemptive scheduling is where a process can be interrupted or preempted in its execution at any time by the operating system (or, more precisely, an interrupt). It is relatively complex, but has scope to implement fairness by ensuring no process "hogs" the CPU. In terms of performance there is some additional overhead in context switches which aren't, strictly speaking, necessary. The hardware support required is a programmable or periodic timer which can generate interrupts.
Non-preemptive scheduling refers to schemes in which a process only relinquishes the processor voluntarily (e.g. via yield) or implicitly (e.g. when blocking on I/O). This is somewhat less complex to implement since there are fewer times when scheduling decisions need to be made, and less worry about concurrency in user-space. Fairness cannot in general be guaranteed since a rogue process can fail to yield the processor for an arbitrarily long time; however performance is usually good since there are no unnecessary context switches. No additional hardware support is required beyond the ability to save and restore process context. 


In non-preemptive scheduling, a process remains in the running state until it explicitly performs an action that will move it to either the ready or waiting scheduling queues.
In preemptive scheduling, a running process also moves to the ready or waiting scheduling queues by external acts occurring outside the running process (e.g., a timer interrupt).


***********************
Related 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

data recovery