Gives an overview about Process, PCB, Process States, Process Operations, Scheduling, Schedulers, Interprocess communication, shared memory and message passing systems
Size: 7.5 MB
Language: en
Added: Jul 19, 2018
Slides: 46 pages
Slide Content
Process Concept
Process Concept
•Anoperatingsystemexecutesavarietyof
programs:
–Batchsystem–jobs
–Time-sharedsystems–userprogramsortasks
•Manymodernprocessconceptsarestillexpressed
intermsofjobs,(e.g.jobscheduling),andthe
twotermsareoftenusedinterchangeably.
2
OntypicalUNIXsystemstheprocessscheduleristermedsched,and
isgivenPID0.Thefirstthingitdoesatsystemstartuptimeisto
launchinit,whichgivesthatprocessPID1.
Initthenlaunchesallsystemdaemonsanduserlogins,andbecomes
theultimateparentofallotherprocesses.
A typical process tree for a Linux system
Creating a Separate Process via Windows API
Thefigureshowsthemorecomplicated
processforWindows,whichmust
providealloftheparameterinformation
forthenewprocessaspartoftheforking
process.
Processesthatwanttocommunicatemusthaveawaytoreferto
eachother.Theycanuseeitherdirectorindirectcommunication.
Under ,eachprocessthatwantsto
communicatemustexplicitlynametherecipientorsenderofthe
communication.Inthisscheme,thesend()andreceive()primitives
aredefinedas:
•send(P,message)—SendamessagetoprocessP.
•receive(Q,message)—ReceiveamessagefromprocessQ.Acommunicationlinkinthisschemehasthefollowingproperties:
Alinkisestablishedautomaticallybetweeneverypairof
processesthatwanttocommunicate.Theprocessesneedto
knowonlyeachother’sidentitytocommunicate.
Alinkisassociatedwithexactlytwoprocesses.
Betweeneachpairofprocesses,thereexistsexactlyonelink.
40
Naming
I
P
C
Thepreviousschemeexhibitssymmetryinaddressing;thatis,boththe
senderprocessandthereceiverprocessmustnametheotherto
communicate.
Avariantofthisschemeemploysasymmetryinaddressing.Here,only
thesendernamestherecipient;therecipientisnotrequiredtonamethe
sender.Inthisscheme,thesend()andreceive()primitivesaredefinedas
follows:
•send(P,message)—SendamessagetoprocessP.
•receive(id,message)—Receiveamessagefromanyprocess.
Thevariableidissettothenameoftheprocesswithwhich
communicationhastakenplace.
Thedisadvantageinbothoftheseschemes(symmetricand
asymmetric)isthelimitedmodularityoftheresultingprocess
definitions.
Anysuchhard-codingtechniques,whereidentifiersmustbeexplicitly
stated,arelessdesirablethantechniquesinvolvingindirection.
41
Naming
I
P
C
Withindirectcommunication,themessagesaresenttoandreceived
from .
Amailboxcanbeviewedabstractlyasanobjectintowhichmessages
canbeplacedbyprocessesandfromwhichmessagescanberemoved.
Eachmailboxhasauniqueidentification.
Aprocesscancommunicatewithanotherprocessviaanumberof
differentmailboxes,buttwoprocessescancommunicateonlyifthey
haveasharedmailbox.Thesend()andreceive()primitivesaredefined
asfollows:
send(A,message)—SendamessagetomailboxA.
receive(A,message)—ReceiveamessagefrommailboxA.
Inthisscheme,acommunicationlinkhasthefollowingproperties:
Alinkisestablishedbetweenapairofprocessesonlyifbothmembersofthe
pairhaveasharedmailbox.
Alinkmaybeassociatedwithmorethantwoprocesses.
Betweeneachpairofcommunicatingprocesses,anumberofdifferentlinks
mayexist,witheachlinkcorrespondingtoonemailbox
42
Naming –Indirect Communication
I
P
C
AmailboxmaybeownedeitherbyaprocessorbytheOS.
Ifthemailboxisownedbyaprocess(thatis,themailboxispartofthe
addressspaceoftheprocess),thenwedistinguishbetweentheowner
(whichcanonlyreceivemessagesthroughthismailbox)andtheuser
(whichcanonlysendmessagestothemailbox).
Sinceeachmailboxhasauniqueowner,therecanbenoconfusion
aboutwhichprocessshouldreceiveamessagesenttothismailbox.
Whenaprocessthatownsamailboxterminates,themailbox
disappears.Anyprocessthatsubsequentlysendsamessagetothis
mailboxmustbenotifiedthatthemailboxnolongerexists.
AmailboxownedbyanOSisindependentandisnotattachedtoany
process.ThentheOSneedstoprovideamechanismtodothe
following:
Createanewmailbox.
Sendandreceivemessagesthroughthemailbox.
Deleteamailbox.
43
Naming –Indirect Communication
I
P
C
44
Communicationbetweenprocessestakesplacethroughcallsto
send()andreceive()primitives.Therearedifferentdesignoptions
forimplementingeachprimitive.
Messagepassingmaybeeitherblockingornonblocking—also
knownassynchronousandasynchronous.
Thesendingprocessisblockeduntilthe
messageisreceivedbythereceivingprocessorbythemailbox.
.Thesendingprocesssendsthemessageand
resumesoperation.
.Thereceiverblocksuntilamessageis
available.
Thereceiverretrieveseitheravalid
messageoranull.
45
Synchronization
I
P
C
Whethercommunicationisdirectorindirect,messagesexchanged
bycommunicatingprocessesresideinatemporaryqueue.
Basically,suchqueuescanbeimplementedinthreeways:
.Thequeuehasamaximumlengthofzero;thus,the
linkcannothaveanymessageswaitinginit.Inthiscase,thesender
mustblockuntiltherecipientreceivesthemessage.
Thequeuehasfinitelengthn;thus,atmostn
messagescanresideinit.Ifthequeueisnotfullwhenanew
messageissent,themessageisplacedinthequeue,andthesender
cancontinueexecutionwithoutwaiting.Ifthelinkisfull,the
sendermustblockuntilspaceisavailableinthequeue.
Thequeue’slengthispotentiallyinfinite;
thus,anynumberofmessagescanwaitinit.Thesendernever
blocks
.
46
Buffering
I
P
C