Vernetzte Systeme - IT Services of ETH Zurich

Transcrição

Vernetzte Systeme - IT Services of ETH Zurich
16
13. Juli 2006
Prof. Gustavo Alonso, Prof. Roger Wattenhofer
Prüfung Vernetzte Systeme
•
Bitte schreiben Sie Ihren Namen und Legi-Nummer auf alle Blätter, die Sie korrigiert haben wollen.
•
Sie haben 120 Minuten zur Verfügung. Es gibt total 120 Punkte.
•
Halten Sie Ihre Legi bereit, sie wird kontrolliert.
•
Erlaubte Hilfsmittel sind zwei handgeschriebene A4-Seiten und ein Taschenrechner.
•
Notieren Sie Ihre Antworten wenn möglich direkt auf die Aufgabenblätter. Falls Sie zusätzliche Blätter
verwenden: Benutzen Sie ein separates Blatt pro Aufgabe.
-> Sie dürfen die Aufgaben erst anschauen, wenn die Prüfungsaufsicht dies erlaubt.
Name:
Legi-Nr:
Aufgabe
maximal
1
2
3
4
5
6
7
8
9
10
Total
10
27
19
14
15
4
4
4
12
11
120
Note:
erreicht
2/21
1. Multiple Choice (10 Punkte)
Beantworten Sie die folgenden Fragen. Markieren Sie die richtige Antwort. Pro Frage ist genau eine der
vorgeschlagenen Antworten korrekt. Jede richtig beantwortete Frage gibt einen Punkt, jede falsch
beantwortete Frage gibt einen Punkt Abzug. Nicht beantwortete Fragen geben keinen Abzug!
a) Welche der folgenden Aussagen zu HTTP/1.0 ist falsch?
…
…
…
…
…
HTTP/1.0 ermöglicht den Datenaustausch (data exchange) zwischen Client und Server
HTTP/1.0 läuft normalerweise über TCP, Port 80
HTTP/1.0 kann nur zusammen mit HTML verwendet werden
HTTP/1.0 ist stateless
HTTP/1.0 hat nur nicht-persistente Verbindungen (non-persistent connections)
b) Wofür wird UDP typischerweise verwendet?
…
…
…
…
…
Benutzerauthentisierung (user authentication) in Wireless-Netzen
Datenaustausch via FTP
Fehlertolerante, zeitkritische Anwendungen (fault-tolerant, time-critical applications)
Routing in einem LAN mit NAT
Seit der Entwicklung von TCP wird UDP kaum noch verwendet
c) Welche Aussage über SMTP ist falsch?
…
…
…
…
…
SMTP wird für den Austausch von Mails zwischen zwei Mailservern verwendet
SMTP verwendet ASCII Kommandos
SMTP muss vom Empfänger eines Mails unterstützt werden
SMTP ist ein push-basiertes Protokoll
Alle Aussagen sind richtig
d) Was versteht man unter MIME?
… Multipurpose Internet Mail Extensions: MIME ist ein Codierungsstandard (coding standard), mit dem
der Typ der zu übermittelnden Daten festgelegt wird.
… Mail Intercommunication Machine Emulator: MIME ist eine virtuelle Testumgebung für Mailserver.
… Mails-In-Mail Encapsulation: MIME ist eine Technik, mehrere Mails zur Übertragung zwischen zwei
Servern zu einem einzigen grossen Mail zusammenzufassen (merge), wodurch unnötiger ProtokollOverhead verhindert wird.
… Maximum Internet Message Encryption: MIME ist ein Flag des SMTP-Protokolls, welche die
bestmögliche (allerdings auch die langsamste) Verschlüsselung (encryption) von Mails anzeigt.
… Mail Indirection MEthod: MIME ist ein Protokoll zum weiterleiten von Mails auf ein zusätzliches
Mailkonto (forward mails to an additional mail account).
e) Welche der folgenden Aussagen über DNS ist korrekt?
…
…
…
…
…
Jeder ISP (Internet Service Provider) benötigt für seine Kunden einen DNS-Server.
Frühere DNS-Anfragen werden im ARP-Cache gespeichert.
Es gibt genau einen DNS-Server pro Top-Level Domain.
Für DNS-Anfragen wird normalerweise UDP verwendet.
Ein Ausfall aller DNS-Server würde es verunmöglichen, mit einem anderen PC im Internet zu
kommunizieren.
3/21
f)
Was trifft nicht auf das Selective Repeat Protokoll zu?
…
…
…
…
…
Der Sender wiederholt nur Pakete, für die er kein ACK bekommen hat.
Ein ACK kann den Empfang von mehreren Paketen bestätigen.
Die Fenstergrösse (window size) kann auf beiden Seiten unterschiedlich gross sein.
Bei einer Fenstergrösse N reicht dem Empfänger ein Puffer für maximal N Pakete.
Es kann sein, dass vom Empfänger absichtlich verworfene Pakete (intentionally dropped packets)
vom Sender nochmals gesendet werden müssen.
g) CIDR...
… ... verhindert die Verschwendung (waste) von IP Adressen in zu grossen Adressräumen (address
spaces).
… ... erlaubt das Beibehalten der IP beim Wechsel der Basisstation (access point) in einem WirelessNetzwerk.
… ... übersetzt einen Domainnamen in die zugehörige IP Adresse.
… ... garantiert die Einmaligkeit (uniqueness) einer IP Adresse innerhalb eines LANs.
… ... weist jeder MAC Adresse eine IP Adresse zu.
h) Wie viele IPv4 Adressen gibt es?
…
…
…
…
…
i)
~ 1024 (4·256)
~ 4.3 · 109 (2564)
~ 255'255'255’255
~ 1.15 · 1077 (2256)
Keine der obigen Antworten
Welche Aussage über P2P ist korrekt?
… P2P skaliert schlecht, weil die einzelnen Knoten eine sehr kleine Bandbreite (bandwidth) haben.
… P2P ist illegal.
… P2P ermöglicht es, aus unzuverlässigen (unreliable) Komponenten ein zuverlässiges (reliable)
System zu konstruieren.
… P2P erfordert ähnlich-dimensionierte Peers in Bezug auf Bandbreite, Speicherplatz (memory) und
Rechenpower (computing power).
… P2P funktioniert nur in dynamischen Netzwerken.
j)
Zu den Aufgaben des MAC-Layers gehört es, ...
…
…
…
…
…
... die optimale Route eines Paketes zu seiner Destination zu ermitteln.
... eine gültige MAC-Adresse anzufordern.
... Pakete aus fremden Subnetzen zu verwerfen (drop).
... den Zugang zum gemeinsamen Übertragungsmedium (transmission medium) zu kontrollieren.
... sich mit den benachbarten (neighboring) Stationen auf einen gemeinsamen Codierungsstandard
(encoding) zu einigen.
4/21
2. Kurzfragen (27 Punkte)
Beantworten Sie die folgenden Fragen. Schreiben Sie direkt auf das Aufgabenblatt.
a) (4 Punkte) Romeo und Julia befinden sich in unterschiedlichen LANs, welche beide NAT verwenden.
Damit sich die beiden via Skype (Internet-Telefonie) unterhalten können, wird das Gespräch von Skype
via einen dritten sogenannten Superknoten (super node) geleitet. Erklären sie in 4-5 Sätzen, das bei
einer direkten Kommunikation das Problem wäre und warum dieses Problem durch den Superknoten
gelöst wird.
b) (3 Punkte) Die Greedy Bank verfügt über ein einfaches eBanking-System, bei welchem ein Benutzer
auf der Homepage www.greedybank.com sein Passwort eingeben muss und dann alle Bankgeschäfte
direkt im Browser abwickeln kann. Sie als Hacker planen nun folgenden Angriff (attack): Ein Benutzer
soll – obwohl er die Adresse korrekt eingegeben hat – auf einer falschen (von Ihnen kontrollierten)
Webseite landen. Das Design der Webseite ist mit der richtigen eBanking-Seite identisch, wodurch der
unwissende Benutzer sein Passwort eingibt und sie dieses stehlen können. Gehen Sie davon aus,
dass ausser dem Bankserver und dem Browser alle beteiligten Systeme manipulieren können. Nennen
Sie drei mögliche Angriffspunkte, an welchen Sie Ihren Plan umsetzen können (je 1-2 Sätze).
5/21
c) (3 Punkte) Was versteht man unter dem Slow Start Algorithm und wie funktioniert er?
d) (3 Punkte) Tragen Sie in den drei Diagrammen die Zuteilung der Ressourcen nach der Max-MinFairness-Strategie ein. Jede Ressource (Kreis) hat Kapazität 1. Jeder Pfeil, der einen Kreis schneidet,
beansprucht diese Ressource.
e) (3 Punkte) Gegeben ist das Generator-Polynom G(x) = x2+ 1 und die Daten D = 1001101. Berechnen
Sie mit dem in der Vorlesung vorgestellten Verfahren den CRC und geben Sie an, welcher Bitstring
übertragen wird.
6/21
f) (3 Punkte) Alice sendet via ein 10’000 km langes Glasfaserkabel (Ausbreitungsgeschwindigkeit /
propagation speed 200'000 km/s) Daten zu Bob. Sie sendet die Daten mit 20 kbps ohne Unterbruch
(without interruption), d.h. Bob sendet keinerlei Daten zurück (keine ACKs etc.). Nach fünf Sekunden
zieht Bob’s Kind das Netzwerkkabel raus, wodurch keine Daten mehr ankommen (disconnected after 5
seconds). Wie viele Daten hat Bob bis dann empfangen?
g) (2 Punkte) In IPv4 wurde der IP-Header durch eine Checksumme geschützt. Bei IPv6 wurde dieser
Schutz entfernt. Nennen Sie einen wesentlichen Vorteil dieser Entscheidung (ausser der Platzersparnis
(saving of space) von ein paar Bytes). (1-2 Sätze)
7/21
h) (6 Punkte) Gegeben ist das rechts abgebildete Netzwerk, in
welchem mit Distance Vector Routing die Routing Tabellen
erstellt werden. Tragen Sie die Werte von Knoten A in die
vorgegebene Tabelle ein.
A
Schritt 2
1
D
∞
∞
B
C
D
C
A
2
∞
C
∞
4
D
∞
∞
A
D
A
1
∞
∞
B
∞
4
∞
D
∞
∞
2
A
A
B
D
∞
C
2
Destination
Destination
B
B
C
A
D
A
B
A
B
D
C
D
Route via
D
A
C
D
B
D
Route via
C
B
B
A
Route via
A
C
A
Route via
D
C
A
D
C
C
Route via
C
∞
B
Destination
D
Destination
Destination
B
C
Route via
A
Route via
A
A
A
C
Route via
D
D
C
A
Route via
C
C
C
B
Route via
Destination
A
B
B
Route via
Destination
B
Destination
Route via
Route via
C
Destination
∞
B
Destination
C
Schritt 4
Destination
∞
4
C
Destination
2
B
D
Route via
C
Destination
B
Route via
B
C
Schritt 3
Destination
C
Destination
A
Destination
Route via
B
2
2
Hinweis: Die Tabellen der restlichen Knoten dürfen benutzt
werden, müssen aber nicht und werden nicht mitbewertet!
Schritt 1
1
A
B
C
8/21
3. Die launischen Bankbeamten (19 Punkte)
Wir betrachten eine Bank mit launischen Bankbeamten (moody bank clerk); ein launischer Bankbeamte
ist immer in einem von zwei Zuständen (states), entweder ist er happy, oder er ist genervt (annoyed).
Durchschnittlich alle 5 Minuten kommt ein neuer Kunde in die Bank (memoryless). Falls der Bankbeamte
gerade besetzt ist, dann wartet der Kunde in einer unendlich grossen Warteschlange, bis er dran ist. Die
Bedienzeit beim Bankbeamten ist exponentiell verteilt, ist der Bankbeamte happy dann beträgt sie im
Erwartungswert 3 Minuten, ist er genervt beträgt sie 6 Minuten.
a) (6 Punkte) Der Bankbeamte ist genau dann genervt, wenn 10 oder mehr Kunden in der Bank sind bei 9 oder weniger Kunden in der Bank ist er happy. Zeichnen Sie die Markovkette. Ist das System
stabil? Begründen Sie Ihre Antwort.
b) (6 Punkte) Der Bankbeamte aus Teilaufgabe a) wird gefeuert und ein neuer, ebenfalls launischer
Beamter wird eingestellt. (The clerk from part a) was fired and replaced by another moody clerk).
Morgens, wenn er in die Bank kommt, ist er erst mal happy. Nachdem er allerdings einen
unfreundlichen Kunden bedienen muss, dann wird er mit Wahrscheinlichkeit 60% genervt. Im
Erwartungswert sind 20% der Kunden unfreundlich (zufällig verteilt). Wenn der Bankbeamte genervt
ist, wird er wieder happy, nachdem er gleich zwei freundliche Kunden nacheinander bedient hat. Im
Erwartungswert ist jeder vierte Kunde freundlich (auch zufällig verteilt). Es gibt scheinbar drei Arten
von Kunden, die unfreundlichen, die freundlichen, und alle anderen (die normalen). Zeichnen Sie die
Markovkette.
9/21
c) (7 Punkte) Ist das System von Teilaufgabe b) stabil? Begründen Sie Ihre Antwort.
Hinweis: Diese Frage ist unabhängig von Ihrem Resultat bei Aufgabe b) lösbar!
10/21
4. Programmierung eines einfachen FTP-Clients (14 Punkte)
In dieser Aufgabe soll ein einfacher FTP-Client ergänzt werden. Die Applikation soll sich mit einem FTPServer verbinden und anschliessend ein Textfile herunterladen und zeilenweise ausgeben. Der Einfachheit
halber wird angenommen, dass sich der Server korrekt verhält, d.h. es wird weitestgehend auf
Fehlerhandling verzichtet.
Sollten Sie Probleme bei der Implementierung haben, etwa die korrekten Klassen, Methoden oder Parameter
nicht kennen, dann „beschreiben“ Sie gegebenenfalls einfach mit Worten und/oder als Pseudocode, was Sie
meinen.
Die Grundlagen von FTP:
• Für die Übertragung werden zwei TCP-Verbindungen benötigt. Über die eine Verbindung werden die
Kommandos versendet, über die andere die Daten.
• Es gibt zwei verschiedene Modi, die Daten-Connection zu öffnen: Beim Active-Mode öffnet der
Server die Verbindung, beim Passive-Mode sendet der Server (via Kommando-Verbindung) IP und
Port an den Client, damit dieser die Verbindung aufmacht. Wir verwenden hier den Passive-Mode.
• Folgende Kommandos verwendet der Client in dieser Aufgabe:
o USER <name>
Benutzer <name> will sich einloggen
o PASS <password> Passwort für eingeloggten Benutzer
o PASV
Aktiviere Passive-Mode (siehe oben)
o RETR <filename> Fordert den Server auf, die Datei <filename> zu senden
• Der Komplette Login-Prozess sieht folgendermassen aus:
o Server: 220 Welcome to the FTP Server
o Client: USER james
o Server: 331 Password required for james.
o Client: PASS bond
o Server: 230 User james logged in.
o Client: PASV
o Server: 227 Entering Passive Mode (84,75,18,19,57,240)
Aufgaben:
a) (12 Punkte) Auf den folgenden Seiten ist ein Gerüst des FTP-Clients gegeben, welches nicht
verändert werden muss und darf. Das Gerüst öffnet die Kommando-Verbindung und führt das Login
aus. Implementieren Sie die Methode downloadFile(InetAddress dataAddr, String filename),
welche das vorgegebene File zeilenweise komplett ausgibt. Den Code können Sie direkt in das
Gerüst oder auf ein separates Blatt schreiben.
Hinweis: BufferedReader.readLine() gibt null zurück, wenn das Ende des Files erreicht ist.
b) (2 Punkte) Weshalb macht es Sinn, für Kommandos und Daten zwei separate Verbindungen zu
verwenden?
11/21
import java.io.BufferedReader;
public class FTPConnectionSkeleton {
public static final int FTP_PORT = 21;
private Socket commandSocket = null;
private BufferedReader commandIn = null;
private DataOutputStream commandOut = null;
// TCP connection (command)
// The stream to read commands from
// The stream to write commands on
private
private
private
private
//
//
//
//
int dataPort = 0;
Socket dataSocket = null;
BufferedReader dataIn = null;
DataOutputStream dataOut = null;
The
TCP
The
The
data port
connection (data)
stream to read data from
stream to write data on
// open the required connections and downloads a textfile from an FTP server
public void downloadFromFTP(String address, String user, String password, String filename) {
try {
// open command connection
openCommandConnection(address);
// login
doLogin(user, password);
// read parameters of data connection
String dataIP = commandIn.readLine();
System.out.println(dataIP);
InetAddress dataAddr = parseAddress(dataIP);
// download file
downloadFile(dataAddr, filename);
} catch (Exception e) {
System.out.println("Oops, something went wrong");
System.exit(1);
}
}
// converts a string with format x1,x2,x3,x4,x5,x6 to
// the InetAddress x1.x2.x3.x4 and sets dataPort to 256*x5+x6
private InetAddress parseAddress(String data) throws UnknownHostException{
byte[] ip = new byte[4];
data = data.substring(data.indexOf("(")+1, data.indexOf(")"));
String[] ip_string = data.split(",");
for (int i=0; i<4; i++)
ip[i] = (byte) Integer.parseInt(ip_string[i]);
dataPort = Integer.parseInt(ip_string[4]) * 256 + Integer.parseInt(ip_string[5]);
return InetAddress.getByAddress(ip);
}
// opens the socket for ftp commands
private void openCommandConnection(String server) throws IOException {
commandSocket = new Socket(server, FTP_PORT);
commandIn = new BufferedReader(new InputStreamReader(commandSocket.getInputStream()));
commandOut = new DataOutputStream(commandSocket.getOutputStream());
}
// downloads a text file from an FTP server
private void downloadFile(InetAddress dataAddr, String filename) throws IOException {
// TO BE IMPLEMENTED
}
// performs the login to an FTP server
private void doLogin(String user, String password) throws IOException {
// read welcome message
System.out.println(commandIn.readLine());
// send user name
sendLine("USER james");
// skip answer
System.out.println(commandIn.readLine());
// send password
sendLine("PASS bond");
// skip answer
System.out.println(commandIn.readLine());
// request for parameters of data connection (passive mode)
sendLine("PASV");
}
// sends a String and the termination bytes through the command socket
private void sendLine(String s) throws IOException {
commandOut.writeBytes(s);
commandOut.writeByte(0x0d);
commandOut.writeByte(0x0a);
commandOut.flush();
System.out.println(s);
}
// the main method: create a new instance and run it
public static void main(String[] args) {
if (args.length != 4) {
printUsage();
return;
}
(new FTPConnectionSkeleton()).downloadFromFTP(args[0], args[1], args[2], args[3]);
}
// pring the correct usage of the application
public static void printUsage() {
System.out.println("Usage: java FTPConnection <address> <username> <password> <filename>");
}
// destructor: clean up everything
protected void finalize() throws IOException {
closeConnection();
}
// clean up: close all sockets
private void closeConnection() throws IOException {
commandSocket.close();
dataSocket.close();
}
}
5. Distributed Systems - Architecture (15 Points)
Please answer the following questions. For each question, mark the correct answer. There is exactly one
correct answer per question. You are awarded 1 point for each correctly answered question; each wrongly
answered question results in 1 negative point.
a) What is the role of the stub in Remote Procedure Call?
…
…
…
…
acts as a local implementation of the remote procedure
acts as the network interface
acts as a proxy for the remote procedure
implements the transport level network protocol
b) Who adds the stub to the program?
…
…
…
…
the name and directory server when the call is first made
the compiler based on the input from the IDL compiler
the programmer through the IDL compiler
the network libraries when first invoked
c) RPC is based on which form of interaction:
…
…
…
…
1-to-N
N-to-1
1-to-1
N-to-M
d) What is the procedure signature?
…
…
…
…
the network address, name, and type of the parameters of a remote procedure
the name of the procedure and the name of its parameters
the network address of the remote procedure
the name of the procedure and the type of its parameters
e) A name and directory server is used to implement
…
…
…
…
f)
reliable call dispatch
inheritance across procedure signatures
transactional RPC
dynamic binding
Dynamic binding has the advantage of
…
…
…
…
implementing loose coupling between client and server
enforcing tight coupling between client and server
supporting joint compilation of client and server
faster connection to the server
g) If P is the probability that the client does not fail and Q the probability that the server does not fail and we
assume the network does not fail, what is the probability of failure of a given call when using local binding
…
…
…
…
PxQ
P+Q
1 – (P + Q)
1 – (P x Q)
14/21
h) Assuming there are N independent implementations of the same service (the same remote procedure). If
P is the probability that the client does not fail and Q the probability that any given server does not fail
and we assume the network does not fail, what is the probability of failure of a given call when using local
binding
…
…
…
…
i)
Assuming there are N independent implementations of the same service (the same remote procedure). If
P is the probability that the client does not fail and Q the probability that any given server does not fail
and we assume the network does not fail, what is the probability of failure of a given call when using
dynamic binding (also assume the binder never fails)
…
…
…
…
j)
1 - (P x Q)ⁿ
1 – (P x Q)
1 – ((P x (1 - Qⁿ))
1 - (P x Qⁿ)
1 - (P x Q)ⁿ
PxNxQ
1 – ((P x ( 1 - Qⁿ))
1 - (P x Qⁿ)
Assuming it is the first call to the remote procedure and that registration messages are not counted, how
many network messages are used when performing a Remote Procedure Call using dynamic binding if
no failure occurs
…
…
…
…
2
4
6
Depends on the degree of replication of the remote procedure
k) Which one of the following statements is true:
…
…
…
…
l)
transactional message queues can be used to implement transactional RPC
transactional RPC can be used to implement transactional message queues
transactional message queues must always be persistent
message queues must always be persistent
Atomicity in a transaction implies
…
…
…
…
the execution of a transaction is consistent if executed in its entirety
the transaction is executed in isolation from other transactions
the transaction is guaranteed to commit
either the entire transaction is executed or no part of it is executed
m) Transaction isolation implies that
…
…
…
…
transactions are executed one after each other
transactions see a single system image
transactions are not permitted to see intermediate results of other transactions
transactions always see different data items
n) 2 Phase Commit is used to implement:
…
…
…
…
atomicity in a distributed setting
isolation in a distributed setting
persistent message queues
Remote Procedure Call with exactly once semantics
o) For 3 Phase Commit to avoid blocking it is necessary that
…
…
…
…
the network is reliable
neither network nor nodes fail
nodes do not fail
no restrictions are necessary
15/21
6. Failure Semantics in RPC (4 Points)
Describe a failure scenario in a client server system where “at most once” semantics are violated (describe it
in terms of the following operations: client sends request, client fails, client receives response, server
receives request, server fails, server sends response). Draw the messages exchanged and mark with an “X”
the point of failure.
CLIENT
SERVER
7. Optimized Linear 2 Phase Commit (4 Points)
The message complexity of Linear 2PC is 2*N and its message round complexity is 2*N rounds, where N is
the number of nodes. Describe an alternative version of linear 2PC with N+1 round complexity (assume no
restrictions on how nodes can communicate). A round of messages implies a set of messages from the same
node or sent to the same node. What is the message complexity of the new protocol?
16/21
8. Linear 2 Phase Commit (4 Points)
a) (2 points) Assuming node A is the coordinator, draw all the message exchanges between the nodes that
would result in running the linear 2PC protocol successfully (all nodes agree to commit). Use only one
message in each line so that the process is clear
A
B
C
A
B
C
A
B
C
A
B
C
A
B
C
b) (2 points) Assuming node A is the coordinator, draw all the message exchanges between the nodes that
would result in running the linear 2PC protocol when node B decides to abort when the vote-request
arrives. Use only one message in each line so that the process is clear
A
B
C
A
B
C
A
B
C
A
B
C
A
B
C
17/21
9. Decentralized 2 Phase Commit (12 Points)
Decentralized 2 Phase Commit is a version of the 2PC protocol where participants do not communicate
through the coordinator but directly with one another. The Coordinator starts the protocol by sending a YES
or NO message to all other nodes. Each node responds by sending its own vote to all other nodes. After
receiving all votes, each process makes a decision: if everybody voted YES, then COMMIT; otherwise
ABORT.
a) (4 points) Draw the state diagrams for the coordinator and the participants. Mark with an “*” the states
where a node is uncertain.
18/21
Assume that all nodes vote YES and ignore that failures need to happen at a particular point in time for
blocking to occur. If the probability that a node fails is P:
b) (2 points) What is the probability of blocking in CONVENTIONAL 2PC
c) (2 points) What is the probability of blocking in DECENTRALIZED 2PC
Assuming there are N nodes in total involved in running the protocol
d) (1 point) How many messages are sent in a successful run of CONVENTIONAL 2PC without failures?
e) (1 point) How many messages are sent in a successful run of DECENTRALIZED 2PC without failures?
f)
(1 point) How many rounds of messages (a round of messages implies a set of messages from the same
node or sent to the same node) are required in a successful run of CONVENTIONAL 2PC if no failures
occur?
g) (1 point) How many rounds of messages (a round of messages implies a set of messages from the same
node or sent to the same node) are required in a successful run of DECENTRALIZED 2PC if no failures
occur?
19/21
10. RPC Programming (11 Points)
Assume an RPC interface and the corresponding implementation given as follows:
//The helper class
public interface Task extends Serializable {
Object execute();
}
//The RPC Interface
public interface ComputeEngine extends Remote {
public Object executeTask(Task t) throws RemoteException;
}
//The Implementation
public class ComputeEngineImpl implements ComputeEngine {
public ComputeEngineImpl () throws RemoteException {
UnicastRemoteObject.exportObject(this);
}
public Object executeTask(Task t) throws RemoteException {
return t.execute();
}
}
a) (5 points) Sketch in pseudo code the
• server that provides RPC access to a ComputeEngineImpl object and a
• client calling the executeTask() method using RPC.
20/21
b) (6 points) Assume server you just programmed is deployed on machine X. However, due to many clients
accessing ComputeEngineImpl from different machines, machine X experiences heady load. We
therefore want to deploy another instance of the server on machine Y. How can the above application be
extended to provide load balancing among the two machines X and Y? The solution should only require a
restart of the clients, but not a change of existing code (neither client nor server code). Sketch your
solution in pseudo code and describe it in words.
21/21

Documentos relacionados