Home » Operating Systems

Process classification and scheduling in Operating System

In this article, we will learn about the classification of the process and also discuss about how the process in scheduled in the operating system.
Submitted by Prerana Jain, on November 19, 2018


In the operating system, there are numerous task and application program run simultaneously. A program is stored in the hard disk or any other form of secondary storage. When the program is executed it must be loaded in the system’s memory. A process can be viewed as a program in execution. In the system, each process is assigned a unique Id when it is created and it will be referenced by the unique Id until the process completes execution and it is terminated. A process is an entity which performs the basic unit of work or one work at a time. We can say that a process is an instance of a computer program that is being executed. A process contains the program code and the activity that is going to be performed. when the computer program is in secondary memory then it is a passive entity or when a process is in main memory then it is an active entity. In the system, several processes may be associated with the same program.

A process held a number of attributes like hardware, memory, CPU, and progress.

Process classification

A process can be broadly categorized into the following two types based on its execution:

  • I/O-Bound process
    An I/O-bound process is a process whose execution time is determined mainly by the amount of time it spends completing I/O operations.
  • CPU-Bound process
    A CPU-bound process is a process whose execution time is determined by the speed of the CPU it runs on. A CPU-bound process can complete its execution faster if it is running on a faster processor.
    Note: There is a third category - Memory-bound process. However, since RAM serves as I/O for the processor, this can be considered as an instance of the I/O-bound process type.

Further a process can be broadly categorized into the following two types based on execution mode.

Kernel mode: In the kernel mode, a process has unrestricted access to the system hardware it can execute privileges instruction and can access both user and kernel address space.

Example: Most of the device drivers in the system execute as kernel mode processes.

User mode: In the user mode it has no direct access to the underlying system hardware it can only access its own user address space of other processes and it cannot execute privileged instructions.

Example: web- browser is executed as a user- mode process.

Process scheduling

On a computer system, there are often numerous processes that need to be executed simultaneously. Furthermore, the requests for resources necessary for their execution are made asynchronously. Therefore, to handle competing requests for resources including the processor, the OS employs a process scheduler. The process scheduler assigns each process the necessary resources and its turn for execution on the CPU. The decision to schedule a process is made by a scheduling algorithm. The scheduler maintains three queues, to schedule the processes.

Job queue: The job queue is the set of all processes on the system.

Ready queue: The ready queue has all the processes that are loaded in main memory. These processes are ready and waiting for their turn to execute as soon as the CPU becomes available.

Device queue: The set of processes waiting for an I/O device to become available, such as a printer. This queue is also known as the Blocked Queue.

Process classification and scheduling in Operating System

Process Execution

When a program is loaded into the memory (process memory) and it becomes a process and it can be divided into four sections, stack, heap, text and data.

Stack: The stack is used for local variables when the local variables are declared in the memory of some spaces on the stack is reserved for them.

Heap: The heap is used in the system for the dynamic memory allocation and it is managed by calls to new, delete, malloc, free like commands.

Data section: The data section is made for of the global and the static variables when it is allocated and initialized prior to executing the main function.

Text section: The text section is made for the compiled program code when the program is launched it is read from non-volatile storage in the system.

Process states

When a process starts its execution it changes its states or goes through the various states. We can define a process states in parts by the current activity of that process. Each process may be in one or more in the states when it is executing.

  1. New
    A process is in the new states when it is newly created in the system.
  2. Ready
    When the process is created it move to the ready state and in this state, the process is ready for their execution.
  3. Run
    A process in the running state when it is currently running process in the CPU. At a time only one process can be under execution in a single processor.
  4. Wait or block
    When the process is executed for I/O it moves to the wait or block state.
  5. Terminated or completed
    When the process completed its execution it enters into the terminated state. In this states, all the changes made by the process permanently save on the memory.
  6. Suspended ready
    When the ready queue is full some process move to the suspend ready state so that there is no load on the ready queue.
  7. Suspended block
    When the waiting queue is full some processes move to the suspend ready state so that there is no load on the block state.

A process is not itself a process it is actually a passive entity so its content is stored in the hard disk whereas a running process is a passive entity so the program counter counts the next instruction to be executed. In the system, two processes may be linked with the same program and these process cannot be considered as two separate processes. For any instances, many users may be running at the main program.



Comments and Discussions



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

© some rights reserved.