We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 55
. Process Management
2.1 Introduction
Whenever we talk of computer, we generally mean CPU or processor. This processor is
important and thus which job to be assigned to processor, how it is to be assigned is question
of discussion, The operating system as a Processor Manager is responsible for creation and deletion
of user and system process in scheduling of processes, their synchronisation, deadlock handling
ste. A Process is program in execution. In. present ‘scenerio,\\Process is unit_of_work done by
computer.
2,2 Process Definition \——
The term ‘Process’ was first used by designers in early 1960. The difference between a
and “a program is confusing, but ‘crucial! In’ general, f under
on. To execute an_application program, the operati arrange s
is like compiliers, assemblers, linker_« :_ execution _of each- of these system
licd_a process.) Thus, to execute an application program, the computer system has to perform
ny processes Le. it has to execute many other programs constituting the system software. When
»perating system is booted, several processes are ereated. (These processes can be categorised
Li Foreground processes
+ (ii) Background processes
‘oreground processes as\he_name-indicate are those which interact with (human) users
d_ perform work for them. an
“Background processes are\ not_associated with particular_users, but have some specific
ample in Windows 95/98 machines, typing CTRL-ALT:
ing. Processes that stay in the background,to handle some activity such as
mail, Webpages, news, printing and so on are > daemons,
can
P 3 _ tl r
y that “program is_a_passive entity wl rocess, in_active entity as
1 er execution 16 Pro TOCESs.Y i
Se Soc2.2.1 Process States or
various stages through which a process pass js called it’s life cycle and this
of a process canbe divid®T into” several” sta slate, each with certain characteristics
es a aan fat exec s
PepiGeruoasset be follanig siatcs F
is stale indicates that the process has been created. The PCB has bare minimum
rocess indicates that the process is waiting to be alloca
a processary All ready processes (Kept in queue called as Ready Queue) Keeps waiting-for
TRE To echnoemted by operating system in order to run. A program called scheduler which
a part of operating system, picks up one ready process for execution by passing a control to i
Running : This state of a process indicates that instructions are being executed.
; Waiting : This state of a process indicates that a Waiting process lacks some resource
other than the CPO: Such processes are normally not considered for Turthér execution until the
' related conditions are fulfilled or the resources are made available to process.
that the process has finished execution, Al
Terminated
Terminated : This state of a process indica
the_resources allocated are released for furth
Meaium term
Submitted schedular
Long term’
schedular
Completion schedular Wait for
of /O or VO of any. ‘
otherEvent other event 7
Process Status
3 Process Control V
It is very important to ensure that processes run correctly and the states of each proces
are independent of cach other. Thusfto control the various processes, the operating system maintaia
a table (an_array of structures) called the pro ible, The process table contains one cat}
per process. In general these enteries are referre céss Control Blocks (PCB's). The ent!
contains several details related with a specific process, which includes.
(i) Pr
.ss_number : Each process is identified by its process number, called Process 1D
eee ee
a
- — i is J -e. ‘
ing System
(ii) Priority : What is the priority assigned to the process.
(iii) Process state : Each process may be’ in any of the states discussed above like new,
rtady, running, “waiting and “Termination. ’
(iv) Program counter : It indicates the address of next instruction to be exccuted in the process.
0) ters : They_include accumulator, gencral_purpose registers, index registers’ ete.
Pointer | Process state
isters
memory limits
list of open files
Accounting Information
1/O Status Information
A sample PCB
(vi) Accounting information : It includes actual CPU timé used in executing a process.
(vii) /O* status information : It_includes_out_standing I/O requests, List of open files,
information about allocation’ of peripheral devices to processes ete.
(uli) Processor scheduling details : It includes a priority of a process, address to scheduling
queues and many other details.
2.4 Initialising the Operating System |
When we power on the computer, the first step is execution of the program stored at
boot strap address Le. the address-of-the first instruction {0 be exceuted isoaded-in.the Program
Counte#. This is generally executed by hardware bootup sequence. This first program defines the
pr of the system. It create Operating System environment to support its
processes, threads, objects, files and other resources.
most primitive oper
computation model
Once the Operating System is loaded, it takes control of all, hardware resources, initialise
various device states, process state and data structures. When the bootstrap code is executed, an‘The memory part of the address space is created by the source program a
as shown below. The linkage between Job and Address Space can be shown as a
User Creates
User Specifies
eo
‘Job Step
‘System Creates
v4
Process
Traffic Controller
‘Scheduler as.
‘Component
File System
‘Main Program,
‘Subroute A
‘Subroute B User
Speciic
‘Subroute C task
Address space for Address space for
CPU Process VO Process
2.6 Process Abstraction
When a Process need a resource for it’s execution and if the resources are not available
then the process is blocked from execution, It is possible that resources are available and at the
same instant two or more process demands them. The process which wins the resource allocation
comptetion, is allocated the resources and other waits for their chance to get resources, Thus OS
need to keep track of resource available, in demand and already allocated, This tracking is possible
by resource and process descriptors.
Process descriptors : The process description is
ically the data structure which keep>
details related to state of the process, This in general include the following
1. Process Register contents when the process was last suspended
ae .2, Processor state
3. Processor’s memory state %
4. The resources already allocated to process.
5. The resources required by process.
6. If possible, when last resource was used, the expected time of resource availibility
ete.
2.7 The Resource Abstraction
\The operating system is also sometimes called as Resource N as it is one of the
major role of Operating System to ensure that all the resources are properly wilised ie} fesourees .
are allocated when required or released to resources pool, when not in use oF Ireed. In major
cases, resource manager is a part of Operating System but in few case it is separate entity.
Resource can block a process from exccutingLIf a process need printer and Printer is
not available the device manager blocks the process from subsequent execution until the Printer
t aia
is made available.
Release
Resource Manager|
Allocate
\ Release | | Allocate 7
tC met
Process F neivs
4 Tt:
{5 Request Queue 12 &
z ,
Release/Allocate ®
The resources can be rcusable resource like Printer, Hard disk cle. These resources once
allocated and uscd are again scnt to resource pool for further usages. The mere abstract resource
such as input data, which cause a process to be blocked! on request are called as consumable
resource. The reusable resources are always well defined in a system and are limited, whereas
consumable resources are unbounded and depend upon situation.
2.8 Process Hierarchy
‘The Operating System supporting process concepts, need to provide some means t@ create
all the proc red. Tn a single application system,|it is posible to have all Wl
to Be present when system’ comes up. In mulliprocess environment, some hierarchy is required to
he implicitly defined 10 plan proper resource allocation and processes execution. The hierarchy is
generated from the process creation mechanism.it ple child process and thus a child
lly the running process creates multiple cl wus a ch
have Bay os pleat ete where as a parent process can have multiple child processes
shown below :
Fach Operating System has separate process hierarchies mechanism. In UNIX, Processes
are created by FORK system call, which creates twin copy of the calling process. After FORK
a call, the parent continnes running, in parallel with child, Based on requirement, parent can fork
i off more children §0 at particular instant, parent may have many executing children, The children
t mm turn can'exetute FORK so it is possible-to got a tree of Process.
f Ne_MS-DOS, i system call is there to load Specified executable file into memory and
; execute it_as_a_child_process. Unlike UNIX, in. M!
fond specified executable file int y_an¢
“DOS parent process is eet td
mand thus parent and! child do mot run im_paralles,
2.9 CPU Scheduling 7
\When
ou
in the
inthe
chit has Tinished exeent
computer
ports ruuki—programming, it frequently has multiple processes
tthe CPU at the same time, as in mulfprogramming more: than one program reside
main_memory] This situation occur
mater (WO OF MOTE FOCESSES are simullancously
ready state. If only one CPU is avail
lable, a decision has to be made which Process to
fun next. The part of the operating system that makes the choice ig called the scheduler
algorithm it uses is called the scheduling algorithny, Thus, we
and the
in define that a scheduler is an
operating ssstem program (module) that selects the next job to be admitted for exceution to CPU
The main objective of scheduling is to inercase CPU uulisation ‘and higher throughput,
Now-a-days,
scheduling docs not matter much on simple PC's for
following reasons
BT case of PCs, most ofthe time there is only one process which is activ 50 the
Ter does not have to do much work to figure ou DT 7
It which process to run, C
Gi) Because of new processors and rapid chan
much faster over the years that the CPU is r,
1 major sink of CPU cycles in the past take
ge in technology computers h,
‘rely a scarce resource any more
just a fe
ave became
Even compilations,
aL most nowadays.
W secondscated a LA, EN hse Oa ae, |
Borber
et Ue
Operating Syren 24
In case of high-end net-worked workstations and servers, multiple processes often do’
compete for the CPU, so scheduling matters very much in such cases,
2.9. oo Behaviour \—
In mulliprogramming, several processes are active for efficient utilization of the CPU.
Broadly, we classify processes into two categories :
(1/0 bound ; As the name indicates, this activity required more active participation of
VO devices. This type of processes normally read in, vast amount of data and perfrom very little
computation and output large amount of information thus require less CPU attention. Pay slip
gis an example of 1/0 bound program.
CPU bound : As the name indicates, this activity make CPU_more busy. This type
of processes need very little /O, but require heavy computations.) These processes require much
CPU ‘time, as compared to 1/0 bound processes. A simulation program based on arithmetic
calculation is an example of CPU bound.
In multiprogramming, systems are designed in such a way, so that a proper mix of VO
bound and CPU bound process is always there in memory. There are various scheduling queues
as per details below :