CPU scheduling is the mechanism of deciding which process will hold the CPU for execution while other process is on wait. A scheduling algorithm is a way of selecting a process from a ready queue and putting it in the CPU. The main function of CPU scheduling is to make assure that when the CPU is inactive, the operating system at least picks one process present in the ready queue for execution.
Scheduling of processes is effective for completing the task on time. The goal of scheduling is to make the system competent, fast, and tolerable. The selection of processes is managed by the short-term scheduler. The scheduler picks the process which is ready to run and assigns the CPU to one of them.
There are two types of Scheduling algorithms
If we took out a process from RAM and placed in running queue, then we can stop that process from executing and place again in ready queue. So, that it will execute in future. This is known as preemptive.
Non preemptive means that if we took out a process from ready queue and gave to CPU to get it executed then that process will get fully executed. In this case we can’t stop the processes from the executions.