Computer Processes

A computer process is an active execution of a program, managed by the operating system (OS). It consists of program code, data, and system resources needed for execution.


1. Key Components of a Process

Each process includes:


Code Segment: The program’s executable instructions.


Program Counter: Tracks the current instruction being executed.


Stack: Holds function parameters, return addresses, and local variables.


Heap: Allocates memory dynamically as needed.


Data Section: Stores global and static variables.


2. Process States

A process transitions through different states during execution:


New: The process is being created.


Ready: Awaiting CPU allocation.


Running: Currently executing on the CPU.


Waiting (Blocked): Paused, waiting for an external event (e.g., I/O operation).


Terminated: Completed execution and removed from memory.


3. Process Control Block (PCB)

The OS tracks process details using a Process Control Block (PCB), which includes:


Process ID (PID)


Current process state


Program counter


CPU register data


Memory and I/O management details


4. Types of Processes

Foreground Process: Requires user interaction (e.g., an open application).


Background Process (Daemon): Runs without user input (e.g., system services).


Zombie Process: Completed execution but remains in the process table.


Orphan Process: Continues running after its parent process has terminated.


5. Process Scheduling

The OS manages processes using various scheduling techniques:


First-Come, First-Served (FCFS)


Shortest Job Next (SJN)


Round Robin (RR)


Multilevel Queue Scheduling


6. Processes vs. Threads

A process is an independent execution unit with its own memory space.


A thread is a smaller unit within a process that shares memory with other threads.

Comments

Popular posts from this blog

Absolute and relative path in HTML pages

Errors

goto PHP operator