Scheduling algorithms say how much time is allocated to Processes and Threads. Their goal is to fulfil a number of criteria:
All tasks should get their chance to use CPU resources.
When time to use priority, lower priority should not be starved for higher time.
The scheduler should scale well with a growing number of tasks, ideally being O(1). This is observed in the Linux kernel.
Existing Scheduling Algorithms:
These are off three types. They are:
1. Interactive Scheduling Algorithm
2. Batch Scheduling Algorithm
3. Real Time Scheduling Algorithm
1. Interactive Scheduling Algorithms:
These are off four types, they are
• Round robin Scheduling
• Priority based Round robin.
• Shortest Process Next.
• Lottery Scheduling
Round Robin Scheduling:
It is pre-emptive scheduler and the simplest algorithm. This use only a single queue of process. When the system fires, next process is switched to and the pre-empted process is set back into queue.
Each process is assigned with a time slice or ‘Quantum’. Quantum gives us the number of system timer ticks the process may run for before being pre-empted. Each process is given a Quantum, but the question is how can we choose a time quantum.
o It is simple and strict ‘First come First served nature.
o Absence of Priority system, because of which low privilege has to wait for higher privilege one.
Priority based Round Robin:
This is similar to Round Robin, but allows a hierarchy of process. Multiple process queues are used. As long as higher priority one is in the queue, they run first and other lower priority process waits.
o Its simplicity and reasonable support for priorities.
o Lower priority proces...
... middle of paper ...
... a feasible schedule. If the EDF algorithm fails to produce a feasible schedule, then no feasible schedule exists. When the goal of scheduling is to meet deadlines, there is no advantage to completing any job sooner than necessary.
Least Slack Time:
It is also called minimum laxity first
The slack time is d-t
T is the time remaining to complete the job
J1 is released at time 0, its deadline is 6, and its execution time is 3
At time 0, the slack time is 3
As long as it executes, its slack remain at 3
Now suppose that it is preempted at time 2 by J3 which executes from time 2 to 4
During this interval, the slack of J1 decreases from 3 to 1
At time 4, the remaining execution time of J1 is 1
The LST algorithm assigns priorities to jobs based on their slacks
The smaller the slack the higher the priority
LST algorithm is optimal.