Processes and Process
States
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.
Stack
Heap
Data
text
Process in memory
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.
Waiting
New
Ready Running
Terminated
Admitted
Exit
Interrupt
I/O or event
completion
I/O or event wait
Scheduler dispatch
Schematic Representation of Process
state
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.
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)
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.)
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
Query Time!

The process states

  • 1.
  • 2.
    Process •A Program inExecution 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.
  • 3.
  • 4.
    Process State • Asa 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.
  • 5.
    Waiting New Ready Running Terminated Admitted Exit Interrupt I/O orevent completion I/O or event wait Scheduler dispatch Schematic Representation of Process state
  • 6.
    Points to note 1.Onlyone 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 Eachprocess 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 ofthe 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 intoPCB0 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
  • 10.