Process concepts
What is process in os ?
In Operating Systems (OS), a process is a program that is currently being
executed by the CPU. It is an active entity that includes:
Program Code: The set of instructions that need to be executed.
Current Activity: The value of the program counter (which instruction is being
executed).
Resources: CPU time, memory, files, and I/O devices allocated to the process.
Example: When you open a browser (like Chrome), the OS creates a process for it.
If you open another tab, the OS may create a separate process for that
tab.
Process states
→New: The process is being created.
Example: When you click to open a browser, the process is in the "new" state.
→Ready: The process is ready to execute but waiting for CPU allocation.
Example: The browser is loaded into memory and waiting for the CPU to assign
time for execution.
→Running: The process is actively being executed by the CPU.
Example: The browser is currently loading a website.
→Waiting (Blocked): The process is waiting for some event to complete (like I/O
operation).
Example: The browser is waiting for an internet connection to load a page.
→Terminated: The process has finished execution or has been stopped by the
OS.
Example: Closing the browser will terminate the process.
State Transition Example :
1. New → Ready – Process created and ready for execution.
2. Ready → Running – CPU assigns time for execution.
3. Running → Waiting – Process waits for I/O or user input.
4. Waiting → Ready – I/O completes; process ready to run again.
5. Running → Terminated – Process completes execution or is forcefully closed.
Program: A passive entity stored on disk (file).
Does not require CPU or memory to exist.
Example – A text editor file saved on disk.
Process: An active entity that is being executed.
Requires CPU and memory to execute.
Example – Opening and using the text editor.
Process control block ( pcb )
→ A Process Control Block (PCB) is a data structure used by the operating
system (OS) to store information about a process.
→role of pcb is to give identity to each process so that operating system
can easily distinguish between process.
→a pcb keeps track of process by storing information about various things
like their state, i/o status, and cpu scheduling .
Every process in os has a pcb associated with it
When a context switch occurs, the OS saves the current state of the
running process into its PCB and loads the state of the next process
from its PCB.
It ensures that processes are managed correctly and efficiently during
multitasking.
The OS uses the PCB to track the execution status of each process.
PCB components :
Process ID : A unique identifier assigned to each
process.
Process State: Indicates the current state of the
process (e.g., New, Ready, Running, Waiting,
Terminated).
Program Counter: Stores the address of the next
instruction to be executed.
CPU Registers: Includes general-purpose registers,
stack pointers, and other registers used by the process.
Memory Management Information: Contains details
about the process’s memory allocation, including base
and limit registers, page tables, and segment tables.
Rishabh vijaypuriya
- creator