WHAT IS THE FUNDAMENTAL PURPOSE OF HAVING A PROCESS SCHEDULER?
There are various processes which the CPU gets based on the particular scheduling algorithms. In this piece of writing, you will get information about the six process scheduling algorithms. Also, the algorithms are of types, preemptive and non-preemptive.
NON-PREEMPTIVE ALGORITHM- These process scheduling algorithms are designed to avoid a process to go into the preempted state until it has completed its allotted time and help them to go to the running state.
PREEMPTIVE ALGORITHM- It is an algorithm which is based on the priorities of the processes. When a high priority process enters into a ready state, then according to this algorithm, the scheduler may preempt a low priority.
WHY DO WE NEED SCHEDULING?
There are two features or requirements of a typical process. These are the input/output time and the CPU time. In the various uni programming system, for instance, MS-DOS, the time which is spent for the input and output is wasted, and the worst thing is that the CPU is free in that duration of time.
Whereas, in multiprogramming systems, the CPU is used only for one process and the other has to wait for the processor. This has been achieved only with the help of the process scheduling.
WHAT ARE THE SCHEDULING CRITERIA FOR THE PROCESSES?
The techniques and the criteria that are considered while selecting the best algorithm for the scheduling purpose for a particular situation and environment have the following standards-
- Throughput- It is the count of the number of processes which are completed in the per unit time. The value may range from 10 seconds to even an hour. All this depends on the specifications of the processes.
- Utilization of the CPU- The real system of the CPU usage has to be around 40% and goes to approximately 90%. But in the ideal mode, the CPU waste zero cycles as it was busy 100% of the time.
- Turnaround time- It is the time required for the completion of the process from the beginning of the submission time till its end.
- Response Time- In the interactive program, the response time is the issuance of the command to initiate its response.
- Waiting time- It is the calculation of the time which the process has to spend in the ready queue waiting to get the CPU.
Let us now discuss the diverse set of algorithms used in this processes to sort them.
- FIRST COME FIRST SERVE SCHEDULING-
It is clear from the name that the jobs which will enter the process firstly, then it is served on the first basis. It comes under the non-preemptive type of process scheduling algorithm. FCFS is tagged as the easiest to execute and comprehend. You might remember the concept of queues. This FCFS algorithm is based on the first in first out queue (FIFO).
Disadvantage- The main negative point of the algorithm is that it is poor in performance. It is because its average waiting time is high.
- SHORTEST JOB NEXT SCHEDULING-
The other name of the scheduling process is the shortest job first or SJF. Like the FCFS scheduling, it also comes with the non-preemptive algorithm. Our focus while scheduling all the operations is to reduce the waiting time. So, the shortest job first is the best approach to minimize the waiting time.
A perk of SJF scheduling-When we have the batch systems in which the CPU time is known in advance then the implementing the scheduling process is easy.
- PRIORITY-BASED SCHEDULING-
In simple batch operating systems, priority scheduling is the most common type of process scheduling algorithm. And it is a non-preemptive algorithm. In this, every process is assigned a priority. The process which has the highest priority is executed first and the method which comes at the second rank is implemented after it. The process goes this way.
Do you think that what if two processes have the same priority? Yes, it happens many times. Then, in such situations, the job which comes first in the queue gets served first.
What are the factors on which the priorities are decided?
There are techniques on which the processes get their priority. These are-
- Memory requirements
- Time requirements
- Another resource requirement
- SHORTEST REMAINING TIME-
The preemptive version of the shortest job next algorithm is the shortest remaining time. In this type of algorithm, the job which is closest to completion is allocated to the processor. It is done so because a newer ready job with shorter time to complete its process can be preempting it. In case the CPU time of the job is not known then, its implementation in the interactive systems is impossible. The most common area in which the algorithm is used is the batch environments. In those environments, there are short jobs which are needed to be given preference.
- ROUND ROBIN SCHEDULING-
It is another preemptive process scheduling algorithm after the process of the shortest remaining time. There is another term used in this, unlike the other process scheduling algorithms. It is quantum. It is a process in which each process is provided a fixed time for its implementation. The process which is implemented for the assigned amount of time is preempted. It is because it gives space to the other processes and let it execute for a given period. The preempted processes get the context switching and are used to save its states.
- MULTIPLE-LEVEL QUEUES SCHEDULING-
This type of algorithm is not an example of an independent scheduling algorithm. To use this process of scheduling, it needs other existing algorithms to group and schedule jobs with the standard features and characteristics. The points related to the multi-level queues scheduling are as follows-
- There are separate scheduling algorithms for every queue.
- The scheduling process maintains multiple queues for the operations with common characteristics.
- Each queue gets its priority.
For instance, the jobs which are bounded by the CPU are scheduled in one queue, and those who are delineated in the input and output are scheduled in a separate queue. To continue this process, the process scheduler has to select the jobs from each line, and after this, it assigns the tasks to the algorithm based on the CPU and assigns them to the queue.
SOME CHARACTERISTICS RELATED TO THE SCHEDULING ALGORITHMS ARE-
- When the first job scheduled on the first come first serve, then the algorithm causes long waiting times.
- Round Robin scheduling algorithm behaves same as the FCFS scheduling when the quantum of the former algorithm is substantial.
- The two algorithms which because starvation is the shortest job first and the shortest remaining time first. To understand in simple words, imagine a situation where the long process is ready in the queue. Then the shorter methods keep coming.
- The process scheduling algorithm which is optimal regarding average waiting time for a given set of processes. In simple words, the average waiting time with the scheduling process is minimum. The problem which arises in this situation is that knowing and predicting the time of the next job is difficult.
Equate yourself with the knowledge of the six process scheduling algorithms in natural language.