Introduction to
Process Management: Concepts, Scheduling,
Operations, and Threads
Process Concepts:
1. Definition:
o A process is an instance of a program in
execution. It includes the program code,
current activity, and state of the program,
as well as the resources allocated to it
(e.g., memory, CPU time).
2. Process States:
o New: The process is being created.
o Ready: The process is waiting for CPU
time and is ready to execute.
o Running: The process is currently being
executed by the CPU.
o Blocked (or Waiting): The process cannot
proceed until some condition is met (e.g.,
waiting for I/O completion).
o Terminated (or Exit): The process has
finished execution or has been aborted.
3. Process Control Block (PCB):
o A PCB is a data structure used by the
operating system to store information
about a process. It includes:
▪ Process State: Current state of the
process (e.g., ready, running).
▪ Process ID (PID): Unique identifier for
the process.
▪ Program Counter: Address of the next
instruction to execute.
▪ CPU Registers: Values of CPU registers
during execution.
▪ Memory Management Information:
Details about the memory allocation
for the process.
▪ I/O Status Information: Information
about I/O devices used by the
process.
▪ Accounting Information: Resource
usage statistics and process
scheduling information.
Process Scheduling:
1. Scheduling Criteria:
o CPU Utilization: Keep the CPU as busy as
possible.
o Throughput: Number of processes
completed per time unit.
o Turnaround Time: Time taken from
process submission to completion.
o Waiting Time: Time a process spends
waiting in the ready queue.
o Response Time: Time from process
submission to the first response.
2. Types of Schedulers:
o Long-Term Scheduler (Job Scheduler):
Decides which processes are admitted
into the ready queue. Manages the
degree of multiprogramming by
controlling the number of processes in the
ready queue.
o Short-Term Scheduler (CPU Scheduler):
Decides which process in the ready queue
gets to execute next on the CPU. Operates
frequently and determines process
execution order.
o Medium-Term Scheduler: Handles the
swapping of processes between main
memory and disk (i.e., swapping
processes in and out of memory). It is
responsible for process suspension and
resumption.
3. Context Switching:
o The process of saving the state of the
currently running process and loading the
state of the next process to be executed.
This involves storing and retrieving
process information from the PCB and is
necessary for multitasking and process
management.
Operations on Processes:
1. Process Creation:
o Definition: The creation of a new process
from an existing process (the parent
process). This involves allocating
resources and initializing the process
state.
o System Calls: In many operating systems,
processes are created using system calls
like fork() in Unix/Linux, which creates a
child process.
2. Process Termination:
o Definition: The process finishes its
execution or is aborted by the operating
system. This involves releasing allocated
resources and updating system records.
o System Calls: Processes terminate using
system calls like exit() or
TerminateProcess().
3. Inter-Process Communication (IPC):
o Definition: Mechanisms that allow
processes to communicate and
synchronize with each other. IPC is crucial
for processes that need to share data or
coordinate their actions.
o Types:
▪ Shared Memory: Processes access
common memory regions.
▪ Message Passing: Processes exchange
messages via system calls (e.g., send(),
receive()).
▪ Pipes and FIFOs: Provide a
unidirectional or bidirectional flow of
data between processes.
Threads:
1. Concept:
o A thread is a lightweight unit of execution
within a process. Threads share the same
address space and resources of their
parent process but can execute
independently.
2. Benefits:
o Concurrency: Threads allow multiple tasks
to be performed simultaneously within a
single process.
o Resource Sharing: Threads within the
same process share resources such as
memory, which reduces overhead
compared to process-based multitasking.
o Responsiveness: Multithreading can
improve application responsiveness and
performance, especially for tasks that
require frequent interaction or
computation.
3. Multithreading Models:
o User-Level Threads: Managed by a user-
level library rather than the kernel. This
model does not require kernel
intervention for thread management.
o Kernel-Level Threads: Managed by the
operating system kernel. The kernel is
aware of each thread and handles
scheduling and management.
o Hybrid Models: Combine aspects of both
user-level and kernel-level threading to
leverage the advantages of each
approach.