Operating System Tutorial

Operating System Tutorial Types of Operating System Evolution of Operating System Functions of Operating System Operating System Properties Operating System Services Components of Operating System Needs of the Operating System

Operating Systems

Linux Operating System Unix Operating System Ubuntu Operating System Chrome Operating Systems Fedora Operating System MAC Operating System MS Windows Operating System Solaris Operating System Cooperative Operating System CorelDRAW Operating System CentOS FreeBSD Operating Systems Batch Operating System MS-DOS Operating System Commercial Mobile Operating Systems

Differences

Difference Between Multi-programming and Multitasking Difference between C-LOOK and C-SCAN Difference between Rotational Latency and Disk Assess Time Trap vs Interrupt Difference between C-SCAN and SSTF Difference between SCAN and FCFS Difference between Seek Time and Disk Access Time Difference between SSTF and LOOK Difference between Process and Program in the Operating System Difference between Protection and Security in Operating System

How To

How to implement Monitors using Semaphores How to Install a Different Operating System on a PC

Questions

What is Kernel and Types of Kernel What is DOS Operating System What is Thread and Types of Thread What is Process Scheduler and Process Queue What is Context Switching What is CPU Scheduling What is Producer-Consumer Problem What is Semaphore in Operating System Monitors in Operating System What is Deadlock What is Paging and Segmentation What is Demand Paging What is Virtual Memory What is a Long term Scheduler What is Page Replacement in Operating System What is BSR Mode What is Convoy Effect What is Job Sequencing in Operating System Why is it critical for the Scheduler to distinguish between I/O-bound and CPU-bound programs Why is there a Need for an Operating System

Misc

Process Management Process State Scheduling Algorithm FCFS (First-come-First-Serve) Scheduling SJF (Shortest Job First) Scheduling Round-Robin CPU Scheduling Priority Based Scheduling HRRN (Highest Response Ratio Next) Scheduling Process Synchronization Lock Variable Mechanism TSL Mechanism Turn Variable Mechanism Interested Variable Mechanism Deadlock Avoidance Strategies for Handling Deadlock Deadlock Prevention Deadlock Detection and Recovery Resource Allocation Graph Banker’s Algorithm in Operating System Fixed Partitioning and Dynamic Partitioning Partitioning Algorithms Disk Scheduling Algorithms FCFS and SSTF Disk Scheduling Algorithm SCAN and C-SCAN Disk Scheduling Algorithm Look and C-Look Disk Scheduling Algorithm File in Operating System File Access Methods in Operating System File Allocation Method Directory Structure in Operating System N-Step-SCAN Disk Scheduling Feedback Queue in Operating System Contiguous Memory Allocation in Operating System Real-time Operating System Starvation in Operating System Thrashing in Operating System 5 Goals of Operating System Advantages of Operating System Advantages of UNIX Operating System Bit Vector in Operating System Booting Process in Operating System Can a Computer Run Without the Operating System Dining Philosophers Problem in Operating System Free Space Management in Operating System Inter Process Communication in Operating System Swapping in Operating System Memory Management in Operating System Multiprogramming Operating System Multitasking Operating Systems Multi-user Operating Systems Non-Contiguous Memory Allocation in Operating System Page Table in Operating System Process Scheduling in Operating System Segmentation in Operating System Simple Structure in Operating System Single-User Operating System Two Phase Locking Protocol Advantages and Disadvantages of Operating System Arithmetic operations in binary number system Assemblers in the operating system Bakery Algorithm in Operating System Benefits of Ubuntu Operating System CPU Scheduling Criteria in Operating System Critical Section in Operating System Device Management in Operating System Linux Scheduler in Operating System Long Term Scheduler in Operating System Mutex in Operating System Operating System Failure Peterson\'s Solution in Operating System Privileged and Non-Privileged Instructions in Operating System Swapping in Operating System Types of Operating System Zombie and Orphan Process in Operating System 62-bit operating system Advantages and Disadvantages of Batch Operating System Boot Block and Bad Block in Operating System Contiguous and Non - Contiguous Memory Allocation in Operating System Control and Distribution Systems in Operations Management Control Program in Operating System Convergent Technologies in Operating System Convoy Effect in Operating System Copy Operating Systems to SSD Core Components of Operating System Core of UNIX Operating System Correct Value to return to the Operating System Corrupted Operating System Cos is Smart Card Operating System Cosmos Operating Systems Examples Generation of Operating System Hardware Solution in Operating System Process Control Block in Operating System Function of Kernel in Operating System Operating System Layers History of Debian Operating Systems Branches and Architecture of Debian Operating Systems Features and Packages of Debian Operating Systems Installation of Operating System on a New PC Organizational Structure and Development in Debian Operating Systems User Interface in Operating System Types Of Memory in OS Operating System in Nokia Multilevel Paging in OS Memory Mapping Techniques in OS Memory Layout of a Process in Operating System Hardware Protection in Operating System Functions of File Management in Operating System Core of Linux Operating System Cache Replacement Policy in Operating System Cache Line and Cache Size in Operating System Kernel I/O Subsystem Security Management in Operating System Bare Machine in Operating System Mutual Exclusion in Operating system Cycle Stealing in the Operating System Cost and Support for the User Operating System Assembly operating system Course Objectives and Outcomes of Operating System Cost of Windows 7 Operating System Cost of UNIX Operating System Cots Operating System Cost of Windows 10 Operating System Artificial Intelligence Operating System Download Artificial intelligence assistant operating system AROS Research Operating System Deadlock Detection in Distributed Systems Process Management in Operating System (OS) Robotics Operating System SSD Caching Tails Operating System Computer Assisted Coding System (CACS) Disk Operating System File Management in Operating System What is the Importance of Operating Systems? Kernel Data Structure Operating System Security All Dos Commands with Explanation Lineage OS Symbian OS Bharat OS ChromeOS Flex Clustered operating system Concurrency in Operating System Monolithic structure in the operating system Oxygen Operating System System calls in the operating system (OS) System program in OS Application Programs in OS Shared Devices in Operating Systems Address Binding in the Operating System Disk Controller in the Operating System Dual-mode Operations in the Operating System Multilevel Queue Scheduling in Operating System Pixel OS POP!_OS Spooling in the Operating System Dead Operating System Difference Between Dual Core and Octa Core Processors Kolibri OS Mageia Operating System Operating System Hardening Blade Server in Operating System Classification of Operating System CNK Operating System Difference between FAT32, exFAT, and NTFS File Systems DIFFERENCE BETWEEN PRIORITY INVERSION AND PRIORITY INHERITANCE DUAL MODE OPERATIONS IN OS File Models in Distributed Operating System MICROKERNEL Monolithic Kernel and key differences from Microkernel Multi-Process Operating System Objectives of the Operating System Parallel System in Operating System What is an OLE Object?

Process Management in Operating System (OS)

Process Management in Operating System (OS)

Introduction

Process management is a function of an operating system (OS) that controls the execution and synchronization of several processes within a computer system. It entails managing process lifecycles, allocating system resources, and guaranteeing effective CPU utilization. This article describes process management in an operating system, highlighting its essential components and functions.  Before starting the topic, lets first understand some basic terms used for Process Management.

Crucial Aspects of Process Management in OS

What is Process?

A process can be defined as an instance of a program in execution. Each process has its memory space, program counter, registers, and other relevant information. The OS is responsible for creating, scheduling, and terminating processes. Process creation involves allocating necessary resources, setting up data structures, and initializing the process's context.

Process Scheduling

Process scheduling is a vital aspect of process management. It determines the order in which processes are executed on the CPU. Various scheduling algorithms, such as round-robin, shortest job next, and priority scheduling, allocate CPU time fairly and efficiently among processes. The scheduler selects the next process that will execute next based on predefined characteristics such as priority, execution time, and needs for resources.

Inter-Process Communication (IPC)

IPC mechanisms include shared memory, message passing, pipes, and sockets. These mechanisms facilitate collaboration among processes, allowing them to coordinate their activities effectively.

Process Synchronization

Process synchronization is another critical aspect of process management, and it ensures that multiple processes cooperate without interfering or conflicting with each other. Synchronization mechanisms, such as locks, semaphores, and monitors, enforce mutual exclusion, prevent race conditions, and establish order in accessing shared resources.

Process Suspension and Resumption

Process suspension and resumption are essential functions provided by the OS. A process may be suspended or blocked when waiting for a particular event or resource. Once the event occurs or the resource becomes available, the OS resumes the process, allowing it to continue execution. This mechanism enhances resource utilization and responsiveness.

Process Termination

Process termination is the final stage in the lifecycle of a process. When a process completes its execution or is explicitly terminated by the OS, it undergoes termination. The OS reclaims the resources allocated to the process, updates relevant data structures, and notifies other processes about the termination.

Process Management Cycle

The process management cycle in an operating system consists of several stages, including the "Start", "Ready," "Running", "Waiting", and "Terminated" states. Let's delve into each of these states: 

Process Management in Operating System (OS)
  • Start State:

The "Start" state describes a process's starting state before it begins execution. A process enters the "Start" state when created or called. The operating system initiates the process, allocates resources, and prepares it for execution. 

  • Ready State: 

 The "Ready" state is reached when a process is established or gets ready to run after waiting for a resource or an event. 

The process is loaded into the main memory in the "Ready" state, and its PCB is updated to reflect the state transition. The process is now eligible for execution and awaits its turn to be allocated the CPU by the scheduler. 

  • Running State: 

When a process from the "Ready" state is allocated to the CPU, it enters the "Running" state. In the "Running" stage, the process executes its instructions on the CPU. 

 The operating system supplies the required resources, such as memory and I/O devices, to complete its job. 

The process continues to execute until it either completes its execution, willingly concedes the CPU or is halted by an external event. 

  • Waiting State: 

 A process may meet instances during execution when it must wait on a certain event or resource before proceeding. 

 The procedure enters the "Waiting" stage in such instances. The operating system changes the process's state to "Waiting" and frees up the CPU for other processes to utilize. 

The process is blocked and does not consume CPU time until the desired event or resource becomes available. 

 The process may wait for various reasons, such as I/O operations, synchronization with other processes, or the completion of a particular event. 

  • Terminated State:  

 The "Terminated" state represents the final stage of a process when it has completed its execution or is explicitly terminated by the operating system. 

 When a process finishes executing its instructions or reaches an exit point in its program, it enters the "Terminated" state. The operating system executes cleanup activities, reallocates the process's resources, and releases the PCB and other related data structures.

When a process reaches the "Terminated" stage, it leaves the process management cycle. The "Start" state depicts a process's initial setup before it is ready for execution. The "Terminated" state denotes the conclusion of a process's execution or its termination by the operating system.

The process management cycle involves transitioning processes between these states based on their execution progress, resource availability, and external events. This cycle continues as long as there are active processes in the system. 

A process's usual state sequence is as follows: 

Start -> Ready -> Running -> Waiting -> Ready -> Running -> Terminated  

However, the actual sequence and transitions may vary depending on the scheduling algorithm, the occurrence of events, and the resource availability within the operating system.