Sie sind auf Seite 1von 5

BLOCK 1 UNIT 2

PROCESSES
Q1. Define process.
Ans: The term process was first used by the operating system designers of the
MULTICS system way back in 1!"s# A process is a program in e$ecution# Typica%%y& a
batch 'ob is a process# A time shared user program is a process# A system task& such as
spoo%ing& is a%so a process#
Q2. Differentiate beteen i!p"icit tas#in$ an% e&p"icit tas#in$.
Ans: Imp%icit tasking means that processes are defined by the system# It is common%y
encountered in genera% purpose mu%tiprogramming system# ($p%icit tasking means that
programs e$p%icit%y defined each process and some of its attributes# ($p%icit tasking is
used in situations where high performance is desired system program such as parts of the
operating system and rea% time app%ications are common e$amp%es of programs defined
processes#
Q'. ()at are t)e co!!on reasons for t)e *ser of e&p"icit tas#in$+
Ans: The common reasons for the user of e$p%icit tasking inc%ude:
Spee%*p, ($p%icit tasking can resu%t in faster e$ecution of app%ications#
Dri-in$ I.O De-ices t)at )a-e "atenc/, )hi%e one task is waiting for I*+ to
comp%ete& another portion of the app%ication can make progress towards comp%etion if it
contains order tasks that can do usefu% work in the interim#
User Con-enience, ,y creating tasks to hand%e indi-idua% actions& a graphica%
interface can a%%ow users to %aunch se-era% operations concurrent%y by c%icking on action
icons before comp%etion of pre-ious commands#
0*"tiprocessin$ an% 0*"ti1co!p*tin$, A program coded as a co%%ection of tasks
can be re%ati-e%y easi%y posted to a mu%tiprocessor system& where indi-idua% tasks may be
e$ecuted on different processors in para%%e%#
Q2. E&p"ain process re"ations)ip.
Ans: In the concurrent en-ironment basica%%y processes ha-e two re%ationships&
competition and cooperation# In the concurrent en-ironment& processes compete with
each other for a%%ocation of system resources to e$ecute their instructions# In addition& a
co%%ection of re%ated processes that co%%ecti-e%y represent a sing%e %ogica% app%ication
cooperate with each other#
A process is independent if it cannot affect or be affected by other processes
e$ecuting in the system# The features of independent process are:
.1/ Their state is not shared in any way by any other process#
.0/ Their e$ecution is deterministic& i#e# the resu%t of e$ecution depends on%y on the input
-a%ues#
.1/ Their e$ecution is reproducib%e i#e# the resu%t of e$ecution wi%% a%ways be the same for
the same input#
.2/ Their e$ecution can be stopped and restarted without any negati-e effect#
In contrast to independent processes& cooperating processes can affect or affect by
other processes e$ecuting the system# They are characteri3ed by:
.1/ Their states are shared by other processes#
.0/ Their e$ecution is not deterministic i#e# the resu%ts of e$ecution depend on re%ati-e
e$ecution se4uence and cannot be predicted in ad-ance#
Q3. ()at are t)e states of process+
Ans: The states of process are gi-en be%ow:
.1/ Ne 4 The process is being created#
.0/ Rea%/ 4 The process is waiting to be assigned to a processor#
.1/ R*nnin$ 4 Instructions are being e$ecuted#
.2/ (aitin$ . S*spen%e% . B"oc#e% 4 The process is waiting for some e-ent to occur#
.5/ 5a"te% . Ter!inate% 4 The process has finished e$ecution#
Q6. ()at is Process Contro" B"oc# 7PCB8+ ()at infor!ation is store% in PCB+
5o it %iffers fro! conte&t sitc)+
Ans: To imp%ement the processes mode% the operating system maintains a tab%e& an
array of structures& ca%%ed the process tab%e or process contro% b%ock .6C,/ or switch
frame# The fo%%owing are the information stored in a 6C,:
6rocess state& which may be new& ready& running& waiting or ha%ted#
6rocess number& each process is identified by its process number ca%%ed process I7#
6rogram counter& which indicates the address of the ne$t instruction to be e$ecuted
for this process#
C6U registers& which -ary in number and type& depending on the concrete
microprocessor architecture#
Memory management information which inc%udes base and bounds registers or page
tab%e#
I*+ status information& composed I*+ re4uests& I*+ de-ices a%%ocated to this process& a
%ist of open fi%es and so on#
6rocessor schedu%ing information& which inc%udes process priority& pointers to
schedu%ing 4ueues and any other schedu%ing parameters#
List of open fi%es#
A conte$t switch .a%so sometimes referred as a process switch or a task switch/ is
the switching of the C6U from one process or to another# A conte$t is the contents of a
C6Us registers and program counter at any gi-en point in time# A conte$t switch is
sometimes described as the kerne% suspending e$ecution of one process on the C6U and
resuming e$ecution of some other process that had pre-ious%y been suspended#
Q9. E&p"ain process )ierarc)/.
Ans: Modern genera% purpose operating systems permit a user to create and destroy
processes# A process may create se-era% new processes during its time of e$ecution# The
creating process is ca%%ed parent process& whi%e the new processes are ca%%ed chi%d
processes# A parent process can terminate the e$ecution of one of its chi%dren for one of
these reasons:
The chi%d process has e$ceeded its usage of the resources it has been a%%ocated# In
order to do this& a mechanism must be a-ai%ab%e to a%%ow the parent process to inspect the
state of its chi%dren processes#
The task assigned to the chi%d process is no %onger re4uired#
In U8I9 this is done by the fork system ca%%& which creates a chi%d process and
the e$it system ca%%& which terminates the current process#
Q:. ()at are t)rea%s+ ()/ *se t)rea%s+
Ans: Threads& sometimes ca%%ed %ightweight process .L)6s/ are independent%y
schedu%ed parts of a sing%e program# )e say that a task is mu%tithreaded if it is composed
of se-era% independent sub:processes which do work on common data& and if each of
these pieces cou%d .at %east in princip%e/ run in para%%e%# In a sense& threads are further
%e-e% of ob'ect orientation for mu%ti:tasking systems# They a%%ow certain functions to be
e$ecuted in para%%e% with others# The point is that threads are cheaper than norma%
processes& and they can be schedu%ed for e$ecution in a user:dependent way& with %ess
o-erhead# Threads are cheaper than a who%e process because they do not ha-e a fu%% set of
resources each#
)e use threads because of the fo%%owing reasons:
.1/ Threads a%%ow a programmer to switch between %ightweight processes when it is best
for the program#
.0/ A process which uses threads does not get more C6U time than an ordinary process ;
but the C6U time it gets is used to do work on the threads# It is possib%e to write a
more efficient program by making use of threads#
.1/ Inside a hea-yweight process& threads are schedu%ed on a <C<S basis& un%ess the
program decides to force certain threads to wait for other threads# If there is on%y one
C6U& then on%y one thread can be running at a time#
.2/ Threads conte$t switch without any need to in-o%-e the kerne% the switching is
performed by a user %e-e% %ibrary& so time is sa-ed because the kerne% does not need to
know about the threads#
Q;. ()at is s/ste! ca""s+ E&p"ain for#.<oin !et)o%.
Ans: System ca%%s pro-ide the interface between a process and the operating system#
These system ca%%s are the routine ser-ices of the operating system# <ork*'oin is a method
of process creation and termination which is origina%%y introduced as primiti-e for
mu%tiprocessor system# The fork operations are used to sp%it a se4uence of instruction into
two concurrent%y e$ecutab%e se4uences# =oin is used to merge the two se4uences of code
di-ided by the fork and it is a-ai%ab%e to a parent process for synchroni3ation with a chi%d#
Q1=. E&p"ain process sc)e%*"in$. ()at are t)e sc)e%*"in$ ob<ecti-es+
Ans: Schedu%ing refers to a set of po%icies and mechanisms supported by operating
system that contro%s the order in which the work to be done is comp%eted# A schedu%er is
an operating system program or modu%e that se%ects the ne$t 'ob to be admitted for
e$ecution# The main ob'ecti-e of schedu%ing is to increase C6U uti%i3ation and higher
throughput# Throughput is the amount of work accomp%ished in a gi-en time inter-a%#
>arious ob'ecti-es of schedu%ing are gi-en be%ow:
.1/ 0a&i!i>e t)ro*$)p*t 4 Schedu%ing shou%d attempt to ser-ice the %argest possib%e
number of process per unit time#
.0/ Be Pre%ictab"e 4 A gi-en 'ob shou%d uti%i3e the same amount of time and shou%d cost
the same regard%ess of the %oad on the system#
.1/ 0ini!i>e O-er)ea% 4 Schedu%ing shou%d minimi3e the wasted resources o-erhead#
.2/ Ba"ance Reso*rce *se, The schedu%ing mechanisms shou%d keep the resources of the
system busy# 6rocess that wi%% use under uti%i3ed resources shou%d be fa-ored#
.5/ ?-oi% In%efinite postpone!ent 4 It wou%d be fair if a%% processes are treated the
same and no process can suffer indefinite postponement#
Q11. E&p"ain t)e %ifferent t/pes of sc)e%*"ers.
Ans: The different types of schedu%ers are e$p%ained be%ow:
7a8 S)ort Ter! Sc)e%*"er
The short term schedu%er se%ects the process for the processor among the processes which
are a%ready in 4ueue in memory# The schedu%er wi%% e$ecute 4uite fre4uent%y most%y at
%east once e-ery 1" mi%i:seconds# It has to be -ery fast in order to achie-e better
processor uti%i3ation# The short term schedu%er& %ike a%% other +S programs& has to e$ecute
on the processor#
7b8 Lon$ Ter! Sc)e%*"er
The %ong term schedu%er se%ect processes from the process poo% and %oads se%ected
processes into memory for e$ecution# The %ong term schedu%er e$ecute much %ess
fre4uent%y when compared with the short term schedu%er# It contro%s the degree of
mu%tiprogramming i#e# the number of processes in memory at a time#
7c8 0e%i*! Ter! Sc)e%*"er
Medium term schedu%er is in between the short term schedu%er and %ong term schedu%er#
Sometimes it is good to reduce the degree of mu%tiprogramming by remo-ing processes
from memory and storing them on disk# These processes can then be re:introduced into
memory by a medium term schedu%er# This operation is a%so known as swapping#
Swapping may be necessary to impro-e the process mi$ or to free memory#
Q12. Define t)e fo""oin$ ter!s,
7a8 CPU Uti"i>ation
C6U uti%i3ation is the ratio of busy time of the processor to the tota% time passes for
processes to finish#
7b8 T)ro*$)p*t
It refers to the amount of work comp%eted in a unit of time# +ne way to measure
throughput is by means of number of processes that are comp%eted in a unit of time#
7c8 (aitin$ Ti!e
This is the time spent in a ready 4ueue# The waiting time may be e$pressed as turnaround
time& %ess than the actua% processing time#
7%8 T)ro*$)p*t
It may be defined as inter-a% from the time of submission of a process to the time of its
comp%etion# It is the sum of the periods spent waiting to get into memory& waiting in the
ready 4ueue& C6U time and I*+ operations#
7e8 Response Ti!e
?esponse time may be defined as inter-a% from the time the %ast character of a command
%ine of a program or transaction is entered to the time the %ast resu%t appears on the
termina%# In rea% time system& it may be defined as inter-a% from the time on interna% or
e$terna% e-ent is signa%ed to the time the first instruction of the respecti-e ser-ice routine
is e$ecuted#
Q1'. E&p"ain t)e %ifference beteen pre1e!pti-e sc)e%*"in$ an% non1pre1e!pti-e
sc)e%*"in$.
Ans: 6reempti-e means the operating system mo-es a process from running go ready
without the process re4uesting it# An +S imp%ementing this a%gorithm switches to the
processing of a new re4uest before comp%eting the processing of the current re4uest#
?ound ?obin schedu%ing& priority based schedu%ing or e-ent dri-en schedu%ing and S?T8
are considered to be the preempti-e schedu%ing a%gorithm#
A schedu%ing discip%ine is non:preempti-e if once a process has been a%%otted to
the C6U& the C6U cannot be taken away from the process# A non:preempti-e discip%ine
a%ways processes a schedu%ed re4uest to its comp%etion# In non:preempti-e systems& 'obs
are made to wait by %onger 'obs& but the treatment of a%% processes is fairer# <irst Come
<irst Ser-e .<C<S/& and Shortest =ob <irst .S=</ are considered to be the non:preempti-e
schedu%ing a%gorithms#
Q12. E&p"ain t)e %ifferent sc)e%*"in$ a"$orit)!s.
Ans: The different schedu%ing a%gorithms are e$p%ained be%ow:
718 @irst Co!e @irst Ser-e 7@C@S8
The simp%est schedu%ing a%gorithm is first come first ser-e# =obs are schedu%ed in the
order they are recei-ed# <C<S is non:preempti-e# Imp%ementation is easi%y accomp%ished
by imp%ementing a 4ueue of the processes to be schedu%ed or by storing the time the
process was recei-ed and se%ecting the process with the ear%iest time#
728 S)ortest Aob @irst 7SA@8
This a%gorithm is assigned to the process that has the sma%%est ne$t C6U processing time&
when the C6U is a-ai%ab%e# In case of a tie& <C<S schedu%ing a%gorithm can be used# It is
origina%%y imp%emented in a batch processing en-ironment# S=< re%ied on a time estimate
supp%ied with a batch 'ob#
7'8 Ro*n% Robin 7RR8
?ound robin schedu%ing is a preempti-e a%gorithm that re%ates the process that has been
waiting the %ongest# This is one of the o%dest& simp%est and wide%y used a%gorithms# The
round robin schedu%ing a%gorithm is primari%y used in time sharing and a mu%ti:user
system en-ironment where the primary re4uirement is to pro-ide reasonab%y good
response times and in genera% to share the system fair%y among a%% system users# ,asica%%y
the C6U time is di-ided into time s%ices#
728 S)ortest Re!ainin$ Ti!e Ne&t 7SRTN8
This is the preempti-e -ersion of the shortest 'ob first# This permits a process that enters
the ready %ist to preempt the running process if the time for the new process or for its ne$t
burst is %ess than the remaining time for the running process or for its current burst#
738 Priorit/ Base% or E-ent Dri-en 7ED8
A priority is associated with each process and the schedu%er a%ways picks up the highest
priority process for e$ecution from the ready 4ueue# (4ua% priority processes are
schedu%ed <C<S# The %e-e% of priority may be determined on the basis of resources
re4uirements& processes characteristics and its run time beha-ior#

Das könnte Ihnen auch gefallen