Home » Operating Systems

Process scheduling in operating system

Learn : In this article we will study about how an operating system schedules the different processes of computer system? What are the different criteria’s used by operating system to schedule computer system? What are the different types of schedulers used by operating system to schedule different processes of computer system? We will understand the functions of first come first serve, shortest job first, and round robin scheduling.
Submitted by Amit Shukla, on July 28, 2017

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 Introduction of 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.

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.

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.

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 process which requires shortest CPU time to execute is processed first.

3. 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.

4. 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

Ad: Are you a blogger? Join our Blogging forum.



Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing » Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.