79.9k views
1 vote
define the difference between preemptive and non-preemptive scheduling, and give at least two examples for each of them.

User Ahmad Ali
by
8.3k points

1 Answer

3 votes

Final answer:

Preemptive scheduling allows processes to be interrupted for higher priority tasks, whereas non-preemptive scheduling does not. Examples of preemptive scheduling include Round Robin and Priority Scheduling, while examples of non-preemptive scheduling include First Come First Served and Shortest Job Next.

Step-by-step explanation:

The difference between preemptive and non-preemptive scheduling lies in how they handle process execution in an operating system's CPU scheduling. Preemptive scheduling allows a process to be interrupted in the midst of its execution and then returned to the queue if a higher priority process arrives. On the other hand, non-preemptive scheduling mandates that a process must finish its CPU burst time before another process can take over.

Examples of preemptive scheduling include:

  1. Round Robin (RR): Processes are assigned time slots (quantum) and are interrupted if they do not complete within that time, allowing other processes a turn.
  2. Priority Scheduling: If a process with a higher priority comes in, the current process is preempted and the higher-priority process is executed first.

Examples of non-preemptive scheduling include:

  1. First Come First Served (FCFS): Processes are executed in the order they arrive, with no interruptions allowed, regardless of their priority.
  2. Shortest Job Next (SJN): The process with the shortest execution time is chosen next, and once it starts, it runs to completion without preemption.
User Cesarluis
by
8.5k points