Process Scheduling in Operating System (OS)
What is Process scheduling in Operating System
The decision to move different parallel processes competing with one another for execution, to different states like Ready to running or running to exit state based on a certain decision strategy.
Handled by – Process Manager
Why CPU Scheduling?
One or more processes may be in the running state at the same time and they all share the CPU time using multiplexing.
Focus for Intelligent Scheduling is to –
- Keep CPU busy as much as possible if processes are waiting for execution
- Decrease the time of execution of critical processes
- Intelligently prioritise processes for execution
- Keep the response time minimum.
Types of Process Scheduling
We divided Process Scheduling into following two
- Preemptive Scheduling –The scheduling in which a running process can be interrupted if a high priority process enters the queue and is allocated to the CPU is called preemptive scheduling. In this case, the current process switches from the running queue to ready queue and the high priority process utilizes the CPU cycle.
- Non Preemptive Scheduling – The scheduling in which a running process cannot be interrupted by any other process is called non-preemptive scheduling. Any other process which enters the queue has to wait until the current process finishes its CPU cycle
Meaning of Prempt – take action in order to prevent (an anticipated event) happening; forestall.
Process Scheduling Queues
There are the following types of queues –
- Job Queue – Whenever any process enters the system its there in job Queue
- Ready Queue – Processes in the ready queue waiting for run time are in the ready queue.
- Device Queue – Some processes may be waiting some I/O operation, such processes are in the device queue.
Different Types of Schedulers
There are three type of schedulers categorically –
- Long-term Scheduler
- Short-term Scheduler
- Medium-term Scheduler
Long Term Scheduler
Also knowns as Job 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.
Also knowns as CPU 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 utilisation of main memory.
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.
A context switch is a procedure that a computer’s CPU (central processing unit) follows to change from one task (or process) to another while ensuring that the tasks do not conflict. Effective context switching is critical if a computer is to provide user-friendly multitasking.
- Process (Intro)
- Process Life Cycle
- Process Control Block PCB
- Process Scheduling
- Context Switching
- CPU Scheduling
- FCFS Scheduling
- Shortest Job First (or SJF) scheduling – non-preemptive
- Shortest Job First (or SJF) scheduling – preemptive (SRTF)
- Round Robin scheduling
- Priority Scheduling
- Convoy Effect
- Difference between Scheduler and Dispatcher
- Preemptive scheduling vs Non Preemptive scheduling
- Preemptive scheduling
- Non preemptive scheduling