0% found this document useful (0 votes)
42 views

Chapter - 4 - Process and Process Management

The document discusses concepts related to processes and process management in operating systems. It covers topics like process states, process control blocks, scheduling queues, long term and short term schedulers, context switching, and performance criteria for process scheduling.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Chapter - 4 - Process and Process Management

The document discusses concepts related to processes and process management in operating systems. It covers topics like process states, process control blocks, scheduling queues, long term and short term schedulers, context switching, and performance criteria for process scheduling.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Operating System

Concepts
CS284
Chapter 2
Process and Process Management
• Process:
• A process is an executing program, including the current values of the program
counter, registers, and variables. The subtle difference between a process and a
program is that the program is a group of instructions whereas the process is the
activity.
 
• In multiprogramming systems, processes are performed in a pseudo parallelism
as if each process has its own processor. In fact, there is only one processor but it
switches back and forth from process to process.

• Processor-bound program: A program having long processor bursts (execution


instants).
• I/O-bound program: A program having short processor bursts.
Process State

• Start : The process has just arrived.


• Ready : The process is waiting to grab the processor.
• Running : The process has been allocated by the processor.
• Waiting : The process is doing I/O work or blocked.
• Halted : The process has finished and is about to leave the system.
• Process Control Block, PCB
• Each process is represented in the operating system by a process control block
(PCB) also called a task control block. PCB is the data structure used by the
operating system. Operating system groups all information that needs about
particular process. PCB contains many pieces of information associated with a
specific process which is described below.
S.N. Information & Description
1 Pointer Pointer points to another process control block. Pointer is used for maintaining the
scheduling list.
2 Process State Process state may be new, ready, running, waiting and so on.
3 Program Counter Program Counter indicates the address of the next instruction to be
executed for this process.
4 CPU registers CPU registers include general purpose register, stack pointers, index registers
and accumulators etc. number of register and type of register totally depends upon the
computer architecture.
5 Memory management information This information may include the value of base and limit
registers, the page tables, or the segment tables depending on the memory system used by
the operating system. This information is useful for deallocating the memory when the
process terminates.
6 Accounting information This information includes the amount of CPU and real time used,
time limits, job or process numbers, account numbers etc.
• If we have a single processor in our system, there is only one running process at a time.
Other ready processes wait for the processor. The system keeps these ready processes
(their PCBs) on a list called Ready Queue which is generally implemented as a linked-list
structure.

• When a process is allocated by the processor, it executes and after some time it either
finishes or passes to waiting state (for I/O). The list of processes waiting for a particular
I/O device is called a Device Queue. Each device has its own device queue.
• 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.

• Scheduling Queues

Scheduling queues refers to queues of processes or devices. When the process


enters into the system, then this process is put into a job queue. This queue
consists of all processes in the system. The operating system also maintains other
queues such as device queue. Device queue is a queue for which multiple
processes are waiting for a particular I/O device. Each device has its own device
queue. .
• Two State Process Model
• Two state process model refers to running and non-running states which are
described below
S.N. State & Description
1 Running When new process is created by Operating System that process enters
into the system as in the running state.
2 Non-Running Processes that are not running are kept in queue, waiting for their
turn to execute. Each entry in the queue is a pointer to a particular process. Queue
is implemented by using linked list. Use of dispatcher is as follows. When a process
is interrupted, that process is transferred in the waiting queue. If the process has
completed or aborted, the process is discarded. In either case, the dispatcher then
selects a process from the queue to execute.
• 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
• Long Term Scheduler
• Short Term Scheduler
• Medium Term Scheduler
• Long Term Scheduler
• It is also called job scheduler. Long term scheduler determines which programs
are admitted to the system for processing. Job scheduler 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. It also
controls the degree of multiprogramming. If the degree of multiprogramming is
stable, then the average rate of process creation must be equal to the average
departure rate of processes leaving the system.
• On some systems, the long term scheduler may not be available or minimal.
Time-sharing operating systems have no long term scheduler. When process
changes the state from new to ready, then there is use of long term scheduler.
• Short Term Scheduler
• It is also called CPU scheduler. Main objective is increasing 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 process among the processes
that are ready to execute and allocates CPU to one of them.
• Short term scheduler also known as dispatcher, execute most frequently and
makes the fine grained decision of which process to execute next. Short term
scheduler is faster than long term scheduler.
• Medium Term Scheduler
• Medium term scheduling is part of the 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.
• Context Switch
• A context switch is the mechanism to store and restore the state or context of a
CPU in Process Control block so that a process execution can be resumed from
the same point at a later time. Using this technique a context switcher enables
multiple processes to share a single CPU. Context switching is an essential part of
a multitasking operating system features.
• When the scheduler switches the CPU from executing one process to execute
another, the context switcher saves the content of all processor registers for the
process being removed from the CPU, in its process descriptor. The context of a
process is represented in the process control block of a process. Context switch
time is pure overhead. Context switching can significantly affect performance as
modern computers have a lot of general and status registers to be saved.
Content switching times are highly dependent on hardware support. Context
switch requires ( n + m ) bxK time units to save the state of the processor with n
general registers, assuming b are the store operations are required to save n and
m registers of two process control blocks and each store instruction requires K
time units.
• Some hardware systems employ two or more sets of processor registers to
reduce the amount of context switching time. When the process is switched, the
following information is stored.
• Program Counter
• Scheduling Information
• Base and limit register value
• Currently used register
• Changed State
• I/O State
• Accounting
• Performance Criteria
• In order to achieve an efficient processor management, OS tries to select the
most appropriate process from the ready queue. For selection, the relative
importance of the followings may be considered as performance criteria.
•  Processor Utilization: The ratio of busy time of the processor to the total time
passes for processes to finish. We would like to keep the processor as busy as
possible.
•  Processor Utilization = (Processor busy time) / (Processor busy time + Processor
idle time)
•  Throughput: The measure of work done in a unit time interval.
•  Throughput = (Number of processes completed) / (Time Unit)
•  Turnaround Time (tat): The sum of time spent waiting to get into the ready
queue, execution time and I/O time.
•  tat = t(process completed) – t(process submitted)
• Waiting Time (wt): Time spent in ready queue. Processor scheduling
algorithms only affect the time spent waiting in the ready queue. So,
considering only waiting time instead of turnaround time is generally
sufficient.
•  Response Time (rt): The amount of time it takes to start responding
to a request. This criterion is important for interactive systems.
•  rt = t(first response) – t(submission of request)
•  We, normally, want to maximize the processor utilization and
throughput, and minimize tat, wt, and rt. However, sometimes other
combinations may be required depending on to processes.

• Continues with Scheduling algorithms

You might also like