Operating Systems CS 5523
Popular in Course
Popular in ComputerScienence
verified elite notetaker
This 12 page Class Notes was uploaded by Mireya Heidenreich on Thursday October 29, 2015. The Class Notes belongs to CS 5523 at University of Texas at San Antonio taught by Staff in Fall. Since its upload, it has received 12 views. For similar materials see /class/231395/cs-5523-university-of-texas-at-san-antonio in ComputerScienence at University of Texas at San Antonio.
Reviews for Operating Systems
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 10/29/15
CS 5523 Lecture 8 Introduction to Remote invocation I Questions on Laboratory 1 I Models of programming in distributed systems I Objects and remote objects I Remote invocation and remote object references I A simple Hello World application in CORBA I Marshaling Programming models for distributed applications I Remote method invocation RMI an object in one process can invoke methods of objects in another process I Remote procedure call RPC client calls the procedure in a server program thatis running in a different process I Event noti cation objects receive noti cation of events at other objects for which they have registered These mechanism must be locationtransparent The rst two are traditional clientserver pull while event noti cation is a push strategy Basic steps for clientserver pull strategies I Client or its proxy marshals the information that would be used forlocal access do operation call or invocation into a message and sends to the remote server I The server or its proxy unmarshalls the message and performs the request as though it were made locally I The server or its proxy then marshals the result into a message and sends it to the remote client I The client orits proxy unmarshalls the message and treats the result as though it were obtained locally Whatis a proxy and why mightit be useful Marshalling I marshaling process of transforming a collection of data items into a form suitable for transmission as a message I unmarshalling process of disassembling a message into its premarshalled equivalent The process requires a prede ned format Examples I XDR standardized external data representation RPC I CORBA common data representation CDR I Java object serialization Java RIW I Convert to ASCII HTTP I Microsoft s format Figure 51 Middleware layers wartime Middleware I layers m m mm waging m Ixshlchx39sGmdefm CmdmmDnnmndemdhexg mamaka ComeptsmdDeslgn m 1 AdmsereslAyPublnhas mm Systems that support RMI I CORBA Common Object Request Broker Architecture I Java RMI I Microsoft s Distributed Common Object Model DCOM now COM I SOAPNE T Review of objects I An object encapsulates both data and methods I Objects are accessed via object references I Interfaces provide de nitions of signature of a set of methods I Actions are performed in CO by having objects invoke methods of other objects the invoker is called a client of the object I Invocation can cause I the state of the receiver to be changed modi er methods I additional invocations of methods on other objects I Exceptions are thrown when an error occurs lf object doesn t catch the exception the exception is delivered to the caller similar to signals but at the programming language level Figure 53 Remote and local method invocations remote t Invoca on mum39s smug cm Mm demdbexg mamaqu Contains mama m 3 AdmseresleyPlbhshz mm Figure 54 A remote object and its remote interface remote ob39ect Data remote interface implementation of methods mum39s Gmdefuz cm Mm demdhexg mamaqu Contains Design an 3 AddlseresllYPlbl he mm Remote object reference I An object musthave the remote object reference of an object in order to do remote invocation of an object I Remote object references may be passed as input arguments or returned as output arguments I Parameters of a method in Java are input parameters I Returned result of a method in Java is the output parameter I Objects are sen39aized to be passed as parameters I When a remote object reference is returned it can be used to invoke remote methods I Nonremote sen39alizable objects are copied by value Remote object reference I An object musthave the remote object reference of an object in order to do remote invocation of an object I Remote object references may be passed as input arguments or returned as output arguments Figure 410 Representation of a remote object reference 32 bits 32 bits 32 bits 32 bits interface of remote object Internet addressl port number time I object number mum39s Gmdefuz cm mm demdhexg mamaqu Germans mama m 3 AddlseresllYPlbl hz mm Remote interface RMI I The remote interface speci es the methods of an object that are available for remote invocation I Input and output parameters are speci ed The parameters may be objects I Use I When the remote method is invoked the actual arguments corresponding to the input parameters are marshaled into a packet and sent to the server I The server demarshas the packet performs the procedure remarshas the output arguments and sends the return packet to the caller I Client demarshas the return packet I Need a common format de nition for how to pass objects eg CORBA IDL or Java RIW Interfaces I Specify procedures methods and variables that can be accessed in a module I No information other than that speci ed by the interface can be communicated I Do not specify an implementation l Types of interfaces I Service interface RPC I Remote interface RMI Remote interface I CORBA uses IDL to specify remote interfaces l JAVA uses ordinary interfaces that are extended by the keyword remo te Example of CORBA IDL module HelloApp interface Hello string sayHellO oneway VOld shutdown l l Map into Java by running the lDLtojava ldlj efall Hellomu This generates the following les in the HeloApp subdirectory Hellojava HelloHeperjava HelloHoderjava HelloOperationsjava HelloPOAjava andHeIoStubjava HelloCIientjava lmport HelloAppf lmport orgomgcosNamlng import org omg CosNamlng Namlngcontext Package t lmport orgomgCORBA publlc class Hellocllent Static Hello hellolmpl publlc statlc vold maln5trlng arg5 tr ORB orb ORB1n1t args null create and lnltlallze the OR get the root m g co orgomgCORBAObect objRef orbr solveilnltlalireferencesquotNameservlcequot Use NamlngContextExt lnstead of Namlngcontext Thls 1s part of the Interoperable namlng Servlce ncRe trlng name quotHelloquot resolve the Object Reference 1n Namlng elpernarrow ncRefmesolveistr name gt SystemoutprlntlnquotObtalned an l o yste prlntlnhelloImplsayHello n erver object quot hellolmpl 5 out hellolmplshutdow catch Exceptlon e SystemoutprlntlnquotERROR quot e eprlnt5tackTraceSystemout HelloServerjava HelloServerjava Copyrlght and Llcense lmport HelloApp orgomgcosNaml org omg org omgPortableServer lmport orgomgPortableServerPOA lmport ng M lmport org omg CosNamlng Namlngcontext Package t lmport CORBA t lmport lmport java utll Propertles class Hellolmpl extends HelloPOA prlvate ORB orb publlc VOld setoRBltoRB orbival orb orbival lmplement sayHello method publlc String sayHelloo eturn quotnHello world llnquot lmplement shutdown method publlc Vold shutdowno orbshutdown false HelloServerjava continued publlc class HelloServer t publlc static Void maln5tr1ng args try ORB orb ORB1n1targs null create and 1n1t1allze the ORB get reference to rootpoa a a 1vate the POAManager POA rootpoa POAHelpernarroworbresolveilnltlalireferencesquotRootPOAquot theiPOAManageractlvate helloImpl new HelloImpl create servant and reglster 1t w1th the ORB helloImplsetORBorb get object reference from the servant rm mm c pa hject r f a r tn r wt to loImpl Hello href HelloHelpernarrowref 7 get the root naming context Olveilnltlalireference quotNameservlcequot 39 rbres which 15 part of the Interoperable Namlng Servlce INS spec J ef orgomgCORBAObect objRef o Use amlngContextExt ncRef String name quotHelloquot blnd the Namecomponent path ncReftoiname name ncRefreb1ndpath href ystemoutpr1ntlnquot elloserver ready and waiting quot t5 Object Reference 1n Naming orbrun Walt for 1nvocat10n5 from 311611 catch E ptl n e systemerr r1ntlnquotERROR quot e P epr1nt5tackTrace systemout Systemoutpr1ntlnquotHelloServer Exiting Running CORBA server on pandora port 20000 I Compile the client and server javac HelloCllentjava HelloAppjava javac HelloServerjava HelloAppjava I Start the Java Object Request Broker Daemon on server host orbd ORBInltlalPort 20000 ORBIDltlalHOSt pandoracsutsaedu amp I Start the HelloServer on server host java HelloServer ORBInltlalPort 20000 I Start the client on another machine say ten23 java HelloCllent ORBIDltlalHOSt pandoracsutsaedu ORBInltlalPort 20000 I Be sure to kill your orbd when nished Why is this easier than just doing sockets Figure 47 CORBA CDR for constructed types Tvve sequmce string may struct enumerated union length unsigned long followed by elernenm in order length unsigned long followed by characters in order can also can have wide characters array elernenm in order no lenth speci ed because it is xed in the order of declaration of the components unsigned long the values are speci ed by the order declared type tag followed b L mum39s outletm cm Mm demdhexg mamach Contains mama m 3 AddnsuanesleyPlblnh mm Figure 48 CORBA CDR message index in notes on representation length of string Smith length of string London unsigned long The flattened form represents aPerson struct with value Smith London 1934 mum39s Gmdu39uz cm mm demdhexg mamaqu Contains AndDeslgn m 3 AdmseresleyPlbhshz mm Figure 49 Indication of Java serialized form Explanation class name version number number type and name of name instance variables 1934 5 Smith 6 London hl values of instance variables 3 int year The true serialized form contains additional type markers no and h l are handles mum39s Gmdu39uz cm mm demdhexg mamaqu Contains AndDeslgn m 3 AdmseresleyPlbhshz mm
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'