First Come First Serve (FCFS)
First Come First Serve is an operating system scheduling algorithm that automatically executes queued requests and processes in order of their arrival. It is the easiest and simplest CPU scheduling algorithm. In this type of algorithm, processes which requests the CPU first get the CPU allocation first. This is managed with a FIFO queue.
Steps of Execution of FCFS Algorithm
Arrival of Processes:Note the arrival time for each process, marking when they enter the ready queue or the system.
Process Burst Time: Determine the time needed for each process to complete execution.
Sorting:Arrange processes based on arrival time. In FCFS, prioritize the earliest arrival. For ties, follow the arrival order.
Execution:Execute processes in sorted order. Start with the earliest arrival, proceeding sequentially.
Waiting Time: Calculate waiting time for each process. It's the sum of burst times of processes arriving earlier.
Turnaround Time: Compute turnaround time for each process. It includes waiting time and burst time. Turnaround Time = Waiting Time + Burst Time
Average Waiting Time: Average Waiting Time and Turnaround Time: Find averages for all processes. Average Waiting Time = Total Waiting Time / Number of Processes Average Turnaround Time = Total Turnaround Time / Number of Processes
Completion:Completion: Scheduling concludes after executing all processes.
Read More.....
Shortest Job First (SJF)
Shortest Job First (SJF) selects and executes the process with the smallest burst time from the ready queue, minimizing waiting time. In preemptive SJF, the queue is sorted, and the current process may be preempted for a shorter job. Repeat until all processes complete.
Steps of Execution of SJF Algorithm
Arrival of Processes:As processes arrive in the system, they are added to the ready queue.
Sorting Ready Queue In the case of preemptive SJF, the ready queue is sorted based on the burst times of the processes in ascending order. This ensures that the process with the shortest remaining burst time is at the front of the queue.
Process Execution:The scheduler selects the process with the shortest burst time from the ready queue to execute. In preemptive SJF, this may involve preempting the currently running process if a new process with a shorter burst time arrives.
Execution of Processes:The selected process is allowed to execute for its burst time. If it's preemptive SJF, the process may be interrupted if a shorter job arrives during its execution.
Updating Waiting Times:The waiting times of the other processes in the ready queue are updated based on the time the selected process spends executing.
Completion of Process: Once a process completes its execution, it is removed from the system, and the scheduler selects the next process from the ready queue.
Repeat Steps: Steps 3 to 6 are repeated until all processes are completed.
Read more...
Shortest Remaining Time First (SRTF)
Shortest remaining job first also called the shortest remaining time first is the preemptive version of the shortest job first scheduling algorithm. In the shortest remaining job first, the process with the smallest runtime to complete (i.e remaining time) is scheduled to run next, In SRJF, a running process will be preempted if a new process arrives in the CPU scheduler which requires less burst time for execution.
Priority Scheduling
In Priority scheduling, there is a priority number assigned to each process. In some systems, the lower the number, the higher the priority. While, in the ot hers, the higher the number, the higher will be the priority. The Process with the higher priority among the available processes is given the CPU. There are two types of priority scheduling algorithm exists. One is Preemptive priority scheduling while th e other is Non Preemptive Priority scheduling.The priority number assigned to each of the process may or may not vary. If the priority number doesn't change itself throughout the process, it is called static priority, while if it keeps changing itself at the regular intervals, it is called dynamic priority.
Longest Job First (LJF)
Longest Job First (LJF) is a non-preemptive scheduling algorithm. This algorithm is based on the burst time of the processes. The processes are put into the ready queue based on their burst times i.e., in descending order of the burst times. As the name suggests this algorithm is based on the fact that the process with the largest burst time is processed first. The burst time of only those processes is considered that have arrived in the system until that time. Its preemptive version is called Longest Remaining Time
Longest Remaining Time First (LRTF)
Prerequisite – Process Management & CPU Scheduling This is a pre-emptive version of Longest Job First (LJF) scheduling algorithm. In this scheduling algorithm, we find the process with the maximum remaining time and then process it. We check for the maximum remaining time after some interval of time(say 1 unit each) to check if another process having more Burst Time arrived up to that time.
Round Robin Scheduling
Round Robin is the preemptive process scheduling algorithm. Each process is provided a fix time to execute, it is called a quantum. Once a process is executed for a given time period, it is preempted and other process executes for a given time period. Context switching is used to save states of preempted processes.