×

Operating System Tutorial

Operating System Practice

Process Scheduling in Operating System

In this tutorial, we will learn how an operating system schedules the different processes of computer system, different criteria used by operating system to schedule computer system, different types of schedulers. By Amit Shukla Last updated : May 06, 2023

What is Process Scheduling in Operating System?

Process scheduling is a task of operating system to schedules the processes of different states like ready, running, waiting. To study about process states you can refer Process Management in Operating Systems according to their priorities. This task is very useful in maintain the computer system. Process scheduling allocates the time interval of each process in which the process is to be executed by the central processing unit (CPU).

Process scheduling is very important in multiprogramming and multitasking operating system, where multiple processes execute simultaneously. To study about multiprogramming and multitasking operating system you can refer O.S. and Its types Process scheduling ensures maximum utilization of central processing unit (CPU) because a process is always running at the specific instance of time. At first, the process that are to be executed are placed in a queue called Job queue. The processes which are already placed in the main memory and are ready for CPU allocation, are placed in a queue called Ready queue.If the process is waiting for input / output, then that process is placed in the queue called Device queue.

What are the types of schedulers?

An operating system uses a program scheduler to schedules the processes of computer system. The schedulers are of following types:

  1. Long-term Scheduler
  2. Mid-term Scheduler
  3. Short-term Scheduler

1. Long-term Scheduler

It selects the process that are to be placed in ready queue. The long term scheduler basically decides the priority in which processes must be placed in main memory. Processes of long term scheduler are placed in the ready state because in this state the process is ready to execute waiting for calls of execution from CPU which takes time that’s why this is known as long term scheduler.

2. Mid-term Scheduler

It places the blocked and suspended processes in the secondary memory of a computer system. The task of moving from main memory to secondary memory is called swapping out.The task of moving back a swapped out process from secondary memory to main memory is known as swapping in. The swapping of processes is performed to ensure the best utilization of main memory.

3. Short-term Scheduler

It decides the priority in which processes is in the ready queue are allocated the central processing unit (CPU) time for their execution. The short term scheduler is also referred as central processing unit (CPU) scheduler.

What are the types of schedule process execution?

An operating system uses two types of scheduling processes execution, preemptive and non-preemptive.

1. Preemptive process

In preemptive scheduling policy, a low priority process has to be suspend its execution if high priority process is waiting in the same queue for its execution.

2. Non-preemptive process

In non-preemptive scheduling policy, processes are executed in first come first serve basis, which means the next process is executed only when currently running process finishes its execution.

What are the scheduling process algorithms?

Operating system performs the task of scheduling processes based on priorities using these following algorithms:

1. First come first serve (FCFS)

In this scheduling algorithm the first process entered in queue is processed first.

2. Shortest job first (SJF)

In this scheduling algorithm the first process entered in queue is processed first.

3. Shortest Remaining Time First (SRTF) scheduling

This scheduling Algorithm is the preemptive version of the SJF scheduling algorithm. In this, the process which is left with the least processing time is executed first.

4. Longest Job First (LJF)

In this type of scheduling algorithm, the process with the maximum time required to execute is scheduled first. In this type of scheduling is not widely used because it is not a very effective way of scheduling, as the average turn-around time and the average waiting time are maximum in this case.

5. Longest Remaining Time First (LRTF)

As SRTF is to SJF, LRTF is the preemptive version of the LJF scheduling algorithm.

6. Priority scheduling

In this scheduling algorithm the priority is assigned to all the processes and the process with highest priority executed first. Priority assignment of processes is done on the basis of internal factor such as CPU and memory requirements or external factor such as user’s choice. The priority scheduling algorithm supports preemptive and non - preemptive scheduling policy.

7. Round Robin (RR) scheduling

In this algorithm the process is allocated the CPU for the specific time period called time slice, which is normally of 10 to 100 milliseconds. If the process completes its execution within this time slice, then it is removed from the queue otherwise it has to wait for another time slice.




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.