Process Management - Notes
What is a Process?
A process is a program in execution. It includes the program code, current activity, stack, data
section, and heap.
Process States
A process can be in one of the following states: New, Ready, Running, Waiting, and Terminated.
Process Control Block (PCB)
PCB contains information associated with each process such as process ID, process state, program
counter, CPU registers, memory limits, and accounting information.
Process Scheduling
The OS uses scheduling algorithms to determine which process runs next. It helps in efficient CPU
utilization.
CPU Scheduling Algorithms
Common algorithms include:
- First Come First Serve (FCFS)
- Shortest Job First (SJF)
- Round Robin (RR)
- Priority Scheduling
- Multilevel Queue and Multilevel Feedback Queue Scheduling
Context Switching
Context switching is the process of storing and restoring the state (context) of a CPU so that
execution can be resumed from the same point later.
Threads and Multithreading
A thread is a lightweight process. Multithreading allows multiple threads within a process to execute
independently while sharing resources.
Process Management - Notes
Inter-Process Communication (IPC)
IPC allows processes to communicate and synchronize their actions. Methods include Message
Passing and Shared Memory.
Process Synchronization
It ensures that concurrent processes do not execute critical section code simultaneously.
Mechanisms include Semaphores, Mutexes, and Monitors.
Critical Section Problem
A segment of code that accesses shared resources and must not be concurrently executed by more
than one process.
Process Creation and Termination
Processes can be created using system calls like fork() in Unix. Termination can occur when a
process finishes execution or is killed.