You are on page 1of 8

Process Management

Process Concept, Process States, Process Control Block


Process
• Process – A program in execution
• Program is passive entity stored
on disk, process is active
• Modern computers do several
tasks at same time called
multiprogramming
Pseudoparallelism:
• One CPU switches from process
to process quickly, running each
for tens or hundreds of
milliseconds
Process in Memory

Multiple parts
Text section also called the program code
Stack containing temporary data
Function parameters, return addresses,
local variables
Data section containing global variables
Heap containing memory dynamically
allocated during run time
Process Creation
• O.S. needs some way to create processes
• Events That Cause Process To Be Created
1. System Initialization
• System booted numerous process created some foreground and other background ( Daemons ) like Incoming
email
2. Execution of process-creation system call by a running process
• Large data fetched over network one process to put in shared buffer while other to process it
3. User request to create a new process
• In interactive system clicking an icon or typing command
• New Process is created by existing process with system call( fork() )
• Fork System Call:- creates exact clone of existing process after fork called both parent
and child have same memory image, same environment strings and same open files
usually child process then executes EXECVE system call or similar system to change
memory image and run new program
PROCES TERMINATION
• All created processes run and do the job required eventually
terminates due to one of following conditions:
1. Normal Exit ( Voluntary )
• Such X button in Graphical window or Exit System Call
2. Error Exit ( Voluntary )
• Program bug, Illegal instruction, division by zero
3. Fatal Error ( Non Voluntary )
• Non existent file execution
4. Killed by another Process ( Non Voluntary)
• Kill system Call or TerminateProcess Call but must have necessary authorization
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
Implementation of Process (PCB)
• To implement process model
O.S. maintains Process
Table( Array of Structures )
each entry is Process Control
Block, important info about
Process state, Program
Counter, Stack Pointer,
Memory Allocation
• Each I/O Class has an
associated Location called
Interrupt Vector ( Has Address
of Interrupt service
procedure )
Context
Switching (CPU
Switching from
on Process to
another Process

You might also like