Q. Describe various process scheduling algorithms. 10 marks.
answer:
There are various algorithms which are used by the Operating System to schedule the processes on the processor.
The main reasons for scheduling algorithm are:
- To Maximize CPU utilization
- For Fair allocation of CPU
- To Maximize throughput
- To Minimize turnaround time
- To Minimize waiting time
- To Minimize response time
Process scheduling algorithms consist of six types. Algorithms can either be non-preemptive or preemptive. Typically, non-preemptive algorithms prevent processes from being preempted until they have completed their allotted time, while preemptive scheduling is based on priority, in which a scheduler may preempt a low priority running process at any time when a high priority process becomes ready.
1.First Come First Service(FCFS)
This algorithm is the simplest algorithm. Those processes that arrive first will get the CPU.The faster the arrival time, the sooner the CPU will be available. It is the non-preemptive type of scheduling and is implemented by using FIFO queue.
Advantages:
Disadvantages:
- It suffers from Convoy effect.
- average waiting time is much higher than the other algorithms
- not much efficient
2. Shortest Job First
First, the process with the shortest burst time at a particular instant of time will be executed. In other words, it is a non-preemptive approach i.e. as soon as a process begins executing, it will be fully completed, and then some other process will take its place.
Advantages
- Best approach to minimize waiting time
- used for long term scheduling
Disadvantages:
- It has starvation
- Many times it becomes complicated to predict the length of the upcoming CPU request
3. Shortest Remaining Time
This is the preemptive approach of the Shortest Job First algorithm. Here, at every instant of time, the CPU will check for some shortest job.
Advantages:
- Short processes will be executed first.
Disadvantages:
- It may result in starvation if short processes keep on coming.
4. Priority Based Scheduling
In this algorithm, the priority will be assigned to each of the processes. The higher the priority, the sooner will the process get the CPU. If the priority of the two processes is same then they will be scheduled according to their arrival time.
Advantages:
- The average waiting time is less than FCFS
- Less complex
Disadvantages:
- It has Starvation Problem. This is the problem in which a process has to wait for a longer amount of time to get scheduled into the CPU. This condition is called the starvation problem.
5. Round Robin
The algorithm where each process is cyclically assigned a fixed time slot. It is the preemptive version of First come First Serve CPU Scheduling algorithm. Round Robin CPU Algorithm generally focuses on Time Sharing technique.
Advantages:
- No starvation will be there in round-robin because every process will get chance for its execution.
- Used in time-sharing systems.
Disadvantages:
- Need to perform a lot of context switching here, which will keep the CPU idle
6.Multilevel Queue Scheduling
During multilevel queue scheduling, we divide a process into batches or queues, and give each queue a priority. It is thus necessary to maintain multiple queues for processes that share common characteristics, each queue having its own priority, and using some scheduling algorithm.
Advantages:
- It has a low scheduling overhead.
Disadvantages:
- Starvation problem
- It is inflexible in nature
Note: For further strengthening the answers we can still add some small examples. This can be refer in internet. Take one example and utilize in all the scheduling algorithms, it will save the time and makes the answer precise
No comments:
Post a Comment