1/16
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Process
is a program in execution.
program is a passive entity, whereas a process is an active entity.
The system consists of operating system processes (executing system code) and user processes (executing user code).
Characteristics of a Process
Multiple processes can be associated with the same program but are separate execution sequences.
Processes execute concurrently, sharing CPU time.
A process cycles between CPU execution (CPU burst) and I/O wait (I/O burst).
Execution begins with a CPU burst, followed by alternating I/O and CPU bursts, until termination.
CPU and I/O Burst
Processes typically have many short CPU bursts or fewer long CPU bursts.
I/O-bound processes have many short CPU bursts.
CPU-bound processes have fewer, longer CPU bursts.
Process Components
Program Code (instructions to be executed)
Process Stack (temporary data such as subroutine parameters, return addresses, local variables)
Data Section (global variables)
Process State Transitions
New - Process creation stage.
Running - Instructions are being executed.
Waiting - Process is waiting for an event (e.g., I/O completion).
Ready - Process is waiting for CPU allocation.
Terminated - Process has completed execution.
Process State Diagram
Shows transitions between Ready, Running, and Waiting states.
Only one process runs at a time; others wait in Ready or Waiting states.
Process Control Block (PCB)
PCB Contents
Process State - New, Ready, Running, Waiting, Terminated.
Program Counter - Address of the next instruction.
CPU Registers - Includes accumulators, stack pointers, etc.
CPU Scheduling Information - Process priority and scheduling queues.
Memory Management Information - Memory limits and page tables.
Accounting Information - CPU time, process ID, resource usage.
I/O Status Information - I/O requests, allocated devices, open files.
Process Control Block (PCB)
Context Switching
When CPU switches from one process to another, it saves the state in the PCB and loads the next process's PCB.
Concurrent Processes
Process Creation
Processes create new processes via the create-process system call.
Parent Process creates Child Processes.
Child may inherit or obtain its own resources from the OS.
Concurrent Processes
Parent-Child Relationship
Parent may execute concurrently with its children.
Parent may wait for child termination before resuming.
Concurrent Processes
Process Termination
A process terminates by issuing an exit system call.
Parent may terminate a child if:
Child exceeds resource usage limits.
Task assigned to the child is no longer required.
Parent terminates, leading to cascading termination of child processes.
Concurrent Processes
Independent vs. Cooperating Processes
Independent Processes
Execution is deterministic (depends only on input state).
Execution is reproducible.
Can be stopped and restarted without side effects.
Cooperating Processes
Execution is nondeterministic (depends on execution sequence of other processes).
Requires synchronization and communication mechanisms.
Scheduling Concepts
Goals
Maximize CPU utilization by keeping processes running at all times.
Increase throughput (work completed per unit time).
Scheduling Concepts
Process Scheduling
Job Queue - Holds all processes in the system.
Ready Queue - Holds processes in main memory waiting for CPU time.
Device Queue - Holds processes waiting for I/O devices.
Linked List Representation - Ready queue is implemented as a linked list of PCBs.
Scheduling Concepts
Process Scheduling Diagram
Processes transition between Ready, Running, and Waiting states.
Scheduling ensures CPU is always occupied.
Scheduling Concepts
Scheduling Events
Process issues an I/O request and moves to the I/O queue.
Process creates a new subprocess and waits for it to terminate.
Process is interrupted and moves back to the Ready queue.
Summary
A process is an executing program that undergoes state transitions.
Processes are managed using a PCB, which stores execution details.
Concurrent execution requires synchronization and resource management.
Scheduling ensures CPU efficiency through process queues and transitions.