What are the Scheduling algorithms in Operating System
Definition: A Scheduling Algorithm is the algorithm which tells us how much CPU time we may assign to the tasks.
Various processes are scheduled by a process scheduler to be assigned to the CPU according to specific scheduling methods. We will talk about six well-known process scheduling techniques in this chapter.
- First-Come, First-Served (FCFS) Scheduling
- Shortest-Job-Next (SJN) Scheduling
- Priority Scheduling
- Shortest Remaining Time
- Round Robin(RR) Scheduling
- Multiple-Level Queues Scheduling
These algorithms can be preemptive or non-preemptive. Non-preemptive algorithms are built so that once a process enters the running state, it cannot be preempted until it has finished using its allotted time, whereas preemptive scheduling is based on priority and allows a scheduler to preempt a low priority running process whenever a high priority process enters the ready state.
Why do we need Scheduling algorithms
A process, as we all know, requires both CPU and I/O time to run. In a multi-programming system, one process can use the CPU while another waits for I/O. In contrast, in a single-programming system, all of the time is spent waiting for I/O while the CPU is free.
There are numerous processes present in various phases at any given time in a system. Some processes might be executing, while others might be in the waiting stage, and so on. Have you ever wondered how a computer chooses one process from a large number to run? Yes, you’re correct.
To choose one process from a large number of processes to execute, CPUs use several scheduling methods. By boosting throughput, the process scheduling methods are employed to maximise CPU utilisation. In this blog, we will learn about numerous process scheduling techniques utilised by CPU to plan a task.
- Maximize the CPU utilization, meaning that keep the CPU as busy as possible.
- Fair allocation of CPU time to every process
- Maximize the Throughput
- Minimize the turnaround time
- Minimize the waiting time
- Minimize the response time
Some term to understand scheduling process
There are some important terminologies to know for understanding the scheduling algorithms:
Arrival Time: This is the time a process enters the ready queue.
Completion Time: This is the time when a process has finished running.
Burst Time: This is the time a process needs to run on the CPU.
Turn-Around Time: This is the difference in time between completion time and arrival time. This can be calculated as:
Turn Around Time = Completion Time – Arrival Time.
Waiting Time: This is the difference in time between turnaround time and burst time. This can be calculated as:
Waiting Time = Turn Around Time – Burst Time.
Throughput: It is the number of processes that finish running in a certain amount of time.