You are on page 1of 21

DSYS UNIT-2 saqs laqs

Short answer questions


1. Explain about Namespace in distributed systems.
→ Names are commonly organized into namespaces.
→ Structured names can be represented as a labeled, directed graph with two types of nodes.
→ A leaf node represents a named entity with no outgoing edges and generally stores
information on the entity it is representing.
→ A directory node has a number of outgoing edges, each labeled with a name.
→ Each node in a naming graph is considered as a unique entity in a distributed system and
has an associated identifier which can be used to identify one entity at most once.
→ A directory node stores a table in which an outgoing edge is represented as a pair. Such a
table is called a directory table.
2. What are flat namespace and hierarchical namespace?
Flat namespace
→ Names are assigned as a sequence of symbols that are interpreted as a single whole label
without any internal structure.
→ There is no clear relationship between any of the entities.
Hierarchical Namespace
→ Names consist of a sequence of symbols assigned using a specific and clear structure.
→ Entities are related to each other using a hierarchical parent/child semantics.
3. Explain about 3 logical layers to implement name space.
1. Global layer
→ It is the highest level node called root node
→ It is stable as entries change very infrequently.
2. Administrational layer
→ It consists of the directory nodes managed by a single organizational
→ It is relatively stable, although changes can occur more frequently.
3. Managerial layer

→ It consists of nodes maintained by both users and administrators.


→ Nodes are the leaf-entities and change frequently.

1
DSYS UNIT-2 saqs laqs

4. What is directory information tree?

→ A Directory Information Tree (DIT) is data represented in a hierarchical tree like


structure consisting of the Distinguished Names (DNs) of directory service entries.
→ It forms the naming graph of an LDAP (Lightweight Directory Access Protocol)
directory service in which each node represents a directory entry.
→ A node may also act as a directory in traditional sense, in that there may be several
children for which the node acts as parent.
5. Define external and internal synchronization.
External synchronization

→ All computers in the system are synchronized with an external source of time.
→ Each process clock is synchronized with respect to an external time source.
→ Example- Christian’s algorithm and NTP
Internal synchronization

→ All computers in the system are synchronized with one another, but the time is not
necessarily accurate wrt UTC.
→ Each node shares its time with other nodes and all nodes set and adjust their time
accordingly.
→ It does not use external source, instead the process in the group themselves use each
other's clock to synchronize.
→ Example- Berkley Algorithm
6. What do you mean by logical clocks?

→ Logical Clocks refer to implementing a protocol on all machines within your distributed
system, so that the machines are able to maintain consistent ordering of events within
some virtual timespan.
→ A logical clock is a mechanism for capturing chronological and causal relationships in a
distributed system.
→ Distributed systems may have no physically synchronous global clock, so a logical clock
allows global ordering on events from different processes in such systems.
7. Define Lamport’s logical clock.
→ A Lamport logical clock is a numerical software counter value maintained in each
process.
→ It can be thought of as a clock that only has meaning in relation to messages moving
between processes.
→ When a process receives a message, it re-synchronizes its logical clock with that sender.
→ Lamport is also defined as a relation called happens before.
→ The expression a->b is read “a happens before b” means that all processes agree that first
event a occurs, then afterward event b occurs
2
DSYS UNIT-2 saqs laqs

8. State Lamport’s Happen –before relation.

→ In synchronize logical clocks, Lamport defined a relation called ‘happens-before’ that can
be observed directly in two situations-
1. If a and b are events in same process and a occurs before b, the a→b is true.
2. If a is the event of a message being sent by another process, then a→b is also true
→ A message cannot be received before it is sent, even at the same time it is sent, since it
takes a finite(non-zero) amount of time to arrive.
→ The happen-before is a transitive relation so if a→b & b→c then a→c.
9. Define clock skew and clock drift (maximum drift rate)

→ In a distributed system, each system’s CPU has its own clock which runs at a different
rate.
→ The relative difference in clock value is called clock skew.
→ On the other hand, the relative difference in clock frequency is called clock drift.
→ The difference per unit time from a perfect reference point is clock drift rate, which is
affected by many factors such as temperature.
10. What is mutual exclusion? Name any two mutual exclusion algorithms.

→ Mutual exclusion ensures that concurrent access of processes to a shared resource or data
is serialized, that is, executed in a mutually exclusive manner.
→ Mutual exclusion in a distributed system states that only one process is allowed to
execute the critical section at any given time.
The different types of mutual exclusion algorithms are-
1. Centralized algorithm
2. Decentralized algorithm
3. Distributed algorithm
4. Token Ring algorithm
11. Write two reasons for replicating data?
There are two primary reasons for replicating data - reliability and performance.

→ Data are replicated to increase the reliability of a system. If a file system has been
replicated it may be possible to continue working after one replica crashes by simply
switching to one of the other replicas. Also, by maintaining multiple copies.
→ Replication for performance is important when the distributed system needs to scale in
numbers and geographical area.

3
DSYS UNIT-2 saqs laqs

12. Define i. Read Your Writes ii. Writes Follow Reads

→ Read Your Writes consistency is achieved when the system guarantees that, once a record
has been updated, any attempt to read the record will return the updated value.
→ It allows you to ensure that a replica is at least current enough to have the changes made
by a specific transaction.
→ The effect of a write operation by a process on data item x will always be seen by a
successive read operation on x by the same process.
→ Hence, a write operation is always completed before a successive read operation by the
same process, no matter where that read operation takes place.
→ Writes Follow Reads- A write operation by a process on a data item x following a
previous read operation on x by the same process is guaranteed to take place on the same
or a more recent value of x that was read.
→ Hence, any successive write operation by a process on a data item x will be performed on
a copy of x that is up to date with the value most recently read by that process.
13. What is casual consistency and weak consistency?

→ The casual consistency model distinguishes between events that are casually related and
those that are not.
→ If Event B is caused or influenced by an earlier Event A, casual consistency requires that
every process sees Event A and then Event B.
→ Operations that are not casually related are said to be concurrent.
→ Weak consistency models access various synchronization variables associated with a data
store and are sequentially consistent.
→ No operation on synchronization variable is allowed to be performed until all previous
writes have been completed everywhere.
→ No read or write operation on data items are allowed to be performed until all previous
operations to synchronization variables have been performed.

4
DSYS UNIT-2 saqs laqs

Long answer questions


1. Define DNS and explain with a suitable example. (5 marks)
Domain Naming System

→ It is a hierarchical naming system built on distributed database for computers, services or


any resource connected to the internet or private network.
→ It associates various information with domain names assigned to each of its entities.
→ It translates domain names meaningful to humans into the numerical identifiers
associated with networking equipment for the purpose of locating and addressing these
devices worldwide.
→ It serves as a phone book for the internet for translating human-friendly computer
hostnames into IP addresses.
→ It makes it possible to assign domain names to groups of internet resources and users in a
meaningful way, independent of each entity's physical location.
→ This allows World Wide Web hyperlinks and internet contact information to remain
consistent and constant even if the current routing arrangements change.
→ It distributes the responsibility of assigning domain names and mapping those names to
IP addresses by designating authoritative name serves for each domain.
→ Authoritative name servers are assigned to be responsible for their particular domains,
and in turn can assign other authoritative name servers for their sub domains.
→ This mechanism has made the DNS distributed and fault tolerant and has helped avoid
the need for a single central register to be continually consulted and updated.
→ It also stores other types of information such as list of mail servers that accept email for a
given internet domain.
→ It is an essential component of the functionality of the internet as it provides worldwide,
distributed keyword-based redirection service.
→ Example-

5
DSYS UNIT-2 saqs laqs

2. Explain how DNS can be used to implement a homebased approach to locating mobile
entities? (5 marks)
→ The home location is often chosen to be the place where an entity was created.
→ A home-based approach to is used as a fallback mechanism for location-based services
based on forwarding pointers.
→ Each mobile host uses a fixed IP address to which all communication is initially directed
to the mobile host’s home agent.
→ This home agent is located on the LAN corresponding to the network address contained
in the mobile host’s IP address.
→ Whenever the mobile host moves to another network, it requires temporary address that it
can use for communication. This care-of address is registered at the home agent.
→ Whenever the home agent receives a packet for mobile host it looks up the host’s current
location.
→ If the host is on the current LAN, packet is simply forwarded, else it is tunneled to the
hosts current location wrapped as data into an IP packet and sent to the care-of address.
→ At the same time the sender of the packet is informed of the hosts current location.
→ IP address is effectively used as an identifier for the mobile host.
→ Fig. Illustrates the principle of Mobile IP-

6
DSYS UNIT-2 saqs laqs

3. Explain iterative name resolution. (5 marks) OR Explain iterative and recursive name
resolution. (10 marks)
Address Resolution in Domain Name Server

→ Mapping a domain name to an IP Address is known as Name-Address Resolution.


→ The Domain Name Server (DNS) Resolver performs this operation by consulting name
servers.
→ In order to find a particular DNS requesting host place its query to the Local DNS Server
with a mapping request.
→ If it has the information, the resolver is satisfied else the resolver is referred to other
servers or other servers are asked to provide the information.
→ After the resolver, gets the response, it checks whether the response is correct or not.
→ If the response is correct, the response is passed to the process that requested it, else the
name query fails.
A resolution can be of two types – iterative and recursive resolution.
Recursive Resolution
The client requires the Local Server to give either the requested mapping or an error message.

→ A DNS Query is generated by the application program to the resolver to fetch the
destination IP Address and is then forwarded to the local DNS Server.
→ If it knows the IP Address, it sends a response to the resolver. Assuming, it does not
know the IP Address, it sends the query to the root name server.
→ The root name server contains information about at least one server of Top-Level
Domain.
→ The query is then sent to the respective Top-Level Domain server.
→ If it contains the mapping, the response is sent back to the root server and then to the
host’s local server.
→ If it doesn’t contain the mapping, it should contain the IP Address of the destination’s
local DNS Server.
→ The local DNS server knows the destination host’s IP Address.
→ The information is then sent back to the top-level domain server, then to the root server
and then to the host’s Local DNS Server, and finally to the host.

7
DSYS UNIT-2 saqs laqs

Iterative Resolution
The main difference between iterative and recursive resolution is that here each server that does
not know the mapping sends the IP Address of the next server to the one requested it.

→ The client allows the server to return the best answer it can give as a match or as a
referral.
→ A DNS Query is generated by the application program to the resolver to fetch the
destination IP Address.
→ The Query is then forward to the local DNS Server. Assuming, it does not know the IP
Address, it sends the query to the root name server.
→ The root name server returns the IP Address of the Top-Level Domain Server to the
Local Server.
→ The Top-Level Domain server is contacted by the Local Server and it returns either the IP
of the destination host or its local DNS Server.
→ If it returns the server’s address, then by contacting the destination’s Local DNS Server,
we get the IP Address of the destination host.
→ The response/mapping is then passed from the host’s local DNS server to the resolver and
then finally to the host.

8
DSYS UNIT-2 saqs laqs

4. List clock synchronization algorithms and explain any two. OR What are the advantages
of clock synchronization algorithms? Explain anyone. (5 marks)
Berkeley’s Algorithm
Berkeley’s Algorithm is a clock synchronization technique used in distributed systems. The
algorithm assumes that each machine node in the network either doesn’t have an accurate time
source or doesn’t possess a UTC server.
Algorithm-
1) An individual node is chosen as the master node from a pool node in the network. This node is
the main node in the network which acts as a master and the rest of the nodes act as slaves. The
master node is chosen using an election process/leader election algorithm.
2) Master node periodically pings slave nodes and fetches clock time at them using Cristian’s
Algorithm.
3) Master node calculates the average time difference between all the clock times received and
the clock time given by the master’s system clock itself. This average time difference is added to
the current time at the master’s system clock and broadcasted over the network.
(a) illustrates how the master sends requests to slave nodes.
(b) illustrates how slave nodes send back time given by their system clock.

Cristian’s Algorithm
Cristian’s Algorithm is a clock synchronization algorithm is used to synchronize time with a
time server by client processes. This algorithm works well with low-latency networks where
Round Trip Time is short as compared to accuracy while redundancy-prone distributed
systems/applications do not go hand in hand with this algorithm. Here Round Trip Time refers to
the time duration between the start of a Request and the end of the corresponding Response.
Algorithm-
1) The process on the client machine sends the request for fetching clock time (time at the
server) to the Clock Server at time
2) The Clock Server listens to the request made by the client process and returns the response in
form of clock server time.
3) The client process fetches the response from the Clock Server at time and calculates the
synchronized client clock time using the formula given below.

9
DSYS UNIT-2 saqs laqs

5. Explain the concept of Lamports totally ordered logical clocks. (5 marks)


Lamport’s Logical Clocks
To synchronize logical clocks, Lamport defined a relation called happens-before.
The expression a ~ b is read "a happens before b" and means that all processes agree that first
event a occurs, then afterward, event b occurs.
The happens-before relation can be observed directly in two situations-
1. If a and b are events in the same process, and a occurs before b, then a ~ b is true.
2. If a is the event of a message being sent by one process, and b is the event of the message
being received by another process, then a ~ b is also true. A message cannot be received
before it is sent, or even at the same time it is sent, since it takes a finite, nonzero amount
of time to arrive.
Lamport’s Algorithm
We need a way of measuring time such that for every event a, we can assign it a time value C(a)
on which all processes agree on the following-
1. The clock time C must monotonically increase i.e., always go forward.
2. If a → b then C(a) < C(b)
Each process p maintains a local counter C p
The counter is adjusted based on these rules-

1. Cp is incremented before each event is issued at process p: C p = Cp +1


2. When p sends a message m, it piggybacks on m the value t = C p
3. On receiving (m , t) process q computes Cq = max(Cq , t) and then applies the first rule
before timestamp the event rcv(m)
Example

Assume that each process’s logical clock is set to 0.

10
DSYS UNIT-2 saqs laqs

From the timing diagram we can say that about the following events-

• Between a and b: a → b
• Between b and f: b → f
• Between e and k: concurrent
• Between c and h: a > concurrent
• Between k and h: k → h
• Timestamp = 1 associated with events a, e, j in processes P1, P2, P3 respectively
• Timestamp = 2 associated with events b, k in processes P1, P3 respectively
• Times maybe the same but the events are distinct.
• Create a total order of all evets I.e., for an event a, b either a → b or b → a
• Create total order by attaching a process number to an event.
• Pi timestamps event e with Ci(e).i
We say that Ci(a).i happens before C j(b).j iff-
▪ Ci(a) < Cj(b) or
▪ Ci(a) = Cj(b) and i<j

11
DSYS UNIT-2 saqs laqs

6. What are election algorithms? Explain Bully algorithm. (5 marks) OR Write in detail
about Election Algorithms. (10 marks)
→ Election algorithms are designed to choose a coordinator.
→ They choose a process from a group of processors to act as a coordinator.
→ If the coordinator process crashes due to some reasons, then a new coordinator is elected
on other processor.
→ It determines where a new copy of the coordinator should be restarted.
→ It assumes that every active process in the system has a unique priority number.
→ The process with highest priority will be chosen as a new coordinator.
→ Hence, when a coordinator fails, this algorithm elects that active process which has
highest priority number.
→ Then this number is sent to every active process in the distributed system.
1. The Bully Algorithm applies to system where every process can send a message to every other
process in the system. Suppose process P sends a message to the coordinator.
1. If the coordinator does not respond to it within a time interval T, then it is assumed that
coordinator has failed.
2. Now process P sends an election message to every process with high priority number.
3. It waits for responses, if no one responds for time interval T then process P elects itself as
a coordinator.
4. Then it sends a message to all lower priority number processes that it is elected as their
new coordinator.
5. However, if an answer is received within time T from any other process Q,
→ (I) Process P again waits for time interval T’ to receive another message from Q
that it has been elected as coordinator.
→ (II) If Q doesn’t respond within time interval T’ then it is assumed to have failed
and algorithm is restarted.
2. The Ring Algorithm assumes that the link between the process is unidirectional and every
process can message to the process on its right only.
1. If process P1 detects a coordinator failure, it creates new active list which is empty
initially. It sends election message to its neighbor on right and adds number 1 to its active
list.
2. If process P2 receives message elect from processes on left, it responds in 3 ways:
→ (I) If message received does not contain 1 in active list, then P1 adds 2 to its
active list and forwards the message.
→ (II) If this is the first election message it has received or sent, P1 creates new
active list with numbers 1 and 2. It then sends election message 1 followed by 2.
→ (III) If Process P1 receives its own election message 1 then active list for P1 now
contains numbers of all the active processes in the system. Now Process P1
detects highest priority number from list and elects it as the new coordinator.

12
DSYS UNIT-2 saqs laqs

7. Interpret the algorithms for distributed mutual exclusion in detail.


Mutual Exclusion
It refers to when a number of processes in a distributed system want exclusive access to some
resource. It is achieved using the following four algorithms-
1. Centralized algorithm
2. Decentralized algorithm
3. Distributed algorithm
4. Token Ring algorithm
1. Centralized algorithm
→ One process is elected as the coordinator.
→ Whenever a process wants to access a shared resource, it sends a request message to the
coordinator stating which resource it wants to access and asking for permission.
→ If no other process is currently accessing that resource, the coordinator sends back a reply
granting permission.
→ When the reply arrives, the requesting process can proceed.

(a) Process 1 asks for permission and Process 3 (coordinator) grants permission
(b) Process 2 asks for permission; Process 3 does not reply since process 1 is accessing the
resource. Process 2 waits in the queue.
(c) Process 1 releases the resource, Process 3 now replies ‘OK’ to Process 2; Process 2 gets
to access the resource.
2. Decentralized algorithm
→ Principle: Assume every resource is replicated n times, with each replica having its own
coordinator Þ access requires a majority vote from m > n/2 coordinators.
→ A coordinator always responds immediately to a request.
→ Assumption: When a coordinator crashes, it will recover quickly, but will have forgotten
about permissions it had granted.
→ Issue: Let p denote the probability that a coordinator crashes and recovers iPn a period Dt

Þ probability that k out m coordinators reset


Given that at least 2m - n coordinators need to reset n order to violate the correctness of
the voting mechanism, the probability that such a violation occurs is then

13
DSYS UNIT-2 saqs laqs

3. Distributed algorithm

→ requires that there be a total ordering of all events in the system


→ for any pair of events it must be unambiguous which one actually happened first.
→ When a process wants to access a shared resource, it builds a message containing the
name of the resource, its process number, and the current (logical) time.
→ It then sends the message to all other processes, conceptually including itself.
→ When a process receives a request message from another process, the action it takes
depends on its own state with respect to the resource named in the message.
Three different cases have to be clearly distinguished:
1. If the receiver is not accessing the resource and does not want to access it, it sends back
an OK message to the sender.
2. If the receiver already has access to the resource, it simply does not reply. Instead, it
queues the request.
3. If the receiver wants to access the resource as well but has not yet done so, it compares
the timestamp of the incoming message with the one contained in the message that it has
sent everyone. The lowest one wins.
a. If the incoming message has a lower timestamp, the receiver sends back an OK message.
b. If its own message has a lower timestamp, the receiver queues the incoming request and
sends nothing.

(a) Process 0 generates a message stating the name of the resource and it’s timestamp = 8
and sends it to Process 0, 1, 2; Process 2 sends a message stating the resource and it’s
timestamp = 12 and sends it to Process 0, 1, 2.
(b) Process 0 and Process 2 compare their timestamps (8<12), Process 2 losses and sends
‘OK’ to Process 0.
(c) Process 0 accesses, completes and then sends ‘OK’ to Process 2; Process 2 can now
access the resource.
4. Token Ring algorithm

→ Organize processes in a logical ring, and let a token be passed between them.
→ The one that holds the token is allowed to enter the critical region (if it wants to)

14
DSYS UNIT-2 saqs laqs

(a) An unordered group of processes on a network. (b) A logical ring constructed in


software
→ When the ring is initialized, process 0 is given a token; the token circulates around the
ring.
→ Circulating from Process(k) to Process (k+1) in point-to-point messages.
→ When a process acquires the token from its neighbor, it checks to see if it needs to access
the shared resource.
→ If needed, it uses and then releases the resource.
→ The token then continues circulating.

15
DSYS UNIT-2 saqs laqs

8. Write short notes on a. Data centric consistency b. Client centric consistency models.
Data Centric Consistency models
→ A data-store can be read from or written to by any process in a distributed system.
→ A local copy of the data-store (replica) can support “fast reads”.
→ However, a write to a local replica needs to be propagated to all remote replicas.
→ Various consistency models help to understand the various mechanisms used to achieve
and enable this.
→ A consistency model is a contract between a DS data-store and its processes. If the
processes agree to the rules, the data-store will perform properly and as advertised.

We have two approaches to consistency model-


1. Continuous Consistency

→ Measure inconsistency by exactly what can be tolerated in an application.


→ There are different ways for applications to specify what inconsistencies they can
tolerate- 1. Deviation in numerical values 2. Deviation in staleness (last update time)
between replicas 3. Deviation with respect to the number and ordering of updates
2. Consistency Ordering of Operations

→ Behavior of two processes, operating on the same data item- 1. A strictly consistent data-
store 2. A data-store that is not strictly consistent.
Client Centric Consistency models

→ Client-centric consistency models guarantees that whenever a client connects to a new


replica, that replica is updated with the data that was initially manipulated by that user.
→ A client should be able to move back in time with respect to data store. This is called
client-centric consistency.
Various client centric consistency models are-

16
DSYS UNIT-2 saqs laqs

1. Eventual consistency-
Large scale distributed and replicated databases tolerate a relatively high degree of
inconsistency. If no updates take place for a long time, all replicas will gradually become
consistent. This from of consistency is called Eventual consistency.
Fig. Shows the principle of a mobile user accessing different replicas of a distributed database.

2. Monotonic Reads- If a process reads the value of a data item x, any successive read operation
on x by that process will always return the same value or a more recent one.
Fig. Shows the read operations performed by a single Process P at two different local copies of
the same data store. (a) monotonic reads is provided. (b) does not provide monotonic reads.

3. Monotonic Writes- A write operation on a data item x is completed before any successive
write operation on x can be performed on x by the same process.
Fig. Shows write operations performed by a single Process P at two different local copies of the
same data store (a) monotonic writes is provided. (b) does not prove monotonic writes.

17
DSYS UNIT-2 saqs laqs

4. Read Your Writes- The effect of a write operation by a process on data item x will always be
seen by a successive read operation on x by the same process.
Fig. (a) Data store provides Read-Your-writes consistency (b) does not provide RYW

5. Writes Follows Reads- A write operation by a Process P on a data item x following a previous
read operation on x by the same process is guaranteed to take place on the same or on the most
recent value of x that was read.
Fig. (a) Data store proves Writes-Follows-Reads consistency (b) does not provide WFR

18
DSYS UNIT-2 saqs laqs

9. Explain the concept of Global States? (5 marks) Write in detail about Global positioning
of nodes.
Global States

→ The Global State of a distributed system is a collection of the local states of the processes
and the channels.
→ A global state of a consistent cut comprises the local state of each process at the time cut
event and the set of all messages sent but not yet received.
→ A global state is used as distributed applications/services execute concurrently on
multiple machines.
→ A global picture is used as a snapshot of the distributed application.
1. Checkpointing- can restart distributed application on failure.
2. Garbage collection of objects- objects at servers that do not have any other object at any
of the servers with no pointers to them.
3. Deadlock detection- useful in Database Transaction Systems
4. Termination of computation- useful in Batch Computing Systems.
Global Positioning of Nodes

→ When the number of nodes in a distributed system grows, it becomes increasingly


difficult for any node to keep track of others.
→ Such knowledge maybe important for executing distributed algorithms.
→ A specific position is given to each node in an n dimensional geometric space overlaying
networks such that the distance between two given nodes in a space reflects real-world
performance metrics.
→ P and Q are two nodes with distance k(P, Q) gets reflected to how long it would take for a
message to travel from P t Q and vice vera.
→ Example- Optical replica placement- A web site gathered client positions and wants to
replace servers then compute k positions to place the replicas such that the average client
replica response time must be minimized.
→ Performing such computations is almost trivially feasible if clients and servers have
geometric positions that reflect internode latencies.

10. Write short notes on Replicated-Write Protocols and Primary based protocols for
consistency. (10 marks)
A Consistency Protocol describes an implementation of a specific consistency model (dat-centric
and client centric consistency models).
Primary-Based Protocols
→ Each data is associated with a primary replica
→ It is responsible for coordinating writes to the data item.
→ There are two types of Primary-based protocol- 1. Remote-Write 2. Local-Write
19
DSYS UNIT-2 saqs laqs

1. Remote-Write Protocol

→ All write operations need to be forwarded to a fixed single server.


→ Read operations can be carried out locally.
→ It is also called as a primary backup protocol
→ The figure shows a process wanting to perform a write operation on data item x, forwards
that operation to the primary server of x.


Local-Write Protocol

→ Primary copy migrates between processes that wish to perform a write operation.
→ Whenever a process wants to update data item, it locates the primary copy of x and
moves it to its own location.
→ Multiple successive writes can be carried ot locally while reading processes can still
access their local copy.


20
DSYS UNIT-2 saqs laqs

Replicated-Write Protocols
Write operations can be carried out at multiple replicas instead of only one, as in the case of
primary-based replicas.
There are two types- 1. Active Replication 2. Majority Voting (Quorums)
Active Replication

→ each replica has an associated process that carries out update operations.
→ In contrast to other protocols, updates are generally propagated by means of the write
operation that causes the update.
→ One problem with active replication is that operations need to be carried out in the same
order everywhere which requires a totally-ordered multicast mechanism implemented
using Lamport's logical clocks but this does not scale well within Distributed Systems.
→ An alternative/variation is to use a sequencer, which is a process that assigns a unique
ID# to each update, which is then propagated to all replicas.
Quorum-Based

→ Clients must request and acquire permissions from multiple replicas before either
reading/writing a replicated data item.
→ Methods devised by Thomas (1979) and generalized by Gifford (1979).
Example

→ A file is replicated within a distributed file system.


→ To update a file, a process must get approval from a majority of the replicas to perform a
write.
→ The replicas need to agree to also perform the write.
→ After the update, the file has a new version # associated with it (and it is set at all the
updated replicas). To read, a process contacts a majority of the replicas and asks for the
version # of the files.
→ If the version # is the same, then the file must be the most recent version, and the read
can proceed.

21

You might also like