Lecture 8(a)- Process
Lecture 8(a)- Process
Processes (a)
Operating Systems 1
Roadmap
• Process Concept
• Process Elements
• Process Control Block ( PCB)
• Process States
• Switching between processes
• Process Scheduling
• Types of Queues ( Job, ready, device)
• Schedulers ( Short, Long, Medium)
• Operations on Processes (Process Creation and Termination)
• Interprocess Communication
Operating Systems 2
Process
Definition
Program vs. Process
• A program is a passive entity such as the file that
contains the list of instructions stored on a disk always
referred to as an executable file.
• A program becomes a process when an executable file is
loaded into the memory and then becomes an active
entity or an activity.
• The fundamental task of any operating system is
the
process management.
Operating Systems 3
Operating Systems 4
Feature Program Process
Operating Systems 7
Process
Elements
• Process is loaded in Main Memory and divided
into various parts.
Operating Systems 10
Process Control Block
(PCB)
• Process Control Block (PCB)
CPU scheduling information
priorities, scheduling queue pointers
Memory-management information
memory allocated to the process
Accounting information
CPU used, clock time elapsed since start, time limits
I/O status information
I/O devices allocated to process, list of open files
Operating Systems 11
Process Control Block
(PCB)
• Process Control Block (PCB)
Process identification information
Process identifier: numeric identifiers
represent the unique process identifier
User identifier: the user who is responsible for the job).
Identifier of the parent process that created this process.
Operating Systems 12
Process Control Block-
Summary
• Distinction between processes
• Knowledge on processes
ready to execute
• Discriminate between
processes
• Know the next instruction to
execute
• Find the program and data
stored in memory
• Keep information about
registers
• Collect information on
utilization of the system
13
Why PCBs?
• By maintaining a PCB for each process, the operating
system can effectively:
• Manage the execution of multiple processes
• Allocate system resources
• Schedule CPU time
• Handle process synchronization and communication.
• The PCB serves as a crucial data structure that allows the
operating system to maintain and control the state of each
process, ensuring efficient and orderly execution of tasks
within the system.
Operating Systems 14
CPU Switch From Process to Process
Process
Dispatcher/Scheduler
• OS program that decides which
process to run next from set of
available processes.
16
Process Scheduling
Queues
• Job queue – set of all processes in the system
• Ready queue – set of all processes residing in main
memory, ready and waiting to execute
• Device queues – set of processes waiting for an I/O device
• Processes migrate among the various queues
Operating Systems 17
Process States
• As a process executes, it changes state
New: The process is being created
Running: Instructions are being executed
Waiting: The process is waiting for some event to
occur
Ready:The process is waiting to be assigned to a processor
Terminated: The process has finished execution
Operating Systems 18
Process States
• Diagram of Primary Process State
Operating Systems 24
Addition of Medium Term
Scheduling