ch02-Process Management
ch02-Process Management
Processes Management
Chapter 2: Processes Management
• Process Concept
• Process Scheduling
• Operations on Processes
• Interprocess Communication
Process Concept
• An operating system executes a variety of programs:
– Batch system – jobs
– Time-shared systems – user programs or tasks
• Textbook uses the terms job and process almost
interchangeably
• Process – a program in execution; process execution
must progress in sequential fashion
• A process includes:
– program counter : it includes current activity
– Stack : which contains temporary data
– data section : contains global variables.
Process in Memory
Process State
• As a process executes, it changes state.
• the state of a process is defined by the current
activity of that process.
– 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
Diagram of Process State
Process Control Block (PCB)
• Each process is represented in the operating system
by a process control block (PCB) also called a task
control block.
Information associated with each process
• Process state
• Program counter
• CPU registers
• CPU scheduling information
• Memory-management information
• Accounting information
• I/O status information
Process Control Block (PCB)
CPU Switch From Process to Process
Process Scheduling
• The process scheduling is the activity of the
process manager that handles the removal of the
running process from the CPU and the selection of
another process on the basis of a particular
strategy.
• Process scheduling is an essential part of a
Multiprogramming operating system.
• Such operating systems allow more than one
process to be loaded into the executable memory
at a time and loaded process shares the CPU using
time multiplexing.
Process Scheduling Queues
• Scheduling queues refers to queues of processes or
devices.
• 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
Process Scheduling Queues
This figure shows the queuing diagram of process
scheduling.
• Queue is represented by rectangular box.
• The circles represent the resources that serve the
queues.
• The arrows indicate the process flow in the system.
Representation of Process Scheduling
Ready Queue And Various I/O Device Queues
Schedulers
• Schedulers are special system software which
handles 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
Schedulers
• Long-term scheduler (or job scheduler) – selects
which processes should be brought into the ready
queue
• Short-term scheduler (or CPU scheduler) – selects
which process should be executed next and
allocates CPU
• Medium-term scheduler – it is the part of
Swapping. It removes the processes from the
memory and reduces the degree of
multiprogramming. The medium term scheduler is
in-charge of handling the swapped out-processes.
Addition of Medium Term Scheduling
Schedulers (Cont)
• Short-term scheduler is invoked very frequently
(milliseconds) (must be fast)
• Long-term scheduler is invoked very infrequently
(seconds, minutes) (may be slow)
• The long-term scheduler controls the degree of
multiprogramming
• Processes can be described as either:
– I/O-bound process – spends more time doing I/O
than computations, many short CPU bursts
– CPU-bound process – spends more time doing
computations; few very long CPU bursts
Comparison between Scheduler
S.N. Long Term Scheduler Short Term Scheduler Medium Term Scheduler