Process Scheduling is an OS task that schedules processes of different states like ready, waiting, and running.
Process scheduling allows OS to allocate a time interval of CPU execution for each process. Another important reason for using a process scheduling system is that it keeps the CPU busy all the time. This allows you to get the minimum response time for programs.
In this process scheduling tutorial, you will learn:
- What is Process Scheduling?
- Process Scheduling Queues
- Two State Process Model
- Scheduling Objectives
- Type of Process Schedulers
- Long Term Scheduler
- Medium Term Scheduler
- Short Term Scheduler
- Difference between Schedulers
- What is Context switch?
Process Scheduling Queues help you to maintain a distinct queue for each and every process states and PCBs. All the process of the same execution state are placed in the same queue. Therefore, whenever the state of a process is modified, its PCB needs to be unlinked from its existing queue, which moves back to the new state queue.
Three types of operating system queues are:
- Job queue – It helps you to store all the processes in the system.
- Ready queue – This type of queue helps you to set every process residing in the main memory, which is ready and waiting to execute.
- Device queues – It is a process that is blocked because of the absence of an I/O device.
In the above-given Diagram,
- Rectangle represents a queue.
- Circle denotes the resource
- Arrow indicates the flow of the process.
- Every new process first put in the Ready queue .It waits in the ready queue until it is finally processed for execution. Here, the new process is put in the ready queue and wait until it is selected for execution or it is dispatched.
- One of the processes is allocated the CPU and it is executing
- The process should issue an I/O request
- Then, it should be placed in the I/O queue.
- The process should create a new subprocess
- The process should be waiting for its termination.
- It should remove forcefully from the CPU, as a result interrupt. Once interrupt is completed, it should be sent back to ready queue.
Two-state process models are:
- Not Running
In the Operating system, whenever a new process is built, it is entered into the system, which should be running.
The process that are not running are kept in a queue, which is waiting for their turn to execute. Each entry in the queue is a point to a specific process.
Here, are important objectives of Process scheduling
- Maximize the number of interactive users within acceptable response times.
- Achieve a balance between response and utilization.
- Avoid indefinite postponement and enforce priorities.
- It also should give reference to the processes holding the key resources.
A scheduler is a type of system software that allows you to handle process scheduling.
There are mainly three types of Process Schedulers:
- Long Term
- Short Term
- Medium Term
Long term scheduler is also known as a job scheduler. This scheduler regulates the program and select process from the queue and loads them into memory for execution. It also regulates the degree of multi-programing.
However, the main goal of this type of scheduler is to offer a balanced mix of jobs, like Processor, I/O jobs., that allows managing multiprogramming.
Medium-term scheduling is an important part of swapping. It enables you to handle the swapped out-processes. In this scheduler, a running process can become suspended, which makes an I/O request.
A running process can become suspended if it makes an I/O request. A suspended processes can’t make any progress towards completion. In order to remove the process from memory and make space for other processes, the suspended process should be moved to secondary storage.
Short term scheduling is also known as CPU scheduler. The main goal of this scheduler is to boost the system performance according to set criteria. This helps you to select from a group of processes that are ready to execute and allocates CPU to one of them. The dispatcher gives control of the CPU to the process selected by the short term scheduler.
Long-Term Vs. Short Term Vs. Medium-Term
|Long term is also known as a job scheduler||Short term is also known as CPU scheduler||Medium-term is also called swapping scheduler.|
|It is either absent or minimal in a time-sharing system.||It is insignificant in the time-sharing order.||This scheduler is an element of Time-sharing systems.|
|Speed is less compared to the short term scheduler.||Speed is the fastest compared to the short-term and medium-term scheduler.||It offers medium speed.|
|Allow you to select processes from the loads and pool back into the memory||It only selects processes that is in a ready state of the execution.||It helps you to send process back to memory.|
|Offers full control||Offers less control||Reduce the level of multiprogramming.|
It is a method to store/restore the state or of a CPU in PCB. So that process execution can be resumed from the same point at a later time. The context switching method is important for multitasking OS.
- Process scheduling is an OS task that schedules the processes of different states like ready, waiting, and running.
- Two-state process models are 1) Running, and )Not Running
- Process scheduling maximizes the number of interactive users, within acceptable response times.
- A scheduler is a type of system software that allows you to handle process scheduling.
- Three types of the scheduler are 1) Long term 2) Short term 3) Medium-term
- Long term scheduler regulates the program and select process from the queue and loads them into memory for execution.
- The medium-term scheduler enables you to handle the swapped out-processes.
- The main goal of short term scheduler is to boost the system performance according to set criteria
- Long term is also known as a job scheduler, whereas the short term is also known as CPU scheduler, and the medium-term is also called swapping scheduler.