One important difference between parallel computing and distributed computing is that
- parallel computing usually assumes that the processes have a shared memory.
- parallel computing can only performed in supercomputers.
- parallel computing requires that the algorithm be re-written so as to work in parallel.
- distributed computing requires the use of multiple CPUs.
- distributed computing relies on opportunistic scheduling.
Withing the context of interprocess communication, we define a synchronous operation as
- one that blocks until done.
- an operation that forces all processes to synchronize.
- one that can only be executed on a parallel machine.
- any operation that is executed in sequence with the next one.
- one that does not require accessing any global variables.
Which one of the following systems is an example of a client-server architecture with location independence?
- Jini
- Web
- JXTA
- Jabber
- CORBA
In a distributed object system, a skeleton
- sits between the object implementation and the communication code.
- sits between the client of the object and the communication code.
- serves as a template for writing a remote object.
- has to be written by the programmer if he wants to implement a remote object.
- is a non-blocking infrastructure resolver of intranet requests.
Say you write an RMI Remote interface and then write two different implementations of that interface. How can you make both of them available to clients?
- Register them with different names at the registry.
- One cannot do this. A remote interface must have only one implementation.
- Make sure that the implementation classes have different names.
- Use different versions of RMI.
- Enable the dual.rem.interface option.
An RMI Activatable remote object needs to be deployed along with
- rmid
- rebind
- a UnicastRemoteObject
- a SecurityManager
- a serializable client
Why does RMI require you to implement a Remote interface and its implementation instead of simply implementing a remote object?
- Because if it did that then the client would need to have the remote object's implementation code in order to compile.
- It does not require this.
- Because the interface itself implements the communications code.
- Because the rmiregistry must run on the same machine as the object server.
- Because the implementation has to handle the communications infrastructure.
If the rmiregistry allowed any machine on the network to bind() to it, how could you (or, your evil twin) carry out a man-in-the-middle attack?
- Ask the registry to list() all its services then rebind() them to point to your own services.
- Perform an illegal operation on the registry, making it crash.
- Run a web server that pretends to be the rmiregistry.
- Bind to the rmireqistry with your own service and make the clients use it.
- Bind to the rmireqistry with your own service and run a very CPU-intensive process on the registry.
What is the purpose of rmic
in Java RMI?
- To generate the stub and skeleton code.
- To activate Activatable objects.
- To perform a lookup in the rmiregistry.
- To verify that the types in the Remote interface are correct.
- To eliminate indirect calls.
Why do we use the Factory design pattern for remote objects in RMI?
- In order to generate, at runtime, more instances of a remote object.
- To enable scalability to thousands of machines.
- Because the registry can only store a handful of remote object references.
- So that the clients can perform multiple invocations of a remote object in parallel.
- Because the Adapter pattern does not work for remote objects.
When you run a JVM setting its java.rmi.server.codebase to some URL, what does this mean? (Assuming you are doing everything correctly, of course.)
- That the .class files for any remote object stub created by that JVM are available at that RMI.
- That the source code for all the code that runs on the JVM is available at that RMI.
- That any remote object used by that JVM has .class files available at that URL.
- That there JVM can only allow incoming connections to the given URL.
- That the rmiregistry is running at URL.
The steps that a Java RMI object server needs to do in order to get an UnicastRemoteObject registered are (in order):
- Create RMISecurityManager, create remote object, bind() to registry.
- bind() to registry, create skeleton object.
- Create RMISecurityManager, bind() to registry, create skeleton object.
- Upload stub code to registry, create remote object skeleton, bind() to registry.
- Create remote object, initialize object with initialize(), bind() to registry.
Java RMI sends all communications over a plain socket. If you wanted instead to use an encrypted socket, what would you need to do?
- Create a custom
RMISocketFactory
that hands out encrypted sockets.
- Use the -java.rmi.encryption=MODE command line argument, where MODE describes the type of encryption requested.
- Set the appropriate flags in the rmiregistry.
- You can't easily do this without re-writing parts of RMI.
- Make the object extend UnicastRemoteEncryptedObject.
Which one of the following is not a pertinent question to ask when deciding among different possible remote object interfaces?
- How scalable is the rmiregistry?
- Does each instance of the server require a shared resource?
- How well does the server scale to multiple machines?
- Can a single server handle a typical client interaction?
- How fatal is a server failure?
What is a method object?
- An object with, typically, one member function. The object is passed around and the function executed by the receiver.
- An object that extends multiple interfaces.
- An object that implements the
RMIMethod
interface.
- The object returned by a method.
- An object that can raise multiple Exceptions.
In centralized programming we don't really care if the argument of a function is of a primitive type or an object, but in distributed programming we do care. Why?
- Communication latency.
- Memory requirements.
- Multiple platforms.
- Computational costs.
- Interface evolution.
Why do we wan to to avoid using a Vector
as the type of an argument to a method in a remote interface?
- Because it has variable length.
- Because it is not serializable.
- Because it does not extend UnicastRemoteObject.
- Because it is better to use the
RMIVector
.
- Because it requires the client to then also become a server.
When deciding on which Exceptions your remote object should raise, a general rule of thumb is to
- raise as many specific exceptions as possible.
- raise as few exceptions as possible.
- only raise exceptions that relate to communication problems.
- raise one exception per method.
- only raise native exceptions.
The Java function used to serialize an object into a stream is called
- writeObject
- serializeObject
- serializeIt
- toString
- toSerialized
Why would you want to declare a member variable as transient
?
- So it does not get serialized.
- So that it is inaccessible from a remote client.
- So it does not occupy as much memory.
- So that it can be (distributed) garbage collected more often.
- To mark it as easily replaceable by another cheaper variable.
Say client1 has a reference to a Java RMI remote object. Client1 makes
some function calls on this object and then serializes it and sends it
to client2. Is the reference client2 now has functionally different
from the one it would have gotten by asking the rmiregistry for the
object?
- No.
- Yes, because client1 made some function calls which could have changed the state of the object.
- Yes, because client2 now has a copy of the instance that client1 has.
- It depends on whether the remote object is
UnicastRemoteObject
or Activatable
.
- It depends on the serialization algorithm used.
Why must you re-define the equals()
function on objects that you want to be Serializable
?
- Because the default behavior behavior only checks to make sure that the reference pointers are the same.
- Because the standard behavior is to check that the objects are of the same class.
- Since a serialized object might suffer from a memory leak due to dangling references.
- In order to improve the speed of the serialization algorithm.
- In order to re-order the alternative transient in-memory pointers so as to eliminate indirect references.
A distributed object has two member functions
public int synchronized f(...);
public int synchronized g(...);
could the use of these functions lead to trouble? How?
- Yes, if the clients need the output of one function in order to call the other function then these calls could be interleaved in such a way as to cause trouble.
- No, the functions are synchronized everything is safe.
- Yes, if a client calls one function and then crashes, the other client might not be able to use the object anymore.
- Yes, if the two clients try to call one of the functions at the same time there will be a problem.
- Yes, if there are four clients and each one calls one of the functions, all at the same time.
In class we showed how to use a "lock" for avoiding synchronization problems. How does a lock work?
- The remote object is owned by only one client at a time. Only the client that owns the object can make changes to it.
- The remote object locks itself from all the clients and makes sure that all incoming calls from them are properly serialized.
- Each client must decipher the key to the lock before receiving an instance of the object.
- The lock is placed on the rmiregistry so that only clients that are thread-safe can get a reference to the object.
- A lock thread runs in the background and kills any client that does something that is not thread-safe.
How do you make the following code threadsafe?
import java.util.*;
public synchronized void insertIfAbsent(Vector vector, Object object){
if (vector.contains(object)) {
return;
}
vector.add(object);
}
-
import java.util.*;
public void insertIfAbsent(Vector vector, Object object){
synchronized (vector){
if (vector.contains(object)) {
return;
}
vector.add(object);
}
}
-
import java.util.*;
public void insertIfAbsent(synchronized Vector vector, Object object){
if (vector.contains(object)) {
return;
}
vector.add(object);
}
-
import java.util.*;
public void insertIfAbsent(Vector vector, Object object){
if (vector.contains(object)) {
return;
}
synchronized(vector.add(object));
}
-
import java.util.*;
public void insertIfAbsent(Vector vector, Object object){
vector.add(object);
if (vector.contains(object)) {
return;
}
}
-
import java.util.*;
public void insertIfAbsent(Vector vector, Object object){
while (vector.contains(object)) {
sleep(1);
}
vector.add(object);
}
An RMI client obtains an reference to a distributed object. That
is the only reference that exists to that object. The client
machine crashes. What happens to the object?
- It will be garbage collected within 10 minutes.
- It will hang around because the server still thinks that the client has a reference to the object.
- It will be garbage collected the moment that the client machine crashes.
- The object will also crash.
- The object will raise an illegal operation exception.
What happens if you forget to give the JVM a SecurityManager
?
- No security checks are performed.
- The default security checks are applied.
- There is a compile-time error.
- A run-time exception is raised.
- The JVM will enable high-level security mode.
Which one of the following is not a permission that you can deny using the policy file of the SecurityManager?
- Prevent program from encrypting its communications.
- Prevent program from reading from the clipboard.
- Prevent program from accessing files on the local machine.
- Prevent program from opening a socket to some other machine.
- Prevent program from reading system properties.
When Java RMI does HTTP tunneling, what is it doing?
- Encapsulating the RMI data within an HTTP request.
- Sending RMI requests to port 80.
- Making RMI into a stateless protocol so it can be used with HTTP.
- Starting a web server to serve requests from RMI clients.
- Changing all the message encodings into HTML.
Name one difference between CORBA and Java RMI.
- CORBA requires the use of an interface definition language.
- CORBA provides distributed object services.
- RMI works with Java.
- CORBA can handle multiple remote objects.
- RMI works over TCP/IP.
What service do the OMA's "object services" provide?
- White and yellow pages.
- Distributed garbage collection.
- Intra-ORB communications.
- Fault tolerance.
- Elementary hyper-threading.
Which one of the following choices is not something that the CORBA ORB core hides from the user?
- The data members of the object.
- The location of the object.
- The implementation language of the object.
- The execution state of the object.
- The communication mechanism of the object.
What is the OMG's IDL used for?
- Defining the interface of a remote object.
- Linking with the ORB.
- Encoding the inter-ORB communication.
- Defining the security requirements for the ORB.
- Encoding the parameter values for the remote object method calls.
What is the meaning of the keyword in
in the OMG's IDL?
- Declares a parameter to be an input parameter.
- Declares a variable as transient.
- Declares a variable as read-only.
- Declares that the interfaces should be placed in the interface repository.
- Declares a variable as needing a special encoding method.
What is "marshalling"?
- The same as serializing.
- Compressing.
- Compiling.
- Generating stubs and skeletons.
- Finding all remote servers needed to handle a request.
Dynamic invocation in CORBA works by
- first creating a request object, setting values, then invoking it.
- letting the ORB choose the best communication method for talking to the server.
- using the interface repository to download the needed interface file.
- calling the remote object from within a while loop.
- invoking a remote object that is also referenced by another client.
Why was the IIOP needed?
- Because different ORBs could not talk to each other.
- Because the first ORBs did not work over TCP/IP.
- Because the ORBS were too slow.
- Because of Java.
- Because of the popularity of the Web.
Grid computing is largely defined by one implementation of it, which is called
- the Globus toolkit.
- AccessGrid.
- Information Power Grid.
- Unicore.
- TeraGrid.
The Grid defines a "resource" to be
- an entity to be shared.
- a slice of CPU time.
- a reservation system.
- a document retrieval system.
- a web service invocation mechanism.
The Grid Resource Allocation Management (GRAM) protocol allows
- programs to be started on other machines that have the specified resources.
- the user to limit the resources offered by any machine.
- high-speed communication between machines.
- enhanced database performance on supercomputers.
- for programs to be written independently of the machine they are to run in.