What is CPU Scheduling?

CPU Scheduling is a process of determining which process will own CPU for execution while another process is on hold. The main task of CPU scheduling is to make sure that whenever the CPU remains idle, the OS at least select one of the processes available in the ready queue for execution. The selection process will be carried out by the CPU scheduler. It selects one of the processes in memory that are ready for execution.

Types of CPU Scheduling Algorithms-

1. Preemptive - Preemptive scheduling is used when a process switches from running state to ready state or from the waiting state to the ready state.

2. Non-preemptive - Non-Preemptive scheduling is used when a process terminates , or when a process switches from running state to waiting state.