0% found this document useful (0 votes)
6 views

Test I Solutions

The document discusses distributed systems topics including domains for distributed applications, forms of transparency, and data representation formats. It provides example code for a UDP client-server application.

Uploaded by

donmukisajoseph
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Test I Solutions

The document discusses distributed systems topics including domains for distributed applications, forms of transparency, and data representation formats. It provides example code for a UDP client-server application.

Uploaded by

donmukisajoseph
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

MAKERERE UNIVERSITY

SCHOOL OF COMPUTING AND INFORMATICS TECHNOLOGY


BSE 3202 DSITRIBUTED SYSTESM DEVELOPMENT
MID-SEMESTER TEST 2023/24
Attempt all questions. Time allowed is 1 hour.

1. With the help of examples discuss four domains in which distributed/networked applications may
be implemented. (8 Marks)

Any four of the following (2 Marks each):

Finance and commerce: eCommerce e.g. Amazon and eBay, PayPal, online banking and trading.
The information society: Web information and search engines, ebooks, Wikipedia; social networking:
Facebook, MySpace, …
Creative industries and entertainment: Online gaming, music, and film in the home, user-generated
content, e.g. YouTube, Flickr, …
Healthcare: Health informatics, on online patient records, monitoring patients, …
Education: e-learning, virtual learning environments; distance learning, …
Transport and logistics: GPS in route finding systems, map services: Google Maps, Google Earth, …
Science: The Grid as an enabling technology for collaboration between scientists.
Environmental management: Sensor technology to monitor earthquakes, floods, tsunamis, …

2. Transparency is defined as the concealment from the user and the application programmer of the
separation of components in a distributed system, so that the system is perceived as a whole
rather than as a collection of independent components. Briefly discuss any four of the eight forms
of transparencies as identified by the ANSA 1989 and ISO 1992. (8 Marks)

Any four of the following (2 Marks each):

Access transparency: enables local and remote resources to be accessed using identical operations.
Location transparency: enables resources to be accessed without knowledge of their physical or network
location (for example, which building or IP address).
Concurrency transparency: enables several processes to operate concurrently using shared resources
without interference between them.
Replication transparency: enables multiple instances of resources to be used to increase reliability and
performance without knowledge of the replicas by users or application programmers.
Failure transparency: enables the concealment of faults, allowing users and application programs to
complete their tasks despite the failure of hardware or software components.
Mobility transparency: allows the movement of resources and clients within a system without affecting
the operation of users or programs.
Performance transparency: allows the system to be reconfigured to improve performance as loads vary.
Scaling transparency: allows the system and applications to expand in scale without change to the system
structure or the application algorithms.

3. Consider the structure for a Student object containing the following fields: Name, Reg No, and
Year of Birth with the following values: {‘Scofield’, ‘17/X/1234’, 1987} respectively. Show the
external data representation of this message if marshalled using (a) CORBA Common Data
Representation, (b) Java Object Serialization, and (c) Extensible Markup Language. (4 Marks each)

Page 1 of 3
Index ← 4 bytes → Student 8-byte version number h0
0–3 8 3 int year String name String reg_no
4–7 “Scof” 1987 8 Scofield 9 17/X/1234 h1
8 – 11 “ield”
12 – 15 9 <student id="1234">
16 – 19 “17/X” <name>Scofield</name>
20 – 23 “/123” <reg_no>17/X/1234</reg_no>
24 – 27 “4___” <year>1987</year>
28 – 31 1987 </student>

4. Consider the UDP server program below that repeatedly receives a request and sends it back to
the client. Write a client program that repeatedly reads a line of input from the user, sends it to
the server in a UDP datagram message, then receives a message from the server. The client sets
a timeout on its socket so that it can inform the user when the server does not reply. (8p Marks)

import java.net.*;
import java.io.*;
public class UDPServer {
public static void main(String args[]) {
DatagramSocket aSocket = null;
Try {
aSocket = new DatagramSocket(6789);
byte[] buffer = new byte[1000];
while(true) {
DatagramPacket request = new DatagramPacket(buffer, buffer.length);
aSocket.receive(request);
DatagramPacket reply = new DatagramPacket(request.getData(),
request.getLength(), request.getAddress(), request.getPort());
aSocket.send(reply);
}
} catch (SocketException e) { System.out.println("Socket: " + e.getMessage());
} catch (IOException e) { System.out.println("IO: " + e.getMessage());}
} finally { if(aSocket != null) aSocket.close(); }
}}

Page 2 of 3
import java.net.*;
import java.io.*;
public class UDPClient{
public static void main(String args[]){
DatagramSocket aSocket = null;
try {
aSocket = new DatagramSocket();
byte [] m = args[0].getBytes(); // Line of input from user
InetAddress aHost = InetAddress.getByName(args[1]);
int port = 6789;
DatagramPacket request = new DatagramPacket(m, m.length(), aHost, port);
aSocket.send(request); // Send to server
byte[] buffer = new byte[1000];
DatagramPacket reply = new DatagramPacket(buffer, buffer.length);
aSocket.setSoTimeout(1000); // Set timeout. Throws IIO Exception
aSocket.receive(reply); // Receive from server if didn’t timeout
System.out.println("Reply: " + new String(reply.getData()));
} catch (SocketException e) { System.out.println("Socket: " + e.getMessage());
} catch (InterruptedIOException e) { System.out.println("IIO: " + e.getMessage());
} catch (IOException e) { System.out.println("IO: " + e.getMessage());
} finally { if(aSocket != null) aSocket.close(); }
}
}

Page 3 of 3

You might also like