2. Process
•A Program in Execution is called a process.
•It also includes the current activity as represented by the value
of the program counter and the content’s of the processor’s
registers.
•It also includes a stack with temporary data, data section with
global variables and heap which is the memory dynamically
allocated during process runtime.
•A program is a passive entity containing instructions to be
executed whereas a process is an active entity with a program
counter specifying the next instruction to execute and a set of
associated resources.
4. Process State
• As a process executes it changes state. The state of a
process is defined in part by the current activity of that
process.
• States of a process:
1. New: The process is being created.
2. Running : Instructions are being executed.
3. Waiting: The process is waiting for some event to
occur (such as an I/O completion or reception of a
signal).
4. Ready: The process is waiting to be assigned to a
processor.
5. Terminated: The process has finished execution.
6. Points to note
1.Only one process can be running on any
processor at any instant.
2.Manny processes can be ready and
waiting at any point of time.
7. Process Control Block
Each process is represented in the operating system by a Process Control Block
(PCB) also called task control block.
• PCB serves as the repository for any
information that may vary from process to
process.
It contains many pieces of information
associated with specific process including :->1.Process State
2.ProgramCounter (indicates the address of
the next instruction to be executed)
3.CPU Registers (accumulators, index
registers, stack pointers etc.)
4.CPU SchedulingInformation (process priority,
pointers to scheduling queues)
8. 5. MemoryManagementInformation(value of the
base and limit registers and the page
tables/segment tables)
6. AccountingInformation (process numbers,
account numbers, time limits, amount of
CPU and real time used)
7. I/OStatus Information (list of I/O devices
allocated to the process, list of open files
etc.)
9. Save state into PCB0
Reload state from PCB1
Interrupt or system call
Save state into PCB1
Reload state from PCB0
Executing
Executing
Executing
Idle
Interrupt or system call
Process P0 OS Process P1
CPU Switch from process to
process