Main Assignment

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

TASK 7.

Questions 1
Use the World Wide Web as an example to illustrate the concept of resource sharing,
client and server. What are the advantages and disadvantages of HTML, URLs and
HTTP as core technologies for information browsing?

Resource Sharing: Computer Resources which are made available from one host to
other hosts on a network. It also allows multiple user access data simultaneously. Web
Pages are examples of resources that are shared. The thing that does management of web
pages is web server where these web pages are stored from where different users can
access those web pages at same time where these resources are stored in web server made
available for sharing between users.

Client & Server: Client & Server is an architecture where Client is the users browser
from where requests are generated for web pages and server is also an computer where
these web pages are stored.

HTML Advantages & Disadvantages:


There are many advantages and disadvantages of HTML, including compatibility and
difficulty of use. All Web browsers can read HTML files and webpages, but the
language can be difficult to decipher, especially since one small typo could lead to a
non-functioning webpage. HTML is easy enough to write, but errors can be costly.
Another disadvantage is the time it takes to choose the colour scheme of a page and to
create lists, TABLES and forms. An advantage to HTML is that it is easy to code.
Much of the code can be customized by someone who knows proper HTML
formatting. HTML also allows the use of templates, which makes designing a
webpage easy.

URLs Advantages and Disadvantages


A Uniform Resource Locator (URL), commonly informally termed a web address is a
reference to a web resource that specifies its location on a computer network and a
mechanism for retrieving it. Unfortunately URL redirection can be easily used to lead
people to malicious sites (Phishing). URLs are efficient resource locators but they are
not sufficiently rich as resource links. For example, they may point at a resource that
has been relocated or destroyed; their granularity (a whole resource) is too coarse-
grained for many purposes.

HTTP Advantages and Disadvantages


HTTP (Hypertext Transfer Protocol) is the set of rules for transferring files (text,
graphic images, sound, video, and other multimedia files) on the World Wide Web.
HTTP is a simple protocol that can be implemented with a small footprint, and which
can be put to use in many types of content transfer and other types of service. Its
verbosity makes it inefficient for passing small amounts of data.
Are any of these technologies suitable as a basis for client-server computing in
general? Explain your answer.

HTTP and URLs are acceptable as a basis for client-server computing except that
there is no strong type checking and there is the inefficiency that we have mentioned.

Question 2
Differentiate between connectionless and connection-oriented inter-process
communication using example protocols.

A connection oriented service means you have reasonable expectations of the


connection, in computer terminology it means that, the service enables that you are
connected exactly when needed. This includes TCP, where each packet is
acknowledged, and hence guarantee is made about the connection. Connection-
Oriented means that when devices communicate, they perform handshaking to set up
an end-to-end connection.

In connectionless service no such guarantee is made, and hence the data packets are
sent with just the destination address, and no routing information. The examples
include IP (Internet Protocol) and UDP Packets. Connectionless means that no effort
is made to set up a dedicated end-to-end connection.

What are the issues relating to UDP Communication? Give an example application
where UDP is used. Why UDP is still used?

UDP is not reliable it does not cares if any packet is lost. UDP has no flow control
option. UDP does not attempt error recovery. In UDP there are more chances of loss
of packets.
Network Management, Routing Protocol, Online Streaming, and Internet telephony
do use UDP.
UDP communication is still used because it has no connection establishment which
can add delay. It is simple no connection state at sender or receiver and its header size
is also small. No congestion control UDP can blast away as fast as desired.

Question 3
Explain clearly what is meant by Remote Method Invocation (RMI). What protocol
is used in RMI?

RMI (Remote Method Invocation) is a way that a programmer, using the Java
programming language and development environment, can write object-oriented
programming in which objects on different computers can interact in a distributed
network. RMI is the Java version of what is generally known as a remote procedure
call (RPC), but with the ability to pass one or more objects along with the request.
The object can include information that will change the service that is performed in
the remote computer. Java Remote Method Protocol or JRMP is used in RMI.
Discuss a scenario in which a client could receive a reply from an earlier call by the
use of the protocol used in RMI.

Client sends request message, times out and then retransmits the request message,
expecting only one reply. The server which is operating under a heavy load eventually
receives both request messages and sends two replies. When the client sends a subsequent
request it will receive the reply from the earlier call as a result. If request identifiers are
copied from request to reply messages, the client can reject the reply to the earlier
message.

Question 4
What are the essential requirements for mutual exclusion? What are the criteria for
measuring algorithmic performance for mutual exclusion solutions?

Requirements:

i. Safety Property: At any instant, only one process can execute the critical section.
ii. Liveness Property: Two or more sites should not endlessly wait for messages
which will never arrive.
iii. Fault Tolerance: Each process gets a fair chance to execute the CS
iv. Freedom from deadlocks and Starvation
v. Fairness

Criteria for Measuring Algorithm Performance:

Performance is generally measured by the following metrics:

i. Message Complexity: The number of messages required per CS execution by a


site.
ii. Synchronization Delay: After a site leaves the CS, the time required and before
next site enters the CS is delay.
iii. Response Time: The time interval a request waits for its CS execution to be over
after its request messages have been sent out.
iv. System Throughput: The rate at which the system executes requests for the CS.

In a certain system, each process typically uses a critical section many times before
another process requires it. Explain why Ricart and Agrawalas multi-cast based
algorithm is inefficient for this case, and describe how to improve its performance.
Does your adaptation satisfy liveness condition ME2?

In Ricart and Agrawalas multicast-based mutual exclusion algorithm, a client issues a


multicast request every time it requires entry. This is inefficient in the case described, of a
client that repeatedly enters the critical section before another needs entry.
Instead, a client that finishes with a critical section and which has received no outstanding
requests could mark the token as JUST_RELEASED, meaning that it has not conveyed
any information to other processes that it has finished with the critical section. If the
client attempts to enter the critical section and finds the token to be JUST_RELEASED, it
can change the state to HELD and re-enter the critical section. To meet liveness condition
ME2, a JUST_RELEASED token should become RELEASED if a request for entry is
received.
Question 5
Describe briefly the problem of dirty read. Explain how strict execution of transactions
avoids dirty reads.
In database processing, we come across the situation wherein one transaction can
change a value, and a second transaction can read this value before the original change
has been committed or rolled back this is called dirty read. Strict execution of
transactions it is required that transactions delay both their read and write operations so
avoid dirty reads.

A server manages the objects a1, a2,... an. The server provides two operations for its clients:
read (i) returns the value of ai; write(i, Value) assigns Value to ai. The transactions T and
U are defined as follows:

T: x= read (j); y = read (k); write(k, 70); write(j, 33);

U: x= read(i); write (i,85); y=read(k); z = read(j), write(k, 99).

Provide a serially equivalent interleaving of the transactions T and U that is strict. Explain
your answer.

The interleavings of T and U are serially equivalent if they produce the same outputs (in x
and y) and have the same effect on the objects as some serial execution of the two transactions. The
two possible serial executions and their effects are:
If T runs before U: xT = aj0 ; yT = ai0 ; xU = ak0 ; yU= 44; ai =55; aj =44; ak = 66.
If U runs before T: xT = aj0 ; yT = 55; xU = ak0 ; yU= aj0 ; ai =33; aj =44; ak = 66,
where xT and yT are the values of x and y in transaction T; xU and yU are the values of x and y in
transaction U and ai0 , aj0 and ak0 , are the initial values of ai, aj and ak

Interleaving 1 Interleaving 2
TU TU
x:=read(j) x:=read(j)
x:= read(k) y:=read (i)
write(i, 55) x= read(k)
y = read(i) write(j, 44)
y = read(j) write(i, 33)
write(k, 66) write(i, 55)
write(j, 44) write(k, 66)
write(i, 33)

Interleaving 1 is equivalent to U before T. yT gets Interleaving 2 is equivalent to T before U. yU


the value of 55 written by U and at the end ai gets the value of 44 written by T and at the end ai
=33; aj =44; ak = 66. =55; aj =44; ak = 66.
What is meant by strict two-phase locking? What transaction problems are avoided by
strict two-phase locking?

Two-phase locking in a distributed transaction requires that it cannot acquire a lock at any
server after it has released a lock at any server.
A transaction that needs to read or write an object must be delayed until other transactions
that wrote the same object have committed or aborted. To enforce this rule, any locks
applied during the progress of a transaction are held until the transaction commits or
aborts. This is called strict two-phase locking. Dirty Reads and Premature Writes are
avoided by strict two phase locking.

The transactions T and U are defined as follows where A, B, and C are bank accounts with
balances of A: $100, B: $400, and C: $800.
T: cb = C.getBalance(); C.withdraw(200); A.deposit(200); (Transfers $200 from Account C to
A)

U: cb= C.getBalance();bu=B.getBalance();C.Deposit(1000); A.getBalance(); A.withdraw (50);

Apply strict two-phase locking and demonstrate that the results are serially equivalent.

T operations Lock U operations Lock


Cb=C.getBalance() Lock cb
;
C.getBalance(); Lock cb
C.withdraw(400);
Bu = B.getBalance(); Lock bu
A.deposit(200);
C.Deposit(1000);
A.getBalance();
A.withdraw (50);
Question 6
In single server transactions the coordinator issues a unique timestamp to each
transaction when it starts. Serial equivalence is achieved by committing the versions of
objects in the order of the timestamps of transactions that accessed them. What changes
must be made to adapt it for use with distributed transactions? Demonstrate your
answer with an example of two Transactions T and U.

Timestamps for local concurrency control are just local counters. But for distributed
transactions, timestamps at different servers must have an agreed global ordering. For
example, they can be generated as (local timestamp, server-id) to make them different. The
local timestamps must be roughly synchronized between servers. With timestamp ordering, a
transaction may be aborted early at one of the servers by the read or write rule, in which case
the abort result is returned to the client. If a server crashes before the client has done all its
actions at that server, the client will realise that the transaction has failed. In both of these
cases the client should the send an abortTransaction to the coordinator. When the client
request to commit arrives, the servers should all be able to commit, provided they have not
crashed after their last operation in the transaction.

Question 7
Explain the use of leases in a discovery service to cope with the problem of service
volatility.

Service volatility is handled in different ways according to the


architecture of the directory implementation. A lease is a temporary allocation
of some resource by a server to a client, which can only be renewed by a further request
from the client before the leases deadline has expired. If the client fails to renew it the
server withdraws the resource.

(a)(ii) Available copies of replication is applied to data items A and B with replicas Ax,
Ay and Bm, Bn. The transactions T and U are defined as:

T: Read(A); Write(B, 45).


U: Read(B); Write (A,35)

Show an interleaving of T and U assuming that two-phase locks are applied to the
replicas. Complete the part answer given below.

T Operations Locks U operations Locks


x= Read (Ax) Lock Ax

Write(Bm, 44) lock Bm


x:= Read (Bm) Wait
Write(Bn, 44) lock Bn -
Commit unlock Ax,Bm,Bn -
Write(Ax, 35) lock Ax
Write(Ay, 35) lock Ay

(b) What are the contextual factors to be taken into account when adapting multimedia
content?

The aim of adaptive systems is to accommodate heterogeneity by


allowing software reuse across contexts that vary in factors such as
device capabilities and user preferences, bandwidth limitations,
and to accommodate changing runtime resource conditions by
adapting application behaviour without sacrificing crucial application
properties. But achieving those goals can be extremely difficult.

(a) A router separating process p from two others, q and r, fails immediately after p
initiates the multicasting of message m. If the group communication system is view-
synchronous, explain what happens to p next.
Process p must receive a new group view containing only itself, and it must receive the
message it sent. The question is: in what order should these events be delivered to p.
If p received the message first, then that would tell p that q and r received the message;
but the question implies that they did not receive it. So p must receive the group view
first.

(b) You are given a group communication system with a totally ordered multicast
operation, and a failure detector. Is it possible to construct view-synchronous group
communication from these components alone?
If the multicast is reliable, yes. Then we can solve consensus. In particular, we can
decide, for each message, the view of the group to deliver it to. Since both messages and
new group views can be totally ordered, the resultant communication will be view-
synchronous. If the multicast is unreliable, then we do not have a way of ensuring the
consistency of view delivery to all of the processes involved.

You might also like