Week 7 (Scheduling)
Nonpreemptive Scheduling
A scheduling discipline is nonpreemptive if, once a process has been given the CPU, the CPU cannot be taken away from that process.
Following are some characteristics of nonpreemptive scheduling
1. In nonpreemptive system, short jobs are made to wait by longer jobs but the overall treatment of all processes is fair.
2. In nonpreemptive system, response times are more predictable because incoming high priority jobs can not displace waiting jobs.
3. In nonpreemptive scheduling, a schedular executes jobs in the following two situations. 1. When a process switches from running state to the waiting state.
2. When a process terminates.
Preemptive Scheduling
A scheduling discipline is preemptive if, once a process has been given the CPU can taken away.
The strategy of allowing processes that are logically runable to be temporarily suspended is called Preemptive Scheduling and it is contrast to the "run to completion" method.
----------
What is pre-emptive and non-preemptive scheduling?
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.
Eg: Round robin
In non-preemptive scheduling, a running task is executed till completion. It cannot be interrupted.
Eg First In First Out
What is pre-emptive and non-preemptive scheduling?
Preemptive scheduling: The preemptive scheduling is prioritized. The highest priority process should always be the process that is currently utilized.
Non-Preemptive scheduling: When a process enters the state of running, the state of that process is not deleted from the scheduler until it finishes its service time.
----------
In non-preemptive, if the task is running, there cannot be another CPU task interrupting it.
for priority scheduling, placing an item on the queue doesnt have any specifics - where its placed is up to implementation.
For non-preemptive, if a process is put into the wait queue, another process can be put from ready to run
For pre-emptive, if a process is interrupted but not finished and is in the ready state, another process will be put from ready to run