Anonymous

What Do You Know About Preemptive And Non-Preemptive Scheduling?

5

5 Answers

Anonymous Profile
Anonymous answered
To understand the concept of preemptive and non preemptive scheduling, it is necessary to mention the circumstances under which CPU scheduling decisions may take place. These four circumstances are given below.
(1) When a process enter into waiting state from the running state.
(2) When a process enter into the ready state from the waiting state.
(3) When a process enter into the ready state from the running state.
(4) When a process terminates.

If we pay attention to these four circumstances then we come to the point that a new process have to execute as there are no chances of scheduling in circumstances one and four but there is choice of scheduling between circumstances two and three.
A scheduling scheme is known as non preemptive if it takes place under circumstances one and four and a scheduling scheme is known as preemptive, if it takes place under the circumstances 2 and 3. Solaris 2 and windows 2000 where both systems schedule threads using preemptive, priority based scheduling algorithms including supports for the real time threads.

Preemptive scheduling has a disadvantage. Suppose two processes are sharing data. One process is updating the data and it is preempted in the middle of its work and second process start. Second process tries to read the data which was being updated by process 1 but process 1 was preempted. It means that process 2 is trying to access the data which is in an inconsistent state.
Muhammad Azhar Profile
Muhammad Azhar answered
There are four conditions under which CPU scheduling may take place. They are:  1.    When a process switches from the running state to the waiting state  2.    When a process switches from the running state to the ready state  3.  When a process switches from the "waiting state to the ready state  4.    When a process terminates  If only conditions 1 and 4 apply, the scheduling is called non-preemptive. All other scheduling is preemptive. Preemption basically means that a process may be forcibly removed from the CPU even if it does not want to release the CPU i.e. It is still executing but a higher priority process needs the CPU.    Once a process gets CPU-, the simplest approach is to allow the process to continue using the CPU until it voluntarily yields the CPU e.g. By requesting an IO transfer. I/O interrupts may steal the CPU from time to time. After each interrupt, control passes back to the process that was running when it occurred. This is called a non-preemptive approach.  In a preemptive scheme, a running process may be forced to yield the CPU (thus returning to the ready list) by an external event rather than by its own action. Such external events can be either or both of the following kinds:    •    A higher priority process enters the system from outside.  •    A higher-priority process that was in the wait state becomes ready. This could occur as the result of an I/O interrupt that moves a waiting process to the ready list.
Nisha Fernandes Profile
Nisha Fernandes answered
Most operating systems have about three distinct kinds of schedulers, that is - long term, mid term and short term. A short term scheduler can be pre-emptive which implies that it is able to forcibly remove processes from a Central Processing Unit (CPU) whenever it decides to allocate that particular CPU to another job. It could also be non pre-emptive in which case the short term scheduler will be unable to force all the job processes off that particular Central Processing Unit.

A job scheduler is nothing but an enterprise software application. It is in charge of all unattended background executions which are commonly known batch processing. Today's job schedulers usually provide a graphical user interface as well as a single point of control which can be used both for definition and monitoring of the background executions in a network of computers.
Katie Harry Profile
Katie Harry answered
CPU schedulers are responsible for allocating the CPU to the processes which are in the memory and are ready to be executed. Two different schemes are used the scheduling proposes.

One is Preemptive and the other is Non-Preemptive. In the Preemptive scheme, if a process is being executed by the CPU and another process arrives which has a lesser CPU burst time than the time left for the running process, then the already running process is preempted (blocked) and the new process is executed. This scheme is also called as Shortest Remaining Time First (SRTF)

In the Non-Preemptive scheme, once the allocation of the process has been done, the process cannot be blocked in the middle.

Answer Question

Anonymous