--> Sayadasite

Multiple Ads

Search

Menu Bar

Process Management Basics

Introduction to Operating Systems

Process Management Basics is a core concept in Operating System that deals with how the operating system creates, schedules, executes, and terminates processes in a computer system.

Concept of Processes & Thread

1. Concept of Process

In Operating System, a process is a program that is currently executing.
It is an active entity that contains the program code and its current activity.

Components of a Process

A process typically consists of:

1.                      Program Code (Text Section) – Instructions to be executed

2.                      Program Counter (PC) – Address of the next instruction

3.                      CPU Registers – Temporary data used during execution

4.                      Stack – Stores function calls, local variables

5.                      Heap – Memory used for dynamic allocation

6.                      Data Section – Global and static variables

Example

When you open applications like:

  • Google Chrome
  • Microsoft Word

each running application becomes a separate process managed by the operating system.

Characteristics of a Process

  • Each process has a unique Process ID (PID)
  • Processes have separate memory spaces
  • They can run independently
  • Process switching requires context switching

2. Concept of Thread

A thread is the smallest unit of CPU execution inside a process.
It is sometimes called a lightweight process.

Multiple threads can exist within a single process and share the same resources.

Features of Threads

  • Share same memory space
  • Share files and resources
  • Each thread has its own stack and program counter
  • Faster creation and switching compared to processes

Example

In Google Chrome:

  • One thread loads the webpage
  • Another thread handles user input
  • Another thread runs scripts

This allows tasks to run simultaneously within the same application.

3. Types of Threads

1. User-Level Threads

  • Managed by user-level libraries
  • Faster to create and manage
  • OS does not directly manage them

2. Kernel-Level Threads

  • Managed directly by the operating system kernel
  • OS schedules them for execution

Example operating systems supporting kernel threads:

  • Linux
  • Windows

4. Difference between Process and Thread

Feature

Process

Thread

Definition

Program in execution

Smallest unit of execution

Memory

Separate memory space

Shared memory within process

Creation Time

Slower

Faster

Communication

Uses IPC

Easier (shared memory)

Resource Usage

Heavyweight

Lightweight

  Summary

  • Process = Independent program running in memory.
  • Thread = Smaller execution unit inside a process.
  • Threads improve performance and
  •  multitasking by allowing parallel execution.

Process State Diagram

In Operating System, the Process State Diagram shows the different states a process goes through during its lifecycle and how it moves from one state to another.

Basic Process States

1.                      New

o    The process is being created.

2.                      Ready

o    The process is ready to run and waiting for CPU allocation.

3.                      Running

o    The process is currently executing on the CPU.

4.                      Waiting / Blocked

o    The process is waiting for an event such as I/O completion.

5.                      Terminated (Exit)

o    The process has finished execution or has been stopped.

Process State Diagram (Text Representation)

PPT - CHAPTER 4 PROCESSES PowerPoint Presentation, free download - ID ...PPT - CHAPTER 4 PROCESSES PowerPoint Presentation, free download - ID ...

Explanation of Transitions

New → Ready

  • Process is admitted into the ready queue.

Ready → Running

  • The CPU scheduler selects the process for execution.

Running → Waiting

  • The process waits for I/O or another event.

Waiting → Ready

  • The required event completes (e.g., I/O finished).

Running → Ready

  • CPU time expires (preemption).

Running → Terminated

  • Process execution finishes.

Key Idea

The operating system manages multiple processes by moving them between these states, ensuring efficient CPU utilization and multitasking.

Short Exam Definition:
A process state diagram represents the lifecycle of a process and the transitions between states such as New, Ready, Running, Waiting, and Terminated.

Process Control Block (PCB)

In Operating System, a Process Control Block (PCB) is a data structure used by the operating system to store all information about a process.

Whenever a process is created, the operating system creates a PCB to keep track of that process during its execution.

Definition

Process Control Block (PCB) is a structure that contains all the information needed by the operating system to manage and control a process.

Each process in the system has its own PCB.

Information Stored in PCB

A typical PCB contains the following details:

1. Process ID (PID)

  • A unique number assigned to each process.

2. Process State

  • Indicates the current state of the process such as:
    • New
    • Ready
    • Running
    • Waiting
    • Terminated

3. Program Counter

  • Stores the address of the next instruction to be executed.

4. CPU Registers

  • Contains the values of registers used during process execution.

5. CPU Scheduling Information

  • Includes:
    • Priority
    • Scheduling queue pointers
    • CPU scheduling parameters

6. Memory Management Information

  • Includes:
    • Base and limit registers
    • Page tables
    • Segment tables

7. I/O Status Information

  • List of I/O devices allocated to the process.
  • Open files.

8. Accounting Information

  • CPU time used
  • Time limits
  • Process number

Simple Structure of PCB

Process ID (PID)         
Process State            
Program Counter          
CPU Registers           
CPU Scheduling Info      
Memory Management Info   
I/O Status Info         
Accounting Info      

Role of PCB in Context Switching

During context switching in Linux or Windows:

1.                      The current process state is saved in its PCB.

2.                      The next process state is loaded from its PCB.

3.                      CPU resumes execution of the new process.

Thus, PCB helps the operating system pause and resume processes efficiently.

Short Exam Answer:

A Process Control Block (PCB) is a data structure used by the operating system to store information about a process such as process state, program counter, CPU registers, memory management information, and I/O status.

Inter-Process Communication (IPC).

In Operating System, Inter-Process Communication (IPC) refers to the mechanisms that allow processes to communicate and exchange data with each other.

Since processes usually run in separate memory spaces, IPC is needed for data sharing and coordination between them.

Why IPC is Needed

IPC is important for:

  • Information sharing between processes
  • Speeding up computation using multiple processes
  • Resource sharing (files, printers, etc.)
  • Process synchronization

For example, applications running on systems like Linux or Windows often communicate using IPC mechanisms.

Types of IPC

There are two main models of IPC:

1. Shared Memory

  • Two or more processes share a common memory area.
  • Processes read and write data in the shared space.

Features

  • Faster communication
  • Requires synchronization (semaphores, mutex)

Example
Process A writes data → Process B reads the same data.

2. Message Passing

Processes communicate by sending and receiving messages.

Two operations:

  • Send(message)
  • Receive(message)

Features

  • Easier to implement
  • No shared memory required

Common IPC Mechanisms

1.                      Pipes

o    Used for communication between related processes.

2.                      Message Queues

o    Messages are stored in a queue until read.

3.                      Shared Memory

o    Multiple processes access the same memory region.

4.                      Semaphores

o    Used to control access to shared resources.

5.                      Sockets

o    Used for communication between processes over a network.

IPC Model Diagram (Simple)

Process A  ----->  Message / Shared Data  ----->  Process B

Advantages of IPC

  • Enables data exchange between processes
  • Improves system efficiency
  • Supports parallel processing
  • Helps in process synchronization

Short Exam Definition:

Inter-Process Communication (IPC) is a mechanism provided by the operating system that allows processes to communicate and synchronize their actions by exchanging data.

 

Introduction to Operating Systems

Process Management Basics

Overview of Operating Systems:

Definition of Operating System

An operating system acts as an intermediary between the computer hardware and the user. In short, it is an interface between computer hardware and the user.

  • The purpose of an operating system is to provide an environment in which a user
  • can execute programs conveniently and efficiently.
  • The operating system (OS) is a program that runs at all times on a computer. All
  •  other programs, including application programs, run on top of the operating
  •  system.

  • It assigns resources such as memory,
  •  processors, and input/output devices to 
  • processes that need them. The assignment of resources has to be fair and secure.

·         An Operating System (OS) is system software that manages computer hardware and software resources and provides services for programs and users. It acts as an intermediary between the user and the hardware.

·         When you power on a computer or smartphone, the operating system loads first and controls all basic operations.

Operating System and User Interaction

Every general-purpose computer consists of hardware, an operating system, system programs and application programs.

  • The hardware includes CPU, ALU, memory, I/O devices, peripheral devices and storage devices.
  • The system programs include compilers, loaders, editors and the OS itself.
  • The application programs are user-level software that perform specific tasks.

An operating system is always running in the background to manage and coordinate the use of hardware resources among system and application programs for multiple users. The OS itself is not only a user interface. Instead, it provides an interface for user interaction, typically through:

  • Command-Line Interface (CLI), (e.g., Bash, PowerShell)
  • Graphical User Interface (GUI), (e.g., Windows desktop, macOS Finder)

🔹 Examples of Operating Systems

  • Microsoft Windows
  • macOS
  • Linux
  • Android
  • iOS

Functions of Operating System (OS)

An Operating System (OS) performs several important functions to ensure the smooth working of a computer system. It acts as a resource manager and controls all major activities of the system.

🔹 1️ Process Management

  • Creates and deletes processes
  • Schedules CPU time for processes
  • Handles multitasking
  • Manages process synchronization and communication

👉 Ensures programs run efficiently without conflict.

🔹 2️ Memory Management

  • Allocates and deallocates memory to programs
  • Keeps track of memory usage
  • Manages RAM and virtual memory
  • Prevents memory conflicts

👉 Ensures efficient use of main memory.

🔹 3️ File System Management

  • Creates, deletes, and organizes files and folders
  • Maintains directory structure
  • Controls file access permissions
  • Manages file storage on disk

👉 Keeps data organized and secure.

🔹 4️ Device Management

  • Controls input and output devices
  • Uses device drivers
  • Manages device allocation and deallocation
  • Coordinates communication between devices and CPU

👉 Ensures hardware devices function properly.

🔹 5️ Security and Protection

  • User authentication (login system)
  • Protects data from unauthorized access
  • Provides access control mechanisms

👉 Maintains system safety and privacy.

🔹 6️ User Interface

  • Provides Command Line Interface (CLI)
  • Provides Graphical User Interface (GUI)

Examples:

  • Microsoft Windows
  • macOS

👉 Allows users to interact with the system easily.

🔹 7️ Resource Management

  • Manages CPU, memory, and storage
  • Ensures fair resource allocation
  • Improves overall system performance

📌 In Short:

The Operating System manages processes, memory, files, devices, security, and user interaction, making the computer system efficient and user-friendly.

Types of Operating Systems:

Operating Systems are classified based on how they manage tasks and resources.

Batch

Time-Sharing

Distributed

Real-Time

Embedded

1️ Batch Operating System

  • Jobs are collected and processed in batches
  • No direct interaction between user and computer
  • Suitable for large repetitive tasks

📌 Example: Early mainframe systems

2️ Time-Sharing Operating System

  • Multiple users share system resources
  • Each user gets a small time slice of CPU
  • Provides fast response time

📌 Example: UNIX

4️ Distributed Operating System

  • Manages multiple computers
  • Makes them appear as a single system
  • Shares resources among machines

📌 Used in distributed networks

3️ Real-Time Operating System (RTOS)

  • Provides immediate response to inputs
  • Used where timing is critical
  • Two types: Hard RTOS and Soft RTOS

📌 Used in medical systems, robotics, air traffic control

5️ Network Operating System

  • Manages network resources
  • Allows file sharing and printer access
  • Provides user and security management over a network

📌 Example: Windows Server

6️ Multiprocessing Operating System

  • Supports more than one CPU
  • Improves system performance
  • Increases reliability

📌 Example: Linux

7️ Mobile Operating System

  • Designed for smartphones and tablets
  • Optimized for touch interface and battery usage

📌 Examples:

  • Android
  • iOS

📌 In Short:

Types of OS include Batch, Time-sharing, Real-Time, Distributed, Network, Multiprocessing, and Mobile Operating Systems.

Embedded Operating System (Embedded OS)

An Embedded Operating System is a specialized OS designed to run on embedded systems — small computers built into devices to perform specific tasks.

Unlike general-purpose operating systems (like Microsoft Windows or Linux), an embedded OS is designed for limited resources and specific functions.

🔹 What is an Embedded System?

An embedded system is a computer system built into a device to control its functions.

📌 Examples:

  • Washing machines
  • Microwave ovens
  • Smart TVs
  • Cars (engine control systems)
  • Medical devices

🔹 Features of Embedded OS

  • Small size (lightweight)
  • Fast performance
  • Real-time operation
  • Low memory usage
  • High reliability and stability
  • Designed for specific tasks

🔹 Examples of Embedded Operating Systems

  • VxWorks
  • FreeRTOS
  • Embedded Linux
  • Windows Embedded

🔹 Advantages

  • Efficient resource usage
  • Reliable performance
  • Quick response time
  • Suitable for real-time applications

🔹 Disadvantages

  • Limited functionality
  • Difficult to upgrade
  • Hardware-dependent

📌 In Simple Words:

An Embedded OS is a small, efficient operating system designed to control specific devices like home appliances, vehicles, and industrial machines.

If you'd like, I can also provide:

  • Difference between Embedded OS and RTOS
  • 5-mark exam answer
  • Real-world applications explanation

 

OS Structure (Operating System Structure)

The structure of an Operating System refers to the way the OS is organized internally to manage hardware and software efficiently.

Operating system structures define how an operating system's components (kernel, drivers, modules) are organized and interconnected to manage hardware and software resources. These structures act as blueprints to simplify development, optimize performance, and define how user applications interact with the system.

An OS is generally divided into different layers and components.

🔹 Basic Structure of Operating System

User
  
Application Programs
  
System Calls
  
Operating System (Kernel)
  
Hardware

Common types include simple, monolithic, layered, and modular, with each balancing efficiency, security, and complexity differently. 

Monolithic

Layered

Microkernel

Modular

Monolithic Structure

A monolithic structure is an OS architecture in which the entire system is built as one large kernel (Component of OS). All major services—such as process management, memory management, file systems and device drivers—run together in a single code base. This design places all core functionality inside one unified kernel.

  • Entire OS is implemented as one large kernel.
  • Core services are combined into a single code base.
  • Includes process, memory and file system management.
  • Device drivers also operate inside the kernel.
  • Fast but less secure

·         📌 Example: Linux

Layered Structure

In Layered structure, the OS is divided into levels where each layer uses the services of the one below it—hardware at the bottom and the user interface at the top. This design improves organization and simplifies debugging, as errors can be isolated to specific layers. However, it adds overhead because data must pass through multiple layers and requires careful planning. UNIX is an example of this structure.

  • OS is divided into multiple layers (hardware at bottom, UI at top).
  • Each layer uses the functions of the layer below it.
  • Easier debugging because errors are isolated to specific layers.
  • Adds overhead due to data passing through many layers.
  • Requires careful planning; layers can only use lower layers.
  • UNIX is an example of a layered structure.

Micro-Kernel Structure

A Micro-Kernel structure removes all non-essential services from the kernel and runs them in user space, leaving only a small core called the microkernel. This design allows new services to be added without modifying the kernel, improving security and reliability since failures in user-space services do not affect the whole system. macOS uses microkernel concepts but functions as a hybrid kernel (XNU).

  • Non-essential services run in user space, Essential services run in kernel,leaving a small core kernel.
  • New services can be added without changing the kernel.
  • More secure and reliable because failures don’t crash the whole OS.
  • macOS uses microkernel ideas within its hybrid XNU kernel.
  • Other services run in user space
  • More secure and stable

·         📌 Example: MINIX

Modular Structure

A modular structure uses a kernel that contains only essential core components, while additional services are added as loadable modules during boot or runtime. It is similar to a layered design because it has defined and protected interfaces, but it is more flexible since modules can communicate freely. This approach is widely used in modern systems such as Solaris.

  • Kernel contains only core components.
  • Extra services are added as dynamically loadable modules.
  • More flexible than layered structure; modules can call any other module.
  • Used in systems like Solaris. (Oracle Solaris is a proprietary Unix operating system)

Modular OS Structure

A Modular Operating System Structure is a design approach where the OS kernel is divided into separate modules. Each module performs a specific function (like memory management, file system, device drivers) and can be added or removed independently.

It is an improved version of the monolithic structure.

🔹 Key Idea

Instead of placing everything inside one large kernel, the OS is divided into loadable modules that:

  • Communicate with the core kernel
  • Can be dynamically loaded or unloaded
  • Work independently but share the same kernel space

🔹 Features of Modular OS

  • Modular design (separate components)
  • Dynamic loading of modules
  • Better flexibility
  • Easier maintenance
  • High performance (runs in kernel space)

🔹 How It Works

  • The core kernel remains small
  • Additional services (like file systems, drivers) are added as modules
  • Modules interact using well-defined interfaces

🔹 Example

📌 A common example is:

  • Linux

Linux supports Loadable Kernel Modules (LKM), which allow adding drivers or features without restarting the system.

🔹 Advantages

  • Easier to update and maintain
  • Better organization of code
  • Flexible system design
  • No need to recompile the entire kernel
  • 🔹Disadvantages
  • Slightly complex design
  • Errors in modules can affect the whole system (since they run in kernel space)

🔹 Modular vs Monolithic (Short Difference)

Modular OS

Monolithic OS

Divided into modules

Single large kernel

Easier to maintain

Harder to modify

More flexible

Less flexible

📌 In Simple Words:

A Modular OS is a system where the operating system is built using separate modules that can be added or removed without affecting the whole system.

If you'd like, I can also provide:

  • Diagram of modular structure
  • 5-mark exam answer
  • Comparison with microkernel structure

System Calls and OS Services

🔹 1️ System Calls

A System Call is a mechanism that allows a user program to request a service from the Operating System kernel.

Since application programs cannot directly access hardware, they use system calls to communicate with the OS.

📌 Why System Calls Are Needed

  • Programs run in user mode
  • OS runs in kernel mode
  • System calls provide a safe way to switch from user mode to kernel mode

🔹 Types of System Calls

1️ Process Control

  • Create or terminate processes
  • Load and execute programs
  • Wait for process completion

2️ File Management

  • Create, open, read, write, close files
  • Delete files
  • Get file attributes

3️ Device Management

  • Request and release devices
  • Read/write from devices

4️ Information Maintenance

  • Get system time and date
  • Get process or system data

 5️ Communication

  • Send and receive messages
  • Shared memory access

📌 Example (In Linux)

Some common system calls:

  • fork() – Create a process
  • exec() – Execute a program
  • read() / write() – File operations

🔹 2️ OS Services

OS services are the functions provided by the Operating System for users and programs.

📌 Main OS Services

1️ Program Execution

  • Loads and runs programs

2️ I/O Operations

  • Handles input/output devices

3️ File System Manipulation

  • Create, delete, read, write files

4️ Communication

  • Process-to-process communication

5️ Error Detection

  • Detects and handles system errors

6️ Resource Allocation

  • Allocates CPU, memory, and devices

7️ Accounting

  • Tracks system resource usage

8️ Protection and Security

  • Controls access and authentication

🔹 Difference Between System Calls and OS Services

System Calls

OS Services

Interface between program and OS

Functions provided by OS

Used by programmers

Used by users & programs

Example: fork(), read()

Example: file management, security

📌 In Simple Words:

  • System Calls are requests made by programs to the OS.
  • OS Services are the facilities provided by the OS to users and programs.

If you want, I can provide a short 5-mark exam answer version.