NON-PREEMPTIVE SHORTEST JOB FIRST SCHEDULING ALGORITHM OS

Опубликовано: 25 Март 2026
на канале: Code Net
29
1

Non-Preemptive Shortest Job First (NPSJF) scheduling algorithm is a type of CPU scheduling algorithm used by operating systems to determine the order in which processes are executed on a CPU.

In NPSJF scheduling algorithm, the CPU executes the process with the shortest execution time first. However, unlike PSJF, once a process is assigned to the CPU, it is not interrupted by another process, even if a shorter process arrives. The algorithm works by sorting the processes in the ready queue by their execution times, and the process with the shortest execution time is selected for execution.

The NPSJF algorithm also reduces the average waiting time for processes compared to the FCFS and SJF algorithms. However, it requires the operating system to have information about the length of each process's execution time, which may not always be available.

One of the main advantages of the NPSJF scheduling algorithm is that it minimizes the average waiting time and turnaround time of processes, which results in better system performance. However, the algorithm can also cause problems such as starvation, where long-running processes may never get a chance to execute if shorter processes continue to arrive.

Overall, the NPSJF scheduling algorithm is a useful tool for improving the performance of operating systems, particularly in scenarios where the arrival rate and execution times of processes are known and preemption is not desired or practical