Sunteți pe pagina 1din 12

TOPIC 2 COMMUI{ICATION

SLIDES 1
. This week,we are going to considerthe following problem:
Whatcommunicationprimitives are neededin a distributedsystemand how are they used
to implementservicerequests?

SLIDES2
. The overall questionof this topic can be decomposedas follows:
. Whatcommunicationprimitives are neededto implementserviceinvocations?
We are going to review the ISO/OSI referencemodel and implementationsof its layersin
LINIX networksto find out aboutthe supportthat we get for the implementationof service
reQuests'
. How are theseprimitives usedto implementclient/serverconlmunication?
We are going to explain different qualities of servicefor a client/servercommunication
and discussthreeprotocols that achievedifferent levels of quality.
. How can group conxmunication primitives be achieved?
An client/servercommunicationis still a fairly simple primitive that allows two partiesto
communicate.In distributed systems,however, often multiple partieshave to communicateu'ith
eachother.We shall in the third part of this sessionconsidergroup communication,different
levelsof quality and their implementationon the basisof client/servercommunication.

SLIDES3
. Application layer: Protocolsthat are designedto meetthe communicationrequirements
of specific applications,often defining the interfaceto a service.(HTTP, FTP, Telnet,
SMTP, CORBA IIOP)
Presentationlayer: Protocolsat this level transrnitdatain a network representationthat
is independentof the representations usedin individual computers.Encryptionis
performedin this layer if needed. (XDR, CORBAData Representation, encryption)
Sessionlayer:At this level communicationbetweenprocessesis establishedand error
recoveryis performed. It is not requiredfor connectionless communication.
Transport layer: This is the lowestlevel at which messages(ratherthan packets)are
handled.Messagesare addressed to communicationports,Protocolsin this layer may be
connection-oriented or connectionless. (TCP, UDP)
Network layer: Transfersdatapacketsbetweencomputersin a specific network. In a
WAN or an inter-network this involves the generationof a route passingthrough package
switchingexchanges(PSEs)or routers. In a singleLAN no routing is required.(X.25,
IP)
Data link layer: Responsiblefor error-freetransmissionof packetsbetweencomputers
that are directly connected. In a WAN the connectionsare betweenpairs of PSEsand
PSEsand hosts. In a LAN they are pairs of hosts.(PPP, Ethernet. CSMA/CD)
Physical layer: The circuits and hardwarethat drives the network. It transmitssequence
of binary databy analoguesignaling,using amplitudeor frequencymodulation of
eiectricalsignals,light signalsor electromagnetic signals.(1SDl/,Ethernet:baseband
signaling)
SLIDES4
. The Internetprotocol suite (I.e., a completeset of protocol layers)provides two types of
transport-laYerservice:
. TCp is a connection-orientedservicethat transmitsstreamsof bytes acrossa pre-
establishedconnection
to a
UDp is a connectionlessservicethat transmitsmessagesof up to 64 kilobytes
+ port
specifieddestination(a communicationidentifier which is IP address
number).
' tor"'l;fi::f*::;3j,fftrTrf,:fit?ffiffiff:Hn,,isset asendin
upbetween
data.
and receiving processand is usedfor the transmissionof a streamof
sequencingand acknowledgementare included.
are
connectiorrl"rr, in which individual messages,known as datagtams'
(Upper
transmittedto specifieddestinations.No sequencingor acknowledgement.
layer like RPC shoulddealwith the messageloss.)
' Netw"'t*|f; the
ofavirtuatcircuitinvolves
:}'ffI ff.!|rll,,.,,.rr, rheestablishment
passingthrough a
identification of a route from the sourceto the destination,
circuit
number of packet switches.Each network-layerpacket containsa virtual
the
number which includesthe destinationid. Packetsare reassembledin
transportlayer using a channelid or sender'saddress'
that
Datagrampacket dJivery (e.g.,Ip): Each network-level packet contains
Pre-defined
network addressof the ,o*"J computerand the destinationcomputer.
next step along the
routing tables at eachswitch along the route determinethe
route.

SLIDES 5 'th
. The TCP(rD protocolprovides fhe qession
^*nrn...,l ,.rnrzi;es the laver of
sessionlayer one componentwt a facility to send
of one
can read the data from
unstructureddata into a stream and another distributed component
datato be
the stream agarn.At the sametime that component can write unstructured
returned into that stream so that the first componentcan read the result.
. TCp hasto decomposedatathat is written into the streaminto packagesthat can be
at the other end' As
transmitted by the network layer and composethe packagesugu!\
which packagesare
somenetwork protocols (such as IP) may not retain the order with
into a readablestream'
sent,TCp must sort the packagesbefore they can be composed
. The connectionbetweenthe two distributedcomponentsmust be establishedby the
has to be destroyedwhen
sessionlayer before the bi-directional stream"un b. used and it
you issuean rlogin commandto
the streamis no longer required.This is what happensif
a remotehost, of which have to provide the address'
will
. TCp providesthe presentationliyer with a reliable protocol, becausethe protocol
detectlost packages(during sorting them)'
TcP
. As the two endsconnectedlv the Jtream'mayhave a different computation speed,
decoupled'
buffers the streamso that the two processesare (partially)

SLIDES 6
UDp providesthe presentationlayer of a componentwith the capabilityto sendmessages
containingunstructureddatato the presentationlayer of an identified other distributed
component.
Dependingon the messagesizeof the UDP implementation(usually 64 KBytes) and the
pu.kug. ,ir. r*pported by the underlying network (8KB1'tesin IP networks),the UDP
implementationhasto decomposemessagesinto one or more network packages.
Efficient becauseno overheadfor connectionestabiishmentif only a few messagesare to
be erchanged.
UDp is unreliablebecauseit doesnot detectmessages that are lost completely.
UDP queuesmessagesin the order of arrival at the receiving component.
The rwho commandis an exampleof a TINIX commandthat is implementedon top of
UDp. rwho asksdaemonson rernotemachinesfor the list of userswho are currently
loggedin. It doesso by sendingUDP messages to thesedaemonsand the daemons
respondwith a messagecontaininga list of usernames.
TCp is often usedfor bulk datatransferwhere the overheadof establishinga
communicationlink is small comparedto the number of packetsthat the network hasto
exchange.UDp is often usedfor client/servercommunicationthat usually involvesonly a
small number of packetsto be sentback and forth'

SLIDES7
. Complex datatypesare defined in the appiicationlayer.
. Transmittingthe complex valuesthrough the transportlayer is required.
. Issuesin the presentaiionlayer include the transformationof complex datastructuresand
heterogeneousdatarepresentationon different hardwareplatforms.

SLIDES8
. Marshallingis the processof taking a collectionof dataitemsand assemblingthem into a
form suitablefor transmissionin a message.It consistsof both the flattening of a
structureddata items into a sequenceof basic dataitems and the transiationof those data
items into an external datarepresentation.
. Unmarshalingis the processof dirurremblingthem on arrival to producean equivalent
collection of dataitemsat the destination.It consistsof the translationfrom the external
datarepresentation to the local one and the unflatteningof the dataitems.
. Marshalling by hand: A simple way of marshallingb), hand is to sonvert the items to an
affayof ASCII charactersbeforetransmission.For example,flat ASCII data
"5 Smith6 London 7934"
canrepresentmessagelike (in Sun ExternalData Representation XDR 4-b1teobjects):
5 length of sequence
"Smit" part of string
,rh-r, part of string
6 length of sequence
"Lond" part of string
tto n - t'
part of string
r934 unsignedlong integer
SLIDES9
. Different hardware and operating systemplatforms use different representationsfor
elementarydatatypessuch as integersand characters:
. Most modern operatingsystemsrepresent16-bit integersas two bytes, where the
most significant byte comesfirst. Older machines,such as IBM mainframes,
representtheseintegersexactly the other way around.
. There arealso different ehcodingsfor charactersets.Charactersmay be encoded
as 7-bit ASCII, in the ISO 8-bit characterset or in the emerging16-bit
representation,which accountsfor the representationof Asian charactersas well.
.. Distributed operatingsystemsresolvethesedifferenceswithin the presentationlayer so as
to enableheterogeneouscomponentsto cofirmunicatewith each other.
. There are different approaches.One is to convert dataduring marshalling into a common
and well defined representation.An exampleof this is Sun's External Data
Representation,which is used in most RPC implementations.
. Another approachis the abstractsyntax notation ASN.l that was standardizedby the
CCITT. It provides a notation for including the type definition togetherwith eachvalue
into the marshaledrepresentation.

SLIDES10
. CORBA Common Data Representation(CDR) is the external datarepresentationdefined
with CORBA 2.0 rn2004.
. CDR defineshow application layer datatypesare representedin a byte streamand
achievesan unambiguousdefinition of the messageacrossdifferent hardwareplatforms
that may use different number representationor characterencodings.
. Thereare 15 primitive types: short (16-bit),long (32-bit),unsignedshort,unsignedlong,
float (32-bit),double(64-bit), char,boolean(TRUE, FALSE), octet (8-bit), and any
(which can representany basic or constructedtype). The constructedtypes are shown in
the next slide.

SLIDES11
. The primitive valuesthat compriseeachconstructedtype are addedto a sequenceof
bytes in a particular order, as shown here.

SLIDES12
. This slide showsa messagein CORBA CDR that containsthe three fields of a struct
whoserespectivetypes arestring, string andunsignedlong.It showsthe sequenceof
byteswith four bytes in eachrow.
. The representationof eachstring consistsof an unsignedlong representingits length
followed by the characters(assuming1 byte for eachcharacter)in the string.
. Although the exampleis simple, it can representany datastructurethat can be composed
from the primitive and constructedtypes,but without pointers.

SLIDES13
. Dataheterogeneityinclude different datarepresentationformats due to different hardwar
or different representationsof complex data structuresin run-time environmentsof
different programming languages.
A,big-endian' (the word is stored"big-end-first")representation (e.g.,Unisys,IBM
mainf,ame)of integer meansthat the most significant byte is at the first of a four-bFe
(the
sequence(i..., thosi with a lower address).The sameintegerhas a'little-endian'
,.little-end-first") representationwith the lowest-significantb:4e at the first
word is stored
the number
of the sequence(e.g.,modernUnix or PC Windows).For example,consider
00000000
IAZ5(2tothe tentlipower plus one) storedin a 4-byteinteger: 50000000
00000100 00000001(S: signbit)
Address Big-Endian Little-Endian
00 s0000000 00000001
01 00000000 00000100
02 00000100 00000000
03 00000001 s0000000
Coded
Different encodingschemesfor charactersetsinclude the 8-bit ExtendedBinary
DecimalIntercharigeCode (EBCDIC),7-brtAmerican StandardCode for Information
16-bit
Exchange(ASClf]extended 8-bit ISO-8859-1Latin-1 characterset,and the
UniversalCharacterSet (UCS).
characters
The pascalrepresentationof a characterstring beginswith the number of
first character and
included in the strings,while the C representationstartswith the
terminateswith a byte that is null (\0).
(resolution)
Heterogeneousdatahaveto be convertedfrom host to host. The conversion
by a
can be done either at the representation\ayer,at the applicationlayer, or resolved
platform.
(e'g',
Resolutionin the presentationlayer is to use a standardrzeddatarepresentation
CDR). Resolutionin the applicationlayeris domain-specific, using STEP,ASN'1,
(e'g., JavaVirtual
SGML or XML. Resolutionby a platform is to usea virtual machine
Machine).

SLIDES14
. We are now going to discussdifferent communicationpatternsthat are frequently usedin
and receive
distributeasystems.The descriptionrelies on basicoperationsthat can send
messages.
' rhis*'Jilfl1"Jffi'Jffi?t::li:";:ii"r.utosend between
messases
receive
and
distributedcomPonents
can be
Complex datasiructurescan be marshaledand unmarshaledso that they
transportedbY messages.
. We arethen going to discusssynchronousand asynchronous messagedelivery'
client and
Synchronousdelivery is very often used for the communicationbetween
do not occur with
server,but has the disadvantageof communicationdeadlocks,which
asynchronous deliverY.
. Messages(be they synchronousor asynchronous) arethen usedto model two
andrequests'
communicationpatternsthat occur very frequently.These arenotifications
informs a receiver
A notification is a one-way communicationpattern,u,'herethe sender
pattern,where the sende
about a certain incident. A ,.qu.st is a two-way communisation
expectsthe delivery of a resultfrom the receiver.
SLIDES15
. In synchronouscommunicationthe sendingand receiving processessynchronizeat every
message.Both the Sendand Receiveare blocking operations. Whenevera Sendis
issuedthe sendingprocessis blocked until the correspondingReceiveis issued.
Whenevera Receiveis issuedthe processblocks until a messagearrives.

SLIDES16
. Communicationdeadlockshappenwhen componentsare mutually waiting for eachother.
. Two ways to deal with this pr-oblem:Deadlock avoidanceand deadlockdetection(and

"-:'?:ii[:[ffij3ffi:,,,Yfi'fi
il*anappr
.::il'#:1ll1ti1#;?:l?'f
time-out interval?)

SLIDES17
. In asynchronouscornmunication,the use of the Sendoperationis non-blocking in that the
sendingprocessis allowed to proceedas soon as the messagehas been copied to a local
buffer und th. transmissionof the messageproceedsin parallel with the sendingprocess.
. The Receiveoperationcan have blocking and non-blocking variants.In the non-blocking
variant;the receiving processproceedswith its program after issuing a Receiveoperation
which provides a buffer to be frlled in the background,but it must separatelyreceive
notification that its buffer has been filled, by polling or interrupt-
. In a systemenvironmentthat supportsmultiple threadsin a single process,blocking
Receivecan be issuedby one threadwhile other threadsin the processremain active, and
the simplicity of synchronizingthe receiving threadswith the incoming messageis a
substantialadvantage.
. Non-blocking communicationappearsto be more efficient, but it involves extra
complexity in the receiving processassociatedwith the needto acquirethe incoming
^ messageout of its flow of control.

SLIDES18
. In the notification protocol, sendersendsmessageto a receiver.
. Messageusually containsmarshalednotification parameters.The data needto be
marshaled("fl attened")for communication purpose.
. Location-independentidentifiers for destinations:the identifier is mappedonto a lower-
level addressin order to deliver a message.Servicescan be relocatedwithout having to
inform clients about their new locations'
. Messagedestinationsare usually eitherprocessesor ports. A port is one several
alternativepoints of entry to a receiving process.
. ports are sometimescalled mailboxes - a mailbox always has a messagequeue'whereas'
port may or may not have one'
. ,,port,,describesthat there are severalalternativepoints of communicationto a receiving

*"i'T:::,.g,#,P.
process.Multiple ports can be usedby aprocessto receivemessages.

\
recelve (p, msg)
wherep could be eithera processid or port id

SLIDES19
' Requestersendsa requestto the provider. The requestmessagecontainsmarshaled
requestparameters.
' After the serviceis done,the provider sendsa reply to the requester.The reply message
containsmarshaledreply results.

SLIDES20
' The term unreliablemessageis usedto refer to a single messagetransmittedfrom sender
to receiver,without acknowledgementor retries.
' In a network,messagesmay be lost, duplicated,deliveredout of order or delayed.
' Messagesmay occasionallybe droppedeitherbecauseof a checksumeffor or because
there is no availablebuffer spaceat the sourceor destination.
o { reliabledelivery servicemay be constructedfrom an unreliableone by the useof
acknowledgement.Positiveacknowledgements are usedin client-servercommunication,
uthile negativeacknowledgementscan be useful in group multicast.

'*:'Tf
il:"#f T,::ffi
n:1:r'ff;""
lf':*::tffdfi
. possiblelatencyfor senderor reJeiver
' The managementof messagesrequiresthat eachmessageshouldhave a uniquemessage
identifierby which it may be referenced.A messageidentifier consistsof two parts:
A requestldwhich is takenfrom a sequenceof integersby the sendingprocess
(for messagere-assembly)
' an identifier for the senderprocess,e.g.,the port on which to receivereplies

SLIDES21
' The client/servermodel underliesalmosteverydistributedsystem.Henceit is important
to understandthe principles of client/servercommunication.
' In this secondpart, we are going to usethe knowledgeaboutcommunicationprimitives
that we just acquiredto explainthe principlesof client/servercommunication.
' In client/servercommunicationmany things can go wrong anda good client/server
communicationprotocoltakesthis into accountand deliversreliableresultsevenin the
o"t'n'il,o.|3lf;,"
occasiona'y
dropped.
. Network may besomepartitioned.

: ff::ffiffi#'l:uu,as byerror-checking
ensured mechanisms
atthenetwork
level.
. We are going to discussdifferentdegreesof quality of serviceas a basisfor the
discussionof threeclient serverprotocols.
. The simplestof theseprotocolsis the requestprotocol,which only achievesa
timited quality and cannotgenerallybe applied.
. The most importantprotocolis the request/replyprotocol.It deliverseitherthe
resultof a serviceexecutionor a failure to the client.
. protocol.
An optimization is the request/reply/acknowledgement

SLIDES22
. Exactly once:This is the ideal situation,where a servicerequestis handledin the same
way as a local procedurecall in an imperative programminglanguage.The serviceis
executedonce and only once. It is, however, very difficult and expensiveto achieve.
. At mostonce;The servicerequest may or may not be or havebeenexecuted.Therewill
be no side effectsfrom partial execution.If the serviceis not executedthe client is being
informed of the failure.
. At leastonce;The call may be onceor more than one time. This quality of servicecan
only be reasonablyapplied if the servicedoesnot updateits internal memory.
. Maybe; Itis neither guaranteedthat the servicehas been executednor is the client
informed of failure occurrencesshouldthere be any.

SLIDES23
. The R protocol may be used when there is no value to be returnedfrom the procedureand
the client requiresno confirmation that the procedurehas been executed. The client may
proceedimmediately after the requestmessageis sentas there is no needto wait for a
reply message.

SLIDES24
. The RR protocol is useful for most client-serverexchangesbecauseit is basedon the
request-replyprotocol. Specialacknowledgementmessagesare not required becausea
server'sreply messageis regardedas an acknowledgementof the client's request
message.Similarly, u subsequentcall from a client may be regardedas an
acknowledgement of a server'sreply message.

SLIDES25
. The RRA protocol is basedon the exchangeof three messages:request-reply-
acknowledgereply. The acknowledgereply messagecontainsthe requestldfrom the
reply messagebeing acknowledged. The arrival of a requestldin an acknowledgement
messagewill be interpretedas acknowledgingthe receipt of all reply messageswith
lower requestlds,so the loss of an acknowledgementmessageis harmless.
. Although the exchangeinvolves an additional message,it neednot block the client as
acknowledgementmay be transmitted afterthe reply has been given to the client, but it
doesuseprocessingand network resources.

SLIDES26
. The communicationpatternthat we have seenso far was bi-lateral in the sensethere wer€
only two partiesinvolved, client and server.
. Moreover, it was intimate as the client componentalways had to identify the server
component.
. There are other forms of communicationrequiredin many distributed systemsthat can be
summarizedunder the term group communication.
' As
:""T:f;;:l|#''JJi:fi:::il*o*,.,oants need oranupdate
tobenotined
A searchenginecan be impiementedin a way that it sendsqueriesto a group of
componentsstoring information and then privately cornmunicateswith those
componentswho found a match for the query.
The replicationof a logical componentto increasea system'sfault tolerance
involvescommunicationwith all replicawhenevera serviceis requestedfrom the
logical component.
' The communicationrequired in all theseexamplescan be characterizedby the fact that
they involve multiple componentsand that the senderdoesnot necessarilyknow the
identity of the receivers.

SLIDES27
' Broadcastand multicastare similar: one sendsmessageto a group,and the other send
messageto a subgroup.
' Multicastmessagesare a very usefultool for constructingdistributedsystemswith the
roIIowing
;llfr::'#ll T;, onrepricated
service
s
"o
: inffi:,t,iln::
.
fi:n?i':3Jffi:i1","
Muitiple update

SLIDES28
' Ideal messagedelivery is immediateand reliable. This is impossibleto be achievedin
distributedsystems.
' Optimal messagedelivery is simultaneousand reliable. This is also unlikely to be
achieved.

SLIDES29
' In reality,messagedelivery is neithersimultaneousnor reliable.

SLIDES30
' It is very hard to deliver a reliablebroadcast/multicast
and it is thereforecostly in terms
of developmentand also in the performancethat can be achieved.
' Thereforedifferent degreesfor the quality of servicehave beenidentified and it is up to
the designerof a distributed systemto choosean appropriatedegreefor a particular group
communicationproblem.
' Best effort is the lowest of thesedegrees.No explicit measureare takento
guaranteea certain quaiity.
' K-reliability is a guaranteethat at leastk messagesare going to be deliveredto
their recipients.
' Totally-ordereddelivery refersto the fact that messagesof one communication
cycie are not overtakenby alater cycle. That is, the messagesreachali of the
membersof the group in the sameorder. When this appliesto all the messages
sentto a group from all the senders,it could be very expensiveto guarantee.
' Atomicity denotesthe fact that eithermessagesare deliveredto all recipientsor to
none at all.
. Higher levels of quality are in generalhard and expensiveto achieve.They may also not
neededin all application areas.
. You shouldthereforecarefully choosethe quality of servicethat you need for a particular
group communicationproblem in a distributed system.You should then be preparedto
pay the price for it.
. Stablemessage:if no further msg with a lower msg id is expected.This is done If the
originator could assignmsg id with a common global ordering, or it could generatethe
next msg id in a sequence.

SLIDES31
. In the OMG/CORBA architecture,group conlmunication for multicasts are supportedon
top of standardCORBA operationinvocation requests.This supportis provided as part of
the CORBA servicesarchitecturewithin the event managementservice.
. Consequently,the serviceexportsa number of interfacesand operations,which are
specifiedin IDL. This specificationis included as an appendixto thesenotes.
. The serviceidentifies three different roles. Eventproducers createeventsthat are to be
multicastedto consumers.An eventchannel acts as a mediatorbetweenthesetwo so that
producersand consumersare anonymousand do not know eachother. The advantagesof
* tt*!;lffiLmmunications
in
andconsumers
for anynumberof suppliers
connectionwith a given type of event.
. Events can be buffered to allow for consumersof different speeds.
. The eventscan be persistentlystoredby the Event Channelto ensurethat events
are not lost on systemfailures. The storedevent can be transactional(updates
dependon commits/aborts).
. Supportpush/pull consumers/suppliers.
. The servicespecification,however, doesnot include any guidelinesfor quality of
services.This is left to the companieswho produceevent managementservice
implementations.

SLIDES32
. There are two different models of event communicationin the CORBA event
management:a push and apull model. They differ in who takesthe initiative to geta
group communicationstarted.The flow of information is in both sasesfrom producersto
consumers.
. In the CORBA approachof multicasting, event channelsare the mechanismto identify
the subgroupof event consumerobjectsthat are to be notified about a certain event.
Event consumersthereforeregisterwith those event channelsthat correspondto events
they are interestedin.
. Eventsare createdby event producers.To do so, they requesta push operationexecution
from the event channel and passthe eventparametersas parametersof that push
operation.
. The event channelthen requestsall the event consumersthat are currently registeredto
executea push operationand passesthe parametersit had earlier receivedfrom the
producer.
7

SLIDES33
. As anexample,consideran applicationthatdisplaysthe changeof sharevaluesduring
tradingat a stockexchange.
This is a distributedsystembecausebrokersare locatedall over the City and alsobrokers
in Hong Kong, New York and Tokyo might be interestedin what's going on in the
London stock exchange.
Whenevera deal is agreed,a shareobject changesits value to take the last deal into
account.Then all applicationson broker's displayshaveto be updatedto reflectthe
share'snew value.
This can be implementedwith CORBA event management:
. Sharesare representedas CORBA objectsand they have operationswith which
the stock erchange'strading systemcan modify their values.
. An event channelobject is maintainedfor eachshareobject. Applications that
display the currentvalue of a shareobject registeras consumerswith the event
channelassociatedto that shareobject to be informed about ongoing trade in the
share.
. Wheneverthe stock exchange'strading systemupdatesthe value of the share,the
shareobject (as an eventproducer)pushesthe new sharevalue togetherwith
relatedinformation(suchas volume of the deal and the time the dealwas closed)
into the event channel.
. The event channelthen forwards this information to ail applicationsthat are
registeredand invokes their push operationtogetherwith additionai event
parameters.

SLIDES34
. In the pull model initiative startsfrom the consumer.The consumerasksthe event
channelabout a new event and the channelhasto know who is capableof producing it.
. Event producers,therefore,registerwith event channeiand declarethat they are capable
of producingevents.
The control flow is then exactly the other way aroundas in the pull model. Consumer
objectsask the event channelto deliver an event.
The event channelthen asksthe producerto createan eventwhich is then deliveredto
consumers.
This in its pure form is not yet a group communication,but rather an anonymousrequest
wherethe eventchannelactsas a brokerbetweenconsumerand producer.
However, the pull and the push model can be combined,so that the event channelafter
having receivedthe errentfrom the producercommunicatesit to all consumersso that
they ali have up-to-dateinformation.

SLIDES35
. To continuethe sharevalue displayapplication,in a puil model, one consumerwould ask
the event channelabout the currentvalue of a share,by invoking the pull operationof the
channel,
. The errentchannelwould then invoke the pull operationfrom the producerto obtain the
currentvalue.
. The producerwould passthat as an out parameterof the pull operationand the event
charrnelwould do the same.
. In the combinedmodel, the event channelwould then also inform the secondconsumer
aboutthe current value by invoking its push operation.

SLiDES36
. Event Channelsupportsall four different combinations.
. Pushsuppliers,push consumers:the supplierspush eventsto the Event Channel,which in
turn pushesthem to the consumers.
. Pushsuppliers,puli consumers:the supplierspush eventsto the Event Channel,and each
pull consumerpulls an event when it is ready to processit.
. Pull suppliers,push consumers:the Event Channelpulls eventsfrom the suppliers,and
then it pushesthesetot he consumers.
. Pull suppliers,puli consumers:the consumerspull event from the Event Channel,which
in turn pulls them from the suppliers.

SLIDES37
. d push supplier expectsto make calls to push0 on a PushConsumerobject (see
Appendix): this object is provided within the Event Channel,and is refereedto as a proxy
pushconsumer.
o f pull consumerexpectsto make cails to the pu110and try_puil$ operationson a pull
supplierobject: this object is provided within the Event Channel,and is referredto as a
proxy pull supplier.
. A pull supplierexpectsto have a pull consumermake calls to its pull0 operation:the
Event Channeiprovides this obj ect, aproxy pull consumer,to make thesesalls.
. A push consumerexpectsto have a push suppliermake calls to its push0 operation:the
Event Channelprovidesthis object, aproxy push supplier,to make thesecalls.

SLIDES38
. ReadChapter3 to Chapter4 of the Textbook.

S-ar putea să vă placă și