3.process Management
3.process Management
3.process Management
UNIT -3
PROCESS MANAGEMENT
Marks-14
By - Mr.A.D.Cholke
Process Management
• Introduction-
• Process- A program in execution.
• Process execution must progress in sequential fashion.
• A Process includes following sections-
1. Text – Program Code
2. Data – Global & Static Variables
3. Heap – Dynamic Memory Allocation
4. Stack – Local Variables, Temporary data
5. Program Counter – Contents of Processor’s Registers
Process Management
Sr. No. Program Process
Program contains a set of instructions designed to complete a
1. Process is an instance of an executing program.
specific task.
Program exists at a single place and continues to exist until it is Process exists for a limited span of time as it gets terminated after
3.
deleted. the completion of task.
Program does not have any resource requirement, it only Process has a high resource requirement, it needs resources like
5.
requires memory space for storing the instructions. CPU, memory address, I/O during its lifetime.
6. Program does not have any control block. Process has its own control block called Process Control Block.
Process Model:
• OS is organized into a number of sequential processes.
• Conceptually each process has its own virtual CPU.
Program Counter
Four Program Counter D
A
C
B
A B C D
B
C
A
D
Fig.b
Time
Fig.a
Process
Process Management
Process States
• As Process run it change its state.
Process States means various
stages of process.
1. New
2. Ready
3. Running
4. Waiting
5. Terminated
• Process Scheduling-
• Main objectives of Operating system is multiprogramming .
• It means to run multiple program at a time. So it can use more CPU and I/O
devices.
• Process are arranged in a queue and each process is associated with its PCB.
• Types of Process Scheduling-
1. Scheduling Queues-
2. Context Switching-
3. Schedulers-
Process Management
1. Scheduling Queues-
• There are various types of 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 queue – set of processes waiting for an I/O device.
• Representation of Process Scheduling-
Process Management
2. Context Switching-
Process Management
2. Context Switching-
• A context switch is a procedure that a computer's CPU (central processing
unit) follows to change from one task (or process) to another while ensuring
that the tasks do not conflict. Effective context switching is critical if a
computer is to provide user-friendly multitasking.
• Diagram Shows two Processes Process P0 and Process P1.
• Situation could describe when P0 run at same time P1 wait (idle) and when P1
run P0 is idle.
• In that role of operating system is to invoke the system call in between switch
and save the current state of those process in respective process control block.
Process Management
3. Schedulers-
• Schedulers are special system software which handle process scheduling in
various ways.
• Their main task is to select the jobs to be submitted into the system and to
decide which process to run.
• Schedulers are of three types −
1. Long term Schedulers
2. Short term Schedulers
3. Medium term Schedulers
Process Management
1. Long term Schedulers-
• It is also called a job scheduler.
• A long-term scheduler determines which programs are admitted to the
system for processing.
• It selects processes from the queue and loads them into memory for
execution. Process loads into the memory for CPU scheduling.
• The primary objective of the job scheduler is to provide a balanced mix of
jobs, such as I/O bound and processor bound.
• On some systems, the long-term scheduler may not be available or minimal.
• Time-sharing operating systems have no long term scheduler.
• When a process changes the state from new to ready, then there is use of
long-term scheduler.
Process Management
2. Short term Schedulers-
• It is also called as CPU scheduler.
• Its main objective is to increase system performance in accordance with the
chosen set of criteria.
• It is the change of ready state to running state of the process.
• CPU scheduler selects a process among the processes that are ready to
execute and allocates CPU to one of them.
• Short-term schedulers, also known as dispatchers, make the decision of
which process to execute next.
• Short-term schedulers are faster than long-term schedulers.
Process Management
3. Medium Term Scheduler
• Medium-term scheduling is a part of swapping.
• It removes the processes from the memory.
• It reduces the degree of multiprogramming. The medium-term scheduler is
in-charge of handling the swapped out-processes.
• A running process may become suspended if it makes an I/O request.
• A suspended processes cannot make any progress towards completion. In
this condition, to remove the process from memory and make space for other
processes, the suspended process is moved to the secondary storage.
• This process is called swapping, and the process is said to be swapped out or
rolled out. Swapping may be necessary to improve the process mix.
Process Management
Comparison-
S.N. Long-Term Scheduler Short-Term Scheduler Medium-Term Scheduler
3 It controls the degree of It provides lesser control over It reduces the degree of
multiprogramming degree of multiprogramming multiprogramming.
4 It is almost absent or minimal in It is also minimal in time sharing It is a part of Time sharing
time sharing system system systems.
5 It selects processes from pool and It selects those processes which It can re-introduce the process
loads them into memory for are ready to execute into memory and execution can
execution be continued.
Process Management
Inter-process communication (IPC)-
• Inter-process communication is the mechanism provided by the operating
system that allows processes to communicate with each other.