Day 01Part 08- Operating system lecture for gate for computer science – Attributes of Processes.
Contents
- 1 Attributes of Processes – Operating System (GATE CS Lecture)
- 2 What is a Process?
- 3 Attributes of a Process
- 4 1. Process ID (PID)
- 5 2. Process State
- 6 3. Program Counter (PC)
- 7 4. CPU Registers
- 8 5. Memory Management Information
- 9 6. Accounting Information
- 10 7. I/O Status Information
- 11 Summary
- 12 Day 01Part 08- Operating system lecture for gate for computer science – Attributes of Processes.
- 13 OPERATING SYSTEMS LECTURE NOTES …
- 14 OPERATING SYSTEM
- 15 Operating System
Attributes of Processes – Operating System (GATE CS Lecture)
A process in an Operating System (OS) is an instance of a program in execution. Every process has certain attributes that help the OS manage and schedule it efficiently.
What is a Process?
A process is a program in execution, consisting of:
Program Code (Text Section) – The instructions to be executed.
Program Counter (PC) – Stores the next instruction to execute.
Stack – Contains function calls, return addresses, and local variables.
Heap – Dynamic memory allocation (e.g., malloc in C).
Data Section – Global variables and static data.
Attributes of a Process
Each process has a unique set of attributes stored in the Process Control Block (PCB).
1. Process ID (PID)
- A unique identifier assigned to each process.
- Used by the OS to track and manage processes.
2. Process State
A process can be in one of the following states:
New – Process is being created.
Ready – Waiting for CPU time.
Running – Currently executing on the CPU.
Waiting (Blocked) – Waiting for I/O or other resources.
Terminated – Process has finished execution.
Example: If a process is waiting for input from the keyboard, it moves to the Waiting state.
3. Program Counter (PC)
- Holds the memory address of the next instruction to execute.
- OS uses it to resume a process after an interruption.
4. CPU Registers
- Includes: General-purpose registers, stack pointers, and flags.
- These store temporary data needed for execution.
- OS saves and restores registers during context switching.
5. Memory Management Information
- Defines how the process interacts with RAM.
- Includes:
Base and Limit Registers – Define memory boundaries.
Page Tables – Used in virtual memory systems.
Segment Tables – Used in segmentation memory management.
Example: If a process tries to access memory outside its boundary, the OS generates a segmentation fault.
6. Accounting Information
- Stores process statistics like:
CPU usage
Execution time
Process priority
Number of I/O operations performed
Example: The OS uses this data for scheduling and billing in time-sharing systems.
7. I/O Status Information
- Tracks the files and devices used by the process.
- Includes:
List of open files
I/O device usage - Network connections
Example: If a process is reading a file, it stays in the Waiting state until I/O is complete.
Process Control Block (PCB)
All process attributes are stored in a data structure called the Process Control Block (PCB).
Attribute | Description |
---|---|
Process ID (PID) | Unique identifier for the process |
Process State | New, Ready, Running, Waiting, Terminated |
Program Counter | Address of the next instruction |
CPU Registers | Store temporary process data |
Memory Management Info | Page tables, base & limit registers |
Accounting Info | CPU time, priority, execution history |
I/O Info | Files and devices used by the process |
The PCB is crucial for context switching between processes!
Summary
Every process has attributes stored in the Process Control Block (PCB).
Key attributes include PID, Process State, Program Counter, CPU Registers, and Memory Information.
The OS uses these attributes for scheduling, execution, and memory management.
Would you like GATE-level MCQs or more detailed notes on this?