Introduction to CPU Scheduling
CPU scheduling is very necessary in the case of multiprocessor systems. when there are multiple processes to execute, the processor cannot wait until the process is complete. it needs to switch between the processes simultaneously so that the response time of your computer will be high.
CPU should not be kept idle. It should execute one of the processes in the queue, in order to decrease the waiting time and increase the user experience.
The scheduling process is carried out by a short-term scheduler, it picks one of the processes that are in the queue and is waiting. The processes are in the order of priority of FIFO queue, Priority Queue, or any other queuing mechanisms. the important function of the scheduler is to carry out the higher priority process quickly as possible without wasting the time of the CPU in idleness.
In the case of preemptive scheduling, the scheduler has the capability to switch the CPU to another process when any interrupt occur. this type of scheduler does/ does not wait until the process completes its execution. In the case of preemptive scheduling, there is no guarantee that the current process will finish the execution.
On the contrary, non-preemptive scheduler waits until the current process is terminated. Only once the process is terminated, CPU is allowed to switch to another process ready in the queue.
There are three main units of measurement of time in case of scheduling. Turnaround time, waiting time and response time.
Turnaround time refers to the time that CPU spent in executing a process including IO requests and waiting time.
Waiting time refers to the time, the processes spent waiting for the CPU to switch to it, in the ready queue.
At last, response time is the time taken by the process to produce and output or to produce and desired result.
There are different types of scheduling like CPU Scheduling like:
I will discuss these types of CPU scheduling in my next blog post.
CPU should not be kept idle. It should execute one of the processes in the queue, in order to decrease the waiting time and increase the user experience.
The scheduling process is carried out by a short-term scheduler, it picks one of the processes that are in the queue and is waiting. The processes are in the order of priority of FIFO queue, Priority Queue, or any other queuing mechanisms. the important function of the scheduler is to carry out the higher priority process quickly as possible without wasting the time of the CPU in idleness.
Types of scheduling
In an Operating System, there are two types of scheduling. One is preemptive and the other is non-preemptive scheduling.In the case of preemptive scheduling, the scheduler has the capability to switch the CPU to another process when any interrupt occur. this type of scheduler does/ does not wait until the process completes its execution. In the case of preemptive scheduling, there is no guarantee that the current process will finish the execution.
On the contrary, non-preemptive scheduler waits until the current process is terminated. Only once the process is terminated, CPU is allowed to switch to another process ready in the queue.
There are three main units of measurement of time in case of scheduling. Turnaround time, waiting time and response time.
Turnaround time refers to the time that CPU spent in executing a process including IO requests and waiting time.
Waiting time refers to the time, the processes spent waiting for the CPU to switch to it, in the ready queue.
At last, response time is the time taken by the process to produce and output or to produce and desired result.
There are different types of scheduling like CPU Scheduling like:
- Multilevel Feedback Queue Scheduling
- Multilevel Queue Scheduling
- Round-Robin Scheduling
- Priority Scheduling
- Shortest-Job-First Scheduling
- First-Come, First-Served Scheduling
I will discuss these types of CPU scheduling in my next blog post.