La descarga está en progreso. Por favor, espere

La descarga está en progreso. Por favor, espere

Java RMI vrs. CORBA y el objeto Parallel CORBA

Presentaciones similares


Presentación del tema: "Java RMI vrs. CORBA y el objeto Parallel CORBA"— Transcripción de la presentación:

1 Java RMI vrs. CORBA y el objeto Parallel CORBA
Parallel and Distributed Computing Using Java

2 CONTENIDO Introducción a CORBA CORBA Vrs. RMI Parallel CORBA Object
Conclusiones

3 Que es CORBA? Acrónimo de: Common Object Request Broker Architecture.
Estándar desarrollado y mantenido por OMG (Object Management Group). Intenta ser un marco genérico para trabajar con objetos en forma distribuida. Independiente de la plataforma y del lenguaje de programación. Integración con sistemas heredados y nuevas tecnologías. Transparencia de redes, lenguajes, OS, modelo de objetos, paradigma, administración et.

4 Arquitectura Básica CORBA. (1/3)
Consiste de : Object Request Broker (ORB), que provee los medios para la comunicación cliente / servidor. Interface Definition Languge (IDL), usado para la definición de interfases estáticas de los objetos. Dinamic Invocation Interface (DII) y Dinamic Scheleton Interface (DSI), utilizada para obtener interfaces dinami-camente desde un repositorio. Permiten acceder a objetos sin “stubs” y “skeletons” de un tipo especifico. En tiempo de ejecución el cliente pude determinar la Interface a un objeto del cual a recibido referencia. Llamar objetos sin tener que conocer su Interface también en tiempo de ejecución

5 Arquitectura Básica CORBA. (2/3)
También especifica un protocolo de comunicación entre ORBs llamado Internet Inter_ORB Protocol (IIOP) “Stubs” que son procedimientos locales correspon-dientes a una única operación, que ejecutan cuando son llamados. Esqueletos de Objetos “Object skeleton”. Los “Stubs” y los esqueletos de objetos sirven como proxis para clientes y servidores.

6 Arquitectura Básica CORBA. (3/3)

7 Como funciona CORBA? (1/3)
Se debe compilar la IDL en “stubs” y “object skeletons”. Se escribe un un objeto y su cliente. “Stubs” y “Skeletons” actúan como proxis para el cliente y el servidor respectivamente . IDL define la interfaz tan estrictamente que el “stub” en el cliente no tiene incompatibilidad con el “eskeleton” en el servidor. Esto sucede incluso si se utilizan diferentes lenguajes u ORBs de diferentes proveedores.

8 Como funciona CORBA? (2/3)
Cada objeto CORBA tiene un identificador único (object reference). Los clientes utilizan estas referencias para dirigir sus invocaciones. De esta manera indican al ORB cual es la instancia exacta que se invoca. El cliente actúa como si estaría actuando sobre el objeto pero lo hace sobre el “stub” IDL que actúa como proxi. Este pedido atraviesa el “stub” continua por el ORB y en lado de la implementación a través del “skeleton” para obtener el objeto donde se ejecuta.

9 Como funciona CORBA? (3/3)
Para una invocación remota utiliza el mismo código pero con la referencia remota. Cuando el ORB detecta que se trata de un objeto remoto lo direcciona por la red. Para esto se requiere dos cosas: Que el cliente sepa exactamente que operaciones puede ejecutar. Que el cliente y la implementación estén de acuerdo en el protocolo (IIOP).

10 Algunos servicios CORBA.
Service Description Object life cycle Defines how CORBA objects are created, removed, moved, and copied Naming Defines how CORBA objects can have friendly symbolic names Events Decouples the communication between distributed objects Relationships Provides arbitrary typed n-ary relationships between CORBA objects Externalization Coordinates the transformation of CORBA objects to and from external media Transactions Coordinates atomic access to CORBA objects Concurrency Control Provides a locking service for CORBA objects in order to ensure serializable access Property Supports the association of name-value pairs with CORBA objects Trader Supports the finding of CORBA objects based on properties describing the service offered by the object

11 Implementaciones de CORBA para Java?
Existen varios proveedores: The Java 2 ORB The Java 2 ORB comes with Sun's Java 2 SDK. It is missing several features. VisiBroker for Java A popular Java ORB from Inprise Corporation. VisiBroker is also embedded in other products. For example, it is the ORB that is embedded in the Netscape Communicator browser. OrbixWeb A popular Java ORB from Iona Technologies. WebSphere A popular application server with an ORB from IBM. Netscape Communicator Netscape browsers have a version of VisiBroker embedded in them. Applets can issue request on CORBA objects without downloading ORB classes into the browser. They are already there. Various free or shareware ORBs CORBA implementations for various languages are available for download on the web from various sources.

12 RMI vrs. CORBA Desde la versión 1.1 de JDK, java tiene su propio ORB llamado RMI (no compatible con el ORB de CORBA). RMI es nativo de Java, una extensión del lenguaje. Depende de muchas características propias de Java: Serializacion de objetos. Portable. Implementaciones de objetos descargables. Java Interface Definitions. Como Consecuencia es muy natural para los programadores Java, que no necesitaran aprender tecnologías “extranjeras”

13 RMI vrs. CORBA (Programación vrs. integración) 1/4
Java con extensión RMI es considerada una tecnología de programación CORBA por su parte es considerada una tecnología de integración. Para ilustrarlo consideremos lo siguiente:

14 RMI vrs. CORBA (Programación vrs. integración) 2/4
Java provee un API llamada JNI (Java Native Interface) para interactuar con otro lenguajes primariamente C y C++. RMI es una tecnología Java a Java. Si se quiere que Java se comunique con un objeto remoto en otro lenguaje se lo debe hacer por medio de un intermediario.

15 RMI vrs. CORBA (Programación vrs. integración) 3/4
CORBA es una tecnología de integración, diseñada para ser el pegamento para unir tecnologías diferentes. No existe como un punto en el espacio de programación, sino que ocupa el espacio entre los diferentes lenguajes. Cuando un cliente utiliza java para comunicarse con un objeto C++, tanto el programador Java como el programador C++ trabajan en su propio lenguaje. CORBA ORB presenta el cliente Java con un “stub” Java y al programador C++ un “skeleton”” C++. CORBA se encarga de los problemas de transferencia de lenguajes.

16 RMI vrs. CORBA (Programación vrs. integración) 4/4

17 RMI vrs. CORBA (Ejemplo - Interface)
CORBA – IDL Java/RMI – Interface definition module SimpleStocks { interface StockMarket { float get_price( in string symbol ); }; }; package SimpleStocks; import java.rmi.*; import java.util.*; public interface StockMarket extends java.rmi.Remote { float get_price( String symbol ) throws RemoteException; } File : StockMarket.idl File : StockMarket.java

18 RMI vrs. CORBA (Ejemplo-Cliente del objeto distribuido)
CORBA – Client implementation Java/RMI – Client implementation // // StockMarketClient // import org.omg.CORBA.*; import org.omg.CosNaming.*; import SimpleStocks.*; public class StockMarketClient { public static void main(String[] args) { try { ORB orb = ORB.init(); NamingContext root = NamingContextHelper.narrow( orb.resolve_initial_references("NameService") ); NameComponent[] name = new NameComponent[1] ; name[0] = new NameComponent("NASDAQ",""); StockMarket market = StockMarketHelper.narrow(root.resolve(name)); System.out.println("Price of MY COMPANY is " + market.get_price("MY_COMPANY")); } catch( SystemException e ) { System.err.println( e ); }}} // // StockMarketClient // import java.rmi.*; import java.rmi.registry.*; import SimpleStocks.*; public class StockMarketClient { public static void main(String[] args)throws Exception { if(System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } StockMarket market = (StockMarket)Naming.lookup("rmi://localhost/NASDAQ"); System.out.println( "The price of MY COMPANY is " + market.get_price("MY_COMPANY") ); } } File : StockMarketClient.java

19 RMI vrs. CORBA (Ejemplo- Servidor del objeto distribuido)
CORBA – Server implementation Java/RMI – Server implementation // // StockMarketServer // import org.omg.CORBA.*; import SimpleStocks.*; public class StockMarketImpl extends _StockMarketImplBase { public float get_price( String symbol ) { float price = 0; for(int i = 0; i < symbol.length(); i++) { price += (int) symbol.charAt( i ); } price /= 5; return price; } public StockMarketImpl( String name ) { super( name ); } // StockMarketServer package SimpleStocks; import java.rmi.*; import java.rmi.server.UnicastRemoteObject; public class StockMarketImpl extends UnicastRemoteObject implements StockMarket { public float get_price( String symbol ) { float price = 0; for( int i = 0; i < symbol.length(); i++ ) { price += (int) symbol.charAt( i ); } price /= 5; return price; } public StockMarketImpl( String name ) throws RemoteException { try { Naming.rebind( name, this ); } catch( Exception e ) { System.out.println( e ); }}} File : StockMarketImpl.java

20 RMI vrs. CORBA (Ejemplo- Servidor del objeto MAIN)
CORBA – Server Main Java/RMI – Server Main // StockMarketServer Main import org.omg.CORBA.*; import org.omg.CosNaming.*; import SimpleStocks.*; public class StockMarketServer { public static void main(String[] args) { try { ORB orb = ORB.init(); BOA boa = orb.BOA_init(); StockMarketImpl stockMarketImpl = new StockMarketImpl("NASDAQ"); boa.obj_is_ready( stockMarketImpl ); org.omg.CORBA.Object object = orb.resolve_initial_references("NameService"); NamingContext root = NamingContextHelper.narrow( object ) ; NameComponent[] name = new NameComponent[1]; name[0] = new NameComponent("NASDAQ", ""); root.rebind(name, stockMarketImpl); boa.impl_is_ready(); } catch( Exception e ) { e.printStackTrace(); }}} import java.rmi.*; import java.rmi.server.UnicastRemoteObject; import SimpleStocks.*; public class StockMarketServer { public static void main(String[] args) throws Exception { if(System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); } StockMarketImpl stockMarketImpl = new StockMarketImpl("NASDAQ"); } } File : StockMarketServer.java

21 RMI vrs. CORBA (Comparando la Implementación) 1/4
Java/RMI Supports multiple inheritance at the interface level Every interface inherits from CORBA.Object Every server object implements java.rmi.Remote Uniquely identifies remote server objects through object references(objref), which serves as the object handle at run-time. Uniquely identifies remote server objects with the ObjID, which serves as the object handle at run-time. Uniquely identifies a named implementation of the server object by its mapping to a name in the Implementation Repository Uniquely identifies a named implementation of the server object by its mapping to a URL in the Registry The remote server object reference generation is performed on the wire protocol by the Object Adapter The remote server object reference generation is performed by the call to the method UnicastRemoteObject.exportObject(this) The constructor implicitly performs common tasks like object registration, skeleton instantiation etc The RMIRegistry performs common tasks like object registration through the Naming class. UnicastRemoteObject.exportObject(this) method performs skeleton instantiation and it is implicitly called in the object constructor.

22 RMI vrs. CORBA (Comparando la Implementación) 2/4
Java/RMI Uses the Internet Inter-ORB Protocol(IIOP) as its underlying remoting protocol Uses the Java Remote Method Protocol(JRMP) as its underlying remoting protocol (at least for now) When a client object needs to activate a server object, it binds to a naming or a trader service When a client object needs a server object reference, it has to do a lookup() on the remote server object's URL name. The object handle that the client uses is the Object Reference The mapping of Object Name to its Implementation is handled by the Implementation Repository The mapping of Object Name to its Implementation is handled by the RMIRegistry The type information for methods is held in the Interface Repository Any type information is held by the Object itself which can be queried using Reflection and Introspection The responsibility of locating an object implementation falls on the Object Request Broker (ORB) The responsibility of locating an object implementation falls on the Java Virtual Machine (JVM)

23 RMI vrs. CORBA (Comparando la Implementación) 3/4
Java/RMI The responsibility of locating an object implementation falls on the Object Adapter (OA) - either the Basic Object Adapter (BOA) or the Portable Object Adapter (POA) The responsibility of activating an object implementation falls on the Java Virtual Machine (JVM) The client side stub is called a proxy or stub The server side stub is called a skeleton When passing parameters between the client and the remote server object, all interface types are passed by reference. All other objects are passed by value including highly complex data types When passing parameters between the client and the remote server object, all objects implementing interfaces extending java.rmi.Remote are passed by remote reference. All other objects are passed by value Does not attempt to perform general-purpose distributed garbage collection. Attempts to perform distributed garbage collection of remote server objects using the mechanisms bundled in the JVM

24 RMI vrs. CORBA (Comparando la Implementación) 4/4
Java/RMI Complex types that will cross interface boundaries must be declared in the IDL Any Serializable Java object can be passed as a parameter across processes. Will run on any platform as long as there is a CORBA ORB implementation for that platform (like Inprise's VisiBroker) Will run on any platform as long as there is a Java Virtual Machine implementation for that platform (provided by a whole lot of companies in addition to JavaSoft and Microsoft) Since this is just a specification, diverse programming languages can be used to code these objects as long as there are ORB libraries you can use to code in that language Since it relies heavily on Java Object Serialization, these objects can only be coded in the Java language Exception handling is taken care of by Exception Objects. When a distributed object throws an exception object, the ORB tranparently serializes and marshals it across the wire. Allows throwing exceptions which are then serialized and marshaled across the wire.

25 RMI Pros y cons Pros Cons Portable across many platforms
Tied only to platforms with Java support Can introduce new code to foreign JVMs Security threats with remote code execution, and limitations on functionality enforced by security restrictions Java developers may already have experience with RMI (available since JDK1.02) Learning curve for developers that have no RMI experience is comparable with CORBA Existing systems may already use RMI - the cost and time to convert to a new technology may be prohibitive Can only operate with Java systems - no support for legacy systems written in C++, Ada, Fortran, Cobol, and others (including future languages).

26 CORBA Pros y cons Pros Cons
Services can be written in many different languages, executed on many different platforms, and accessed by any language with an interface definition language (IDL) mapping. Describing services require the use of IDL which must be learned. Implementing or using services require an IDL mapping to your required language - writing one for a language that isn't supported would take a large amount of work. With IDL, the interface is clearly separated from implementation, and developers can create different implementations based on the same interface. IDL to language mapping tools create code stubs based on the interface - some tools may not integrate new changes with existing code. CORBA supports primitive data types, and a wide range of data structures, as parameters CORBA does not support the transfer of objects, or code. CORBA is ideally suited to use with legacy systems, and to ensure that applications written now will be accessible in the future. The future is uncertain - if CORBA fails to achieve sufficient adoption by industry, then CORBA implementations become the legacy systems. CORBA is an easy way to link objects and systems together Some training is still required, and CORBA specifications are still in a state of flux.

27 Parallel CORBA Object 1/3
Busca proveer de una técnica eficiente para encapsular código paralelo basado en el uso de librerías MPI. Un código paralelo MPI puede verse como un conjunto de procesos idénticos SPMD. Usualmente se utiliza una aproximación maestro esclavo. Se selecciona un proceso como maestro que es el único que se encapsula en un objeto CORBA. Este se conecta a los esclavos mediante una capa de comunicación MPI.

28 Parallel CORBA Object 1/4
Esta solución requiere modificar los códigos MPI si no siguen la estructura maestro esclavo. El maestro puede ser un cuello de botella importante cuando dos códigos MPI se deben comunicar entre si. El cliente obtiene los datos generados por el primer código y es enviado al segundo, este los coloca en los procesos MPI esclavos, los procesa, obtiene los resultados y los envía al cliente No ofrece una solución escalable, si el numero de procesos SPMD o el tamaño del problema se incrementa (cantidad de datos transmitidos entre dos procesos paralelos) habrá un importante costo por sobrecarga en comunicaciones.

29 Parallel CORBA Object 3/4
La solución requiere que todos los procesos SPMD se encapsulen en objetos CORBA. Esto permitirá que todos los procesos SPMD se comunique a través del ORB. Sin embargo es necesario que no se exponga el paralelismo al cliente. Eso quiere decir que el cliente tiene que ver una entidad en lugar de de todos los objetos CORBA que encapsulan procesos SPMD. También si el cliente tiene que transmitir datos entre los objetos CORBA tiene que hacerlo lo mas transparentemente. Estos dos requerimientos transparencia y rendimiento han concluido en el concepto de un nuevo objeto, el CORBA Paralelo:

30 Parallel CORBA Object 4/4
Un objeto CORBA encapsula un proceso SPMD. Todos los objetos CORBA pertenecientes a una colección pueden ser manipulados como una única entidad por el sistema. La invocación de una operación por el cliente resultara en la ejecución del método asociado por todos lo objetos de la colección en el servidor. Esta activación paralela se hace transparentemente y la distribución de datos entre objetos de una colección es manejad por el sistema. Una Interface a un objeto paralelo se describe como una extensión el IDL llamada “Extended IDL”. Se han creado un conjunto de nuevas palabras clave para especificar el numero de objetos en una colección y la distribución de datos.

31 Interface Parallel CORBA.
interface[*:2*n] MatrixOperations { const long SIZE=100; typedef double Vector[SIZE]; typedef double Matrix[SIZE][SIZE]; void multiply(in dist[BLOCK][*] Matrix A, in Vector B, out dist[BLOCK] Vector C ); void skal(in dist[BLOCK] Vector C, out csum double val); };

32 Cliente y Servidor CORBA Paralelo

33 Conclusiones Existen varias implementaciones de CORBA para java actualmente en el mercado, lo cual hace viable su utilización con este lenguaje. CORBA no debe verse como una competencia de RMI sino como una solución complementaria para ciertos problemas. Se están haciendo importantes esfuerzos para extender CORBA y permitir su mejor utilización en ambientes paralelos. Es indiscutible el éxito que han tenido tanto Java como CORBA y por tanto es de esperarse una mayor colaboración de estas tecnologías complementarias a futro.

34 Bibliografia GENERAL CORBA:
COMPARATIVO RMI / CORBA: Gopalan Suresh Raj, “A Detailed Comparison of CORBA, DCOM and Java/RMI”. David Curtis, “Java, RMI and CORBA” (1997 Object Management Group). http//:cgi.omg.org/library/wpjava.html Michael W. Gilbode, “A Comparison of CORBA and Java RMI” . http//: CORBA PARALELO: T. Priol, C. René, “Parallel CORBA Object” C. Perez, T. Priol, “Grid Computing with Off-the-Shelves Middleware Technologies” . http//: C. René, T. Priol, “MPI Code Encapsulation using Parallel CORBA Object”. INRIA, Rapport de recherche No Marzo de 1999. C. René, T. Priol, G. Alléon, “Programming SCI Clusters using Paraller CORBA Objects”. INRIA, Rapport de recherche No Marzo de 1999.

35


Descargar ppt "Java RMI vrs. CORBA y el objeto Parallel CORBA"

Presentaciones similares


Anuncios Google