Difference between Preemptive and NonPreemptive ????

Non-Preemptive:
Non-preemptive algorithms are designed so that once a process enters the running state(is allowed a process), it is not removed from the processor until it has completed its service time ( or it explicitly yields the processor). context_switch() is called only when the process terminates or blocks.

In non-preemptive scheduling, a running task is executed till completion. It cannot be interrupted.

Example: First In First Out, Shortest Job First

Preemptive:
Preemptive algorithms are driven by the notion of prioritized computation. The process with the highest priority should always be the one currently using the processor. If a process is currently using the processor and a new process with a higher priority enters, the ready list, the process on the processor should be removed and returned to the ready list until it is once again the highest-priority process in the system

Tasks are usually assigned with priorities. At times it is necessary to run a certain task that has a higher priority before another task although it is running. Therefore, the running task is interrupted for some time and resumed later when the priority task has finished its execution. This is called preemptive scheduling.

 Example: Shortest Remaining Time first(SRTF) , Round Robin
SHARE

About df

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment