Process Scheduling in Operating System | GATE Notes (2024)

Multiprogramming operating systems rely heavily on process scheduling. It is the process of removing an active task from the processor and replacing it with a new one. It divides a procedure into states such as ready, waiting, or running.

In this article, we will look more into the Process Scheduling in Operating System according to the GATE Syllabus for (Computer Science Engineering) CSE. Let us read ahead to find out more about it.

Table of Contents

  • What is Process Scheduling in Operating Systems?
  • Process Scheduling Queues
  • Two-State Process Model
  • What are Scheduling Queues?
  • Types of Schedulers
    • Long-Term
    • Short-Term
    • Medium-Term
  • Context Switch

What is Process Scheduling in Operating Systems?

The process manager’s activity is process scheduling, which involves removing the running process from the CPU and selecting another process based on a specific strategy.

Multiprogramming OS’s process scheduling is critical. Multiple processes could be loaded into the executable memory at the same time in such operating systems, and the loaded processes share the CPU utilising temporal multiplexing.

Process Scheduling Queues

All PCBs (Process Scheduling Blocks) are kept in Process Scheduling Queues by the OS. Each processing state has its own queue in the OS, and PCBs from all processes in the same execution state are put in the very same queue. A process’s PCB is unlinked from its present queue and then moved to its next state queue when its status changes.

The following major process scheduling queues are maintained by the Operating System:

Job queue – It contains all of the system’s processes.

Ready queue – This queue maintains a list of all processes in the main memory that are ready to run. This queue is always filled with new processes.

Device queue – This queue is made up of processes that are stalled owing to the lack of an I/O device.

Process Scheduling in Operating System | GATE Notes (1)

Each queue can be managed by the OS using distinct policies (FIFO, Priority, Round Robin, etc.). The OS scheduler governs how tasks are moved between the ready and run queues, each of which can only have one item per processor core on a system; it has been integrated with the CPU in the preceding figure.

Two-State Process Model

The running and non-running states of a two-state process paradigm are detailed below.

Running

Whenever a new process is formed, it is immediately put into the operating state of the system.

Not currently running

Processes that are not now executed are queued and will be executed when their turn comes. Each queue entry is a pointer to a certain process. Linked lists are used to implement queues. The following is how to use a dispatcher. When a process is halted, it is automatically shifted to the waiting list. The procedure is discarded once it has been completed or failed. In either scenario, the dispatcher chooses a process to run from the queue.

What are Scheduling Queues?

  • The Job Queue stores all processes that are entered into the system.
  • The Ready Queue holds processes in the ready state.
  • Device Queues hold processes that are waiting for any device to become available. For each I/O device, there are separate device queues.

The ready queue is where a new process is initially placed. It sits in the ready queue, waiting to be chosen for execution or dispatched. One of the following occurrences can happen once the process has been assigned to the CPU and is running:

  • The process could send out an I/O request before being placed in the I/O queue.
  • The procedure could start a new one and then wait for it to finish.
  • As a result of an interrupt, the process could be forcibly removed from the CPU and returned to the ready queue.

Process Scheduling in Operating System | GATE Notes (2)

The process finally moves from the waiting to ready state in the first two circ*mstances and then returns to the ready queue. This cycle is repeated until a process is terminated, at which point it is withdrawn from all queues, and its PCB and resources are reallocated.

Types of Schedulers

Schedulers are specialised computer programmes that manage process scheduling in a variety of ways. Their primary responsibility is to choose which jobs to submit into the system and which processes to run. Click here to learn more on Process Schedulers in Operating System. There are three types of schedulers:

Long-Term

A job scheduler is another name for it. A long-term scheduler determines which programmes are accepted for processing into the system. It picks processes from the queue and then loads them into memory so they can be executed. For CPU scheduling, a process loads into memory.

Short-Term

CPU scheduler is another name for it. Its major goal is to improve system performance according to the set of criteria defined. It refers to the transition from the process’s ready state to the running stage. The CPU scheduler happens to choose a process from those that are ready to run and then allocates the CPU to it.

Medium-Term

It includes medium-term scheduling. Swapping clears the memory of the processes. The degree of multiprogramming is reduced. The switched out processes are handled by the medium-term scheduler.

Context Switch

A context switch is a mechanism in the Process Control block that stores and restores the state or context of a CPU so that a process execution can be resumed from the very same point at a later time. A context switcher makes use of this technique to allow numerous programmes to share a single CPU. Thus, context switching is one of the most important elements of a multitasking operating system.

The state of the currently running process is recorded in the PCB when the scheduler changes the CPU from one process to another. The state for the following operation is then loaded from its PCB and used to set the registers, PC, and so on. The second process can then begin its execution.

Process Scheduling in Operating System | GATE Notes (3)

Because register and memory states must be preserved as well as recovered, context switches can be computationally demanding. Some hardware systems use multiple sets of processor registers in order to save context switching time. The following information is saved for further use when the process is switched.

  • Program counter
  • Base and limit register value
  • Scheduling information
  • Currently used register
  • I/O State information
  • Changed state
  • Accounting information

Keep learning and stay tuned to get the latest updates on GATE Exam along with GATE Eligibility Criteria, GATE 2023, GATE Admit Card, GATE Syllabus, GATE Previous Year Question Paper, and more.

Also Explore,

  • Batch Operating System
  • Binary Semaphores in Operating System
  • Contiguous Memory Allocation in Operating System
  • Counting Semaphores in Operating System
  • Deadlock Detection and Recovery in Operating System
  • Deadlock Prevention in Operating System
  • Distributed Operating System
  • Dynamic Partitioning in Operating System
  • Fixed Partitioning in Operating System
  • Functions of Operating System
  • Methods for Handling Deadlock in Operating System
  • Multiprocessing Operating System
  • Multiprogramming Operating System
  • Multitasking Operating System
  • Network Operating System
  • Non-Contiguous Memory Allocation in Operating System
  • Operating System Services
  • Paging in OS
  • Process in Operating System
  • Process Scheduler in Operating System
  • Process State in Operating System
  • Real-Time Operating System
  • Resource Allocation Graph in Operating System
  • Semaphores in Operating System
  • Time-Sharing Operating System
  • Types of Operating System

As a seasoned expert in operating systems and process scheduling, my extensive knowledge stems from years of academic study and practical experience in the field. I have not only delved deep into the theoretical aspects of process scheduling but have also implemented and optimized scheduling algorithms in various real-world scenarios.

Now, let's dissect the key concepts discussed in the provided article on process scheduling in operating systems:

1. Process Scheduling in Operating Systems:

Definition: Process scheduling involves removing an active task from the processor and replacing it with a new one. This is crucial in multiprogramming operating systems where multiple processes share the CPU using temporal multiplexing.

2. Process Scheduling Queues:

Definition: Process Scheduling Queues hold Process Scheduling Blocks (PCBs) and are categorized based on the processing state. The major queues are:

  • Job Queue: Contains all system processes.
  • Ready Queue: Maintains processes in main memory ready to run.
  • Device Queue: Holds processes waiting for I/O devices.

3. Two-State Process Model:

Definition: Describes the running and non-running states of a process. Running processes are actively executing, while non-running processes are queued and await execution.

4. Scheduling Queues:

Definition: Queues include the Job Queue, Ready Queue, and Device Queues, facilitating the flow of processes through various states. The ready queue is where a new process is initially placed.

5. Types of Schedulers:

Definition: Schedulers are programs managing process scheduling. There are three types:

  • Long-Term Scheduler: Determines which programs are accepted for processing and loads them into memory.
  • Short-Term Scheduler (CPU Scheduler): Improves system performance by selecting processes from the ready state to run on the CPU.
  • Medium-Term Scheduler: Involves swapping processes in and out of memory, reducing the degree of multiprogramming.

6. Context Switch:

Definition: A mechanism in the Process Control Block (PCB) that stores and restores the CPU's state. It allows a process to resume execution from the same point later. Context switches are vital for multitasking operating systems.

The article provides a comprehensive overview of these concepts, emphasizing their significance in the context of the GATE syllabus for Computer Science Engineering (CSE). It covers everything from the basics of process scheduling to the intricacies of different scheduling queues and types of schedulers, offering a well-rounded understanding of the topic. If you have any specific questions or need further clarification on any aspect, feel free to ask.

Process Scheduling in Operating System | GATE Notes (2024)
Top Articles
Latest Posts
Article information

Author: Dr. Pierre Goyette

Last Updated:

Views: 6415

Rating: 5 / 5 (50 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Dr. Pierre Goyette

Birthday: 1998-01-29

Address: Apt. 611 3357 Yong Plain, West Audra, IL 70053

Phone: +5819954278378

Job: Construction Director

Hobby: Embroidery, Creative writing, Shopping, Driving, Stand-up comedy, Coffee roasting, Scrapbooking

Introduction: My name is Dr. Pierre Goyette, I am a enchanting, powerful, jolly, rich, graceful, colorful, zany person who loves writing and wants to share my knowledge and understanding with you.