30
IV/IV B. Tech (Regular/Supply) Degree Examination November, 2016 (First Semester) Information Technology (DISTRIBUTED SYSTEMS) Scheme of Evaluation Answer Question No.1 compulsorily. (1X12= 12 Marks) Answer ONE question from each unit. (4X12=48 Marks) 1.Answer all questions (12X1=12 Marks) a) Define Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users as a single coherent system. b) Define client and server. Ans: A client can be a program(on behalf of user) which request for services from server. A server is a program which handles the request coming from the client and provide service. c) What are extended RPC models? Ans: asynchronous RPC, doors are considered to be evolved or extended versions of RPC models. d)What is object adapter? Ans: An object adapter is the mechanism that connects a request using an object reference with the proper code to service that request. e) Explain the significance of Multithreading in DS. Ans: One challenge in distributed systems is concurrency. Without supporting multithread, distributed systems is almost meaningless as it needs to support multiple users. It is typical in distributed systems to have tasks that are partly CPU intensive and partly I/O bound. f)Differentiate stateful and stateless server. Ans: A stateful server keeps state between connections. A stateless server does not. So, when you send a request to a stateful server, it may create some kind of connection object that tracks what information you request. ... HTTP and NFS are stateless protocols. g) What are logical clocks. Ans: 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. h) Define consistency. Ans: Consistency in distributed systems can be explained as maintaining replicated copies of data items consistent(same) i.e., if one copy of data item is updated, that update should be performed on every replicated data item. i) What is process resilience? Ans: Process resilience means how a process can sustain its performance during failures using different techniques such as failure masking, reaching agreement on faulty process using process groups etc., j)Write short notes on fault tolerance. Ans: A system is said to be fault tolerant system if the performance remains the same after the occurrence of fault. k) For what purpose CODA is designed.

IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

IV/IV B. Tech (Regular/Supply) Degree ExaminationNovember, 2016(First Semester)

Information Technology

(DISTRIBUTED SYSTEMS)Scheme of Evaluation

Answer Question No.1 compulsorily. (1X12= 12 Marks)Answer ONE question from each unit. (4X12=48 Marks)1.Answer all questions (12X1=12 Marks)a) Define Distributed System.Ans: A Distributed system is a collection of independent computers that appears to its users as asingle coherent system.b) Define client and server.Ans: A client can be a program(on behalf of user) which request for services from server.A server is a program which handles the request coming from the client and provide service.c) What are extended RPC models?Ans: asynchronous RPC, doors are considered to be evolved or extended versions of RPC models.d)What is object adapter?Ans: An object adapter is the mechanism that connects a request using an object reference with theproper code to service that request.e) Explain the significance of Multithreading in DS.Ans: One challenge in distributed systems is concurrency. Without supporting multithread,distributed systems is almost meaningless as it needs to support multiple users. It is typical indistributed systems to have tasks that are partly CPU intensive and partly I/O bound.f)Differentiate stateful and stateless server.Ans: A stateful server keeps state between connections. A stateless server does not. So, when yousend a request to a stateful server, it may create some kind of connection object that tracks whatinformation you request. ... HTTP and NFS are stateless protocols.g) What are logical clocks.Ans: A logical clock is a mechanism for capturing chronological and causal relationships in adistributed system. Distributed systems may have no physically synchronous global clock, so alogical clock allows global ordering on events from different processes in such systems.h) Define consistency.Ans: Consistency in distributed systems can be explained as maintaining replicated copies of dataitems consistent(same) i.e., if one copy of data item is updated, that update should be performed onevery replicated data item.i) What is process resilience?Ans: Process resilience means how a process can sustain its performance during failures usingdifferent techniques such as failure masking, reaching agreement on faulty process using processgroups etc.,j)Write short notes on fault tolerance.Ans: A system is said to be fault tolerant system if the performance remains the same after theoccurrence of fault.k) For what purpose CODA is designed.

Page 2: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

Ans: CODA is a distributed file system designed to run an interconnected network of systems toperform different tasks in a distributed environment.l)Differentiate physical clock and logical clock.Ans: A physical clock is a timestamp value taken from system clock whereas a logical clock is amechanism for capturing chronological and causal relationships in a distributed system.

UNIT I2. a) What are the goals that are to be achieved in order to design a distributed system?

-6MarksAns : -Any relevant content related to below points should begiven marksGoal of Distributed system :

• Connecting users to resources 2 marks for relevant explanation• Openness 1 mark for relevant explanation• Transparency 2 marks for relevant explanation• Scalability 1 mark for relevant explanation

Connecting users to resources:-Is to make it easy for users to access remote resources, and to share them with other users in acontrolled way.- Easier to collaborate and exchange information.- Security is becoming more and more important as connectivity and sharing increase.Openness:Open distributed system is a system that offers services according to standard rules that describe thesyntax and semantics of these services.In Distributed system services are specified through interfaces (IDL: interface Definition Language)which specify

• Specify the names of the functions that are available together with type of theparameters, return values, possible exceptions .

• Hard part: the semantics of interfaces (by means of natural language) →informal way.

Proper specifications are complete & neutral• Complete: everything that is necessary to make an implementation has

indeed been specified.(in real world not at all complete)

• Neutral: specifications do not prescribe what the implementationshould look like they should be neutral.

Open distributed systems should support• Interoperability• Portability• Flexibility

Interoperability• Two implementations of systems or components from different manufacturers can co-

exist and work together by merely relying on each other’s services as specified by acommon standard.

Portability

Page 3: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

• An application developed for a distributed system A can be executed, withoutmodification, on a different distributed system B that implements the same interfacesas A

Flexibility• It should be easy to configure the system out of different components possibly from

different developers.• Easy to add new components or replace existing ones without affecting those

components that stay in place.Transparency:Is to hide the fact that its processes and resources are physically distributed across multiplecomputers → transparent access transparency : hiding differences in data representation and how a resource is accessed location transparency : users cannot tell where a resource is physically located in the system →“naming” migration transparency : resources can be moved without affecting how that resource can beaccessed relocation transparency : resources can be relocated while they are being accessed without theuser or application noticing anything replication transparency : resources may be replicated to increase availability or to improveperformance by placing a copy close to the place where it is accessed. All replicas have the samename and support location transparency. concurrency transparency : hide that a resource may be shared by several competitive users.

– Issue: concurrent access to a shared resource leaves that resource in a consistent state• Consistency can be achieved through locking mechanisms

failure transparent : a user does not notice that a resource fails to work properly, and that thesystem subsequently recovers from that failure

– Difficulty in masking failures lies in the inability to distinguish between a deadresource and a painfully slow resource.

persistence transparency : masking whether a resource is in volatile memory or perhapssomewhere on a disk

– In object-oriented databases user is unaware that the server is moving state betweenprimary and secondary memory

Scalability:Scalability can be measured in 3 different dimensions① Size : can easily add more users and resources to the system② Geographically scalable system : the users and resources may lie for apart③ Administratively scalable : it can be easy to manage even if it spans many independent

administrative organizations.Scaling Techniques:① Hiding communication latencies② Distribution③ Replication

2.b) Explain in detail about Persistence and synchronicity in communication. -6MarksAns: -Relevant explanation for points and figures should be givenmarks

Explanation carries 3M figures carries 3MPersistent communication: 2M for theory 1M for figures

Page 4: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

Persistent messages are stored as long as necessary by the communication system (e.g., e-mail)Persistent communication of letters back in the days of the Pony Express.

Transient communication: 2M for theory 1M for figuresTransient messages are discarded when they cannot be delivered (e.g., TCP/IP)SynchronicitySynchronicity can be the way of communication in between systems. It can be categorized as-

Synchronous Asynchronous

Synchronous vs. Asynchronous Asynchronous implies sender proceeds as soon as it sends the message no blocking Synchronous implies sender blocks till the receiving host buffers the message

In distributed system communications different combinations of messaging mechanisms can be usedbased on persistence and synchronicity.Persistent asynchronous communication vs Persistent synchronous communication :

a) Persistent asynchronous communicationb) Persistent synchronous communication

Transient asynchronous communication vs Transient synchronous communication :

c) Transient asynchronous communicationd) Receipt-based transient synchronous communication

Page 5: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

3. a) Explain about RPC mechanism. 6MarksAns: -Relevant explanation for the below points and figures should begiven

- Explanation carries 4M figures carries 2MRemote procedure call:Basic idea of remote procedure call is to execute a procedure at a remote site and ship the resultsback.Example: read(fd,buf,nbytes)

Steps of a Remote Procedure Call:

1. Client procedure calls client stub in normal way2. Client stub builds message, calls local OS3. Client's OS sends message to remote OS4. Remote OS gives message to server stub5. Server stub unpacks parameters, calls server6. Server does work, returns result to the stub7. Server stub packs it in message, calls local OS8. Server's OS sends message to client's OS9. Client's OS gives message to client stub10. Stub unpacks result, returns to client

Passing Value ParametersIn a large distributed system, multiple machine types are present Each machine has its ownrepresentation for number, characters, and others data items.

Page 6: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

a) Original message on the Pentium (little-endian)b) The message after receipt on the SPARC (big-endian )c) The message after being inverted. The little numbers in boxes indicate the address of each

byte

Caller and callee agree on the format of message they exchangeEx: word = 4 bytes

float = 1 wordcharacter is the rightmost byte of word

=> the client stub must use this format and the server stub know that incoming message for foobarhas this format

3.b) Explain about Message oriented transient and persistent communication. 6MAns: - Relevant explanation for the below points and figures should be given

Explanation carries 3M figures carries 3MMessage-Orient Transient Communication: 2M for theory 1M for figures

• Message-Oriented Model– Many distributed systems and applications are built on top of the simple message-

oriented model– These models are offered by Transport Layer– Message-oriented models

• Berkeley Sockets: Socket interface as introduced in Berkeley UNIX• The Message-Passing Interface(MPI): designed for parallel applications and as

such in tailored to transient communicationBerkeley Sockets

– Meaning of Socket: a communication endpoint to which an application can writedata (be sent to network) and read incoming data

– The socket primitives for TCP/IP

Page 7: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

Primitive Meaning

Socket Create a new communicationendpointBind Attach a local address to a socket

Listen Announce willingness to acceptconnectionsAccept Block caller until a connectionrequest arrivesConnect Actively attempt to establish aconnectionSend Send some data over the connection

Receive Receive some data over theconnectionClose Release the connection

Connection-oriented communication pattern using sockets

Sockets considered insufficient because: Support only send and receive primitives Designed for communication using general-purpose protocol such as TCP/IP.

The Message-Passing Interface(MPI)

Designed for multiprocessor machines and high-performance parallel programming Provides a high-level of abstraction than sockets Support diverse forms of buffering and synchronization (over 100 functions)

Some of the most intuitive message-passing primitives of MPI

Primitive Meaning

MPI_bsend Append outgoing message to a local send buffer

MPI_send Send a message and wait until copied to local or remotebuffer

MPI_ssend Send a message and wait until receipt starts

MPI_sendrecv Send a message and wait for reply

MPI_isend Pass reference to outgoing message, and continue

MPI_issend Pass reference to outgoing message, and wait until receiptstarts

MPI_recv Receive a message; block if there are none

Page 8: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

MPI_irecv Check if there is an incoming message, but do not block

Message-Orient Persistent Communication 2M for theory 1M for figuresMessage-Queuing Model

– Apps communicate by inserting messages in specific queues– Support for:

• Persistent asynchronous communication• Longer message transfers(e.g., e-mail systems)

– Basic interface to a queue in a message-queuing system:

Primitive Meaning

Put Append a message to a specified queue

Get Block until the specified queue is nonempty, andremove the first message

Poll Check a specified queue for messages, and removethe first. Never block

Notify Install a handler to be called when a message isput into the specified queue

Four combinations for loosely-coupled communication using queues:

General architecture of a Message-Queuing System– Messages can only be put and received from local queues– Ensure transmitting the messages between the source queues and destination queues,

meanwhile storing the messages as long as necessary– Each queue is maintained by a queue manager.

Page 9: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

Queue managers are not only responsible for directly interacting with applications but are alsoresponsible for acting as relays (or routers)

General–purpose of a Message-Queuing System– Enable persistent communication between processes– Handling access to database– In wide range of application, include:

• Email• Groupware• Batch processing

UNIT II4. a) Explain in detail about Locating Mobile entities. 6MarksAns:

Entities are named for lookup and subsequent access. They are named or can be identifiedusing Human-friendly Names, identifiers and addresses. Virtually all naming systems maintainmapping from Human-friendly names to addresses.

Location services are solely aimed at providing the addresses of the current locations ofentities. Entities are mobile, so that their current address may change frequently. Naming services areaimed at providing the content of nodes in a name space, given a (compound) name. Content consistsof different (attribute, value) pairs. Node contents at global and administrational level is relativelystable for scalability reasons.

Possible solutions for locating mobile entities are• Broadcasting and multicasting 1M for theory 1M for figures• Forwarding Pointers• Home based approach 1M for theory 1M for figures• Hierarchical approach• Pointer caches 1M for theory 1M for figures

Broadcasting and multicastingBoth broadcasting and multicasting can be solutions to locate mobile entities. Here we

broadcast and multicast the identifier of the entity to get the address.• A location service accepts an identifier as input and returns the current address of the

identified entity.• Simple solutions exist to work in local area network.

Page 10: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

• Address Resolution Protocol (ARP) to map the IP address of a machine to its data-linkaddress, which uses broadcasting.

• Multicasting can be used to locate entities in point-to-point networks (such as the Internet).• Each multicasting address can be associated with multiple replicated entities.

Forwarding PointersKey idea:

Whenever an object moves from address space A to B, it leaves behind a proxy in its place in Aand installs a skeleton that refers to it in B.How does forwarding pointer work?

• Each forwarding pointer is implemented as a (proxy, skeleton) pair.• A skeleton contains either a local reference to the actual object or a local reference to a proxy

for that object.• Skeletons act as entry items for remote references, and proxies as exit items.

Home-Based ApproachesLet a home keep track of where the entity is:

• An entity’s home address is registered at a naming service.• The home registers the foreign address of the entity.• Clients always contact the home first, and then continues with the foreign location.

Page 11: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

Hierarchical Approaches

Hierarchical organization of a location service into domains, each having anassociated directory node.

Leaf domain: a lowest-level domain, corresponds to a local-network in a computernetwork or a cell in a mobile telephone network.

Location record: keep track of the whereabouts of an entity

Solution for locating entity using hierarchical approach

Pointer CachesStore lookup results in local caches can be highly effective in locating mobile entities.Steps:

Page 12: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

o Requires inspecting the local pointer cache, leading directly to the appropriatedirectory node.

o Involves requesting that node to return the current address of E.

4. b) What are unreferenced entities? How are they removed? 6MAns: 4M for explanation and two marks for figuresGarbage:

An entity can no longer be accessed should be removed. We consider this entity as garbage.Unreferenced Entities 1M for explanation

An object can be accessed only if there is a remote reference to it. An object for which no remote reference exists should be removed from the system. On the other hand, having a remote reference to an object does not mean that the object

will ever be accessed.

Note: Methods explanation carries 3MReference Counting

• A method to check whether an object can be deleted• Simply count the references to that object• As soon as the counter reaches zero, the object can be removed.

Problem:• Falsely increment.

Page 13: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

• Increment the counter too late.When a process P create a reference to a remote object O, it installs a proxy p for O in its addressspace.Falsely increment

Increment the counter too lateOccurs when copying a remote reference to another process.

Reference Listing

skeleton maintains a list of all proxies that point to it Property: Adding or removing proxies has no effect. Advantage:

• Does not require communication to be reliable• It is not necessary that duplicate messages can be detected and discarded• It is easier to keep the reference list consistent in the face of process failures

Drawback:• Scale badly if the skeleton needs to keep track of many reference.

Identifying Unreachable Entities

Problem: Entities may store reference to each other But none of these entities can be reached from the root set

General solution: All entities in a distributed system are traced. This is done by Checking which entities can be reached from the root set and

subsequently removing all others

Page 14: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

Solution:Mark-and-sweep

Mark Entities are traced by following chains of references originating from entities in

the root set.

Each entity that can be reached in this way is marked. Sweep

Examining memory to locate entities that have not been marked.

Such entities are considered garbage that is to be removed.

Garbage collection take place within groups through a combination of mark-and-sweep and referencecounting.5. a) Explain the concept of threads. 6MAns: Relevant explanation of points given marksThread Theory 4Marks figures 2Marks

Similar to process, a thread can be seen as the execution of (part) program on a processor. To reduce the overhead of process switching between CPU bound and I/O bound processes,

Threads were introduced Threads are within a single process space(address space), they are not protected with each

other.

Developers have to make sure about thread boundary and process space. Threads share the same address space. Thread context switching can be done entirely

independent of the operating system.

Creating and destroying threads is much cheaper than doing so for processes. While a thread executes a system call, all other peer threads may continue their execution.

(Performance)

There are two views of threads User-Level Vs. Kernel LevelUser Level threads

• Have nothing to do with the kernel, so all operations can be completely handled within asingle process.

• All services provided by the kernel are done on behalf of the process in which a threadresides => if the kernel decides to block a thread, the entire process will be blocked. Requiresmessy solutions.

Page 15: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

• In practice, we want to use threads when there are lots of external events: threads block on aper-event basis => if the kernel cannot distinguish threads, how can it support signalingevents to them?

Kernel Level threads• Operations that block a thread are no longer a problem: the kernel schedules another available

thread within the same process.• Handling external events is simple: the kernel (which catches all events) schedules the thread

associated with the event.• The big problem is the loss of efficiency due to the fact that each thread operation requires a

trap to the kernel.To solve the problem try to mix user-level and kernel-level threads into a single concept. Basic

idea is to introduce a two-level threading approach.Lightweight processes (LWP) that can execute user-level threads.

When a user-level thread does a system call, the LWP that is executing that thread, blocks.The thread remains bound to the LWP. The kernel can simply schedule another LWP having arunnable thread bound to it. Note that this thread can switch to any other runnable thread currently inuser space. When a thread calls a blocking user-level operation, we can simply do a context switch toa runnable thread, which is then bound to the same LWP. When there are no threads to schedule, anLWP may remain idle, and may even be removed (destroyed) by the kernel.

Threads in Distributed systems

Multi-threaded clients: Main issue is hiding network latencyMulti-threaded Web client:

• Web browser scans an incoming HTML page, and finds that more files need to be fetched• Each file is fetched by a separate thread, each doing a (blocking) HTTP request• As files come in, the browser displays them

Multiple RPCs:• A client does several RPCs at the same time, each one by a different thread• It then waits until all results have been returned• Note: if RPCs are to different servers, we may have a linear speed-up compared to doing

RPCs one after the other

Page 16: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

5. b) What is namespace and namespace resolution? explain the implementation of namespace.Ans: Explanation of below points should be given marksName : a string of bits or characters =>refer to an entity Theory 4M Figures 2M

• Address• name of an access point

• Identifiers• identifier is a name that has the following properties:• An identifier refers to at most one entity.• Each entity is referred to by at most one identifier.• An identifier always refers to the same entity.

• Human-friendly name• Used by human

Name spaces• Names are organized into name space

How is name space represented? leaf node

• represents a named entity• has no outgoing edges.

directory node• has a number of outgoing edges• each outgoing edges labeled with a name

A general naming graph with a single root node.

Implementation of Name Space

Page 17: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

• Assumptions– No replication of name servers– No client side caching– Each client has access to a local name server

• Two possible implementations– Iterative Name Resolution

• Server will resolve the path name as far as it can, and return each intermediateresult to the client

– Recursive Name Resolution• A name server passes the result to the next name server found by it

Name Resolution• process of looking up a name

How does name resolution work?Example :

Pathname : N:<label-1,label-2,…,label-n>Label-1 : return the identifier of the nodeLabel-n : return the content of that node

To resolve a name we need a directory (initial) node. How do we actually find that initial node?Closure mechanism: The mechanism to select the implicit context from which to start nameresolution:

There are two ways to implement Name resolution• Iterative Name resolution• Recursive Name Resolution

Iterative name resolutionServer will resolve the path name as far as it can, and return each intermediate result to the client.

Recursive name resolutionA name server passes the result to the next name server which found by it.

Drawback:put a higher performance demand on each name server

Advantage:

Page 18: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

• Caching results is more effective compared to iterative• Communication costs may be reduced.

UNIT III

6. a) What are client centric consistency models? 6MAns:In Client centric consistency models the emphasis is more on maintaining a consistent view of thingsfor the individual client process that is currently operating on the data-store.How fast should updates (writes) be made available to read-onlyprocesses?

• Think of most database systems: mainly read.• Think of the DNS: write-write conflicts do no occur.• Think of WWW: as with DNS, except that heavy use of client-side caching is present: even

the return of stale pages is acceptable to most users.• These systems all exhibit a high degree of acceptable inconsistency … with the replicas

gradually become consistent over time.Eventual consistency

• The only requirement is that all replicas will eventually be the same.• All updates must be guaranteed to propagate to all replicas … eventually!• This works well if every client always updates the same replica.• Things are a little difficult if the clients are mobile.

Four models in client-centric consistency:– Monotonic Read Consistency 3M for theory and figures– Monotonic Write Consistency– Read-your-writes Consistency 3M for theory and figures– Writes-follows-reads Consistency

These are the notations used in explanation of models• xi[t] -version of data x at copy Li at time t• xi[t] is result of a set of write operations applied to x since initialization• this set is notated as WS(xi[t])• When these operations later (t2) are performed to x at copy Lj ,it is written as WS(xi[t1];

xj[t2])Monotonic Reads

Page 19: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

If a process reads the value of a data item x, any successive read operations on x by that process willalways return that same value or a more recent value.

a) A monotonic-read consistent data storeb) A data store that does not provide monotonic reads

Monotonic WritesA write operation by a process on a data item x is completed before any successive write operationon x by the same process.

a) A monotonic-write consistent data store.b) A data store that does not provide monotonic-write consistency.Read your writesThe effect of a write operation by a process on data item x will always be seen a successive readoperation on x by the same process.

a) A data store that provides read-your-writes consistency.b) A data store that does not.

Writes Follow ReadsA write operation by a process on a data item x following a previous readoperation on x by the same process, it is guaranteed to take place on the same or a more recent valueof x that was read.

a) A writes-follow-reads consistent data storeb) A data store that does not provide writes-follow-reads consistency

6.b) Write short notes on distributed mutual exclusion. 6MAns:

Page 20: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

A mutual exclusion (mutex) is a program object that prevents simultaneous access to a sharedresource. This concept is used in concurrent programming with a critical section, a piece of code inwhich processes or threads access a shared resource.

To achieve this there are three algorithms are proposed:• Centralized Algorithm 2M for explanation using figures• Distributed Algorithm 2M for explanation using figures• Token Ring Algorithm 2M for explanation using figures

Centralized Algorithm

a) Process 1 asks the coordinator for permission to enter a critical region. Permission is grantedb) Process 2 then asks permission to enter the same critical region. The coordinator does not

replyc) When process 1 exits the critical region, it tells the coordinator, when then replies to 2

Distributed Algorithm

a) Two processes want to enter the same critical region at the same momentb) Process 0 has the lowest timestamp, so it winsc) When process 0 is done, it sends an OK also, so 2 can now enter the critical region

Token ring algorithm

• An unordered group of processes on a network.• A logical ring constructed in software.• Process must have token to enter.

Page 21: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

• If don’t want to enter, pass token along.• If host down, recover ring. If token lost, regenerate token. If in critical section long

7. a) Explain about logical clocks. 4MAns: Explanation on below points can be given marks

For many applications, the relative ordering of events is more important than actual physicaltime. In a single process the ordering of events (e.g., state changes) is trivial. In a distributed system,however, besides local ordering of events, all processes must also agree on ordering of causallyrelated events (e.g., sending and receiving of a single message).

• A logical clock is a– Monotonically increasing SW counters (COULOURIS)– Clocks on different computers that are somehow consistent (LAMPORT)

• Potential Requirements for logical clocks:– Timestamps : C(a), C(b)– If a happens before b in the same process, C(a) < C(b).

• a b => C(a) < C(b)– If a and b represent the sending and receiving of a message, respectively, C(a) < C(b).– For all distinctive events a and b, C(a) ≠ C(b).

• Two methods for assigning logical timestampso Lamport’s Timestampso Vector Timestamps

7.b) Explain about distribution and consistency protocols. 8MAns:

Distribution Protocols Three Distribution Protocols:

Replica Placement 1M for theory and figures Update Propagation 1M for theory and figures Epidemic Protocols 1M for theory and figures

Replica Placement

The logical organization of different kinds of copies of a data store into three concentric rings. Permanent Replicas

The initial set of replicas Constitute a distributed data store

Server-Initiated Replicas Copies of a data store

Page 22: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

Exist to enhance performance Created at the initiative of the data store

Client-Initiated Replicas Created at the initiative of clients Commonly known as client caches

Update Propagation Introduction:

Update Propagation generally initiated at a client Subsequently forwarded to one of the copies

Three design issues: State Vs. Operations

What is actually to be propagated Pull Vs. Push Protocols

Whether updates are pulled or pushed Unicasting Vs. Multicasting

Whether unicasting or multicasting should be used.Epidemic Protocols

Introduction: Update propagation in eventual-consistent data stores is often implemented by a class

of algorithms known as Epidemic Protocols. Don’t solve any update conflicts Only concern is propagating updates to all replicas in as few messages as possible.

Update Propagation Models (Example: anti-entropy) P only pushes its own updates to Q P only pulls in new updates from Q P and Q send updates to each other

Consistency Protocols Consistency protocol

Describe implementations of specific consistency models Models: sequential consistency, weak consistency with synchronization

variables, and atomic consistency Two Protocols:

Primary-Based Protocols 2 M for theory & 2M for figures Remote-Write Protocols & Local-Write Protocols

Replicated-Write Protocols 1M for theory and figure Active Replication

Primary-Based ProtocolsPrimary based Remote write protocols

Page 23: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

Primary-based remote-write protocol with a fixed server to which all read and write operations areforwarded.

The principle of primary-backup protocol.Primary based Local-Write Protocols

Primary-based local-write protocol in which a single copy is migrated between processes.

Page 24: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

Primary-backup protocol in which the primary migrates to the process wanting to perform an update.Replicated-Write ProtocolsActive Replication

a) Forwarding an invocation request from a replicated object.b) Returning a reply to a replicated object.

UNIT IV8. a)What is meant by recovery? Explain Reliable client server communication. 8MAns:Recovery 1M

The term recovery refers to the process of restoring a (failed) system to a normal state ofoperation. Recovery can apply to the complete system (involving rebooting a failed computer) or to aparticular application (involving restarting of failed process(es)).Reliable Client Server communication 2M

Besides processes the other part of a distributed system that can fail is the communicationchannel. Masking failure of the communication channel leads to reliable communication.Reliable Point-to-Point Communication

Reliable point-to-point communication is generally provided by reliable protocols such asTCP/IP.TCP/IP masks omission failures but not crash failures. When communication is not reliable,and in the presence of crash failures, it is useful to define failure semantics for communication

Page 25: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

protocols. An example is the semantics of RPC in the presence of failures. There are five differentclasses of failures that can occur in an RPC system.

• Client cannot locate server• Request message to server is lost• Server crashes after receiving a request• Reply message from server is lost• Client crashes after sending a request

Reliable Group Communication 4M for theory 1M for figuresIn the first case the communication succeeds only when all nonfaulty group members receive

the messages. The difficult part is agreeing on who is a member of the group before sending themessage. In the second case it is simply a question of delivering the messages to all group members.

Figure 2 shows a basic approach to reliable multicasting assuming nonfaulty processes. In thisexample the sender assigns a sequence number to each message and stores sent messages in a historybuffer. Receivers keep track of the sequence number of the last messages they have seen. When areceiver successfully receives a message that it was expecting, it returns an acknowledgment to thesender. When a receiver receives a message that it was not expecting (e.g., because it was expectingan older message first) it informs the sender which messages it has not yet received. The sender canthen retransmit the messages to that particular receiver.

A problem with this approach is that if the group is large enough the sender must deal with alarge amount of acknowledgment messages, which is bad for scalability. This problem is known asfeedback implosion.

A simple solution to reliable multicasting when all receivers are known & are assumed not to faila) Message transmissionb) Reporting feedback

Nonhierarchical Feedback ControlIn the reporting feedback method there is a chance of feedback implosion in case of sending

negative feedback also so to avoid sending many number of NACK from different processes only oneprocess sends a negative message and the message can be multicast again to group of processes. Todo this each process will start a timer at random times with random counter. The process whosecounter finishes first will send the negative acknowledge to all the processes along with sender sothat remaining processes stop their transmission.

Page 26: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

Several receivers have scheduled a request for retransmission, but the first retransmission requestleads to the suppression of others.Hierarchical Feedback Control

The essence of hierarchical reliable multicasting:a) Each coordinator forwards the message to its children.b) A coordinator handles retransmission requests

8. b) What is Automounting? Explain. 4MAutomounting 3M for theory 1M for figure

To share files, we partly standardize local name spaces and mount shared directories.Mounting very large directories (e.g., all subdirectories in home/users) takes a lot of time.

To solve this problem auto mounting is used. On demand mounting of a remote file system ishandles in NFS by automounter, which runs as a separate process on the clients machine.

For example here in the client machine has a home directory that belongs to alice but theactual files of alice exist in a remote system.This directory can be automatically mounted when alicelogs into her workstation. This is done by the automounter.9. a)Explain CODA file system. 6M

Page 27: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

Ans: 4M theory and 2M for figuresCoda File System (CFS)

Coda has been developed in the group of M. Satyanarayanan at Carnegie MellonUniversity in 1990’s

Integrated with popular UNIX operating systems CFS main goal is to achieve high availability Advanced caching schemes Provide transparency

Architecture Clients cache entire files locally Cache coherence is maintained by the use of callbacks (inherit from AFS) Clients dynamically find files on server and cache location information Token-based authentication and end-to-end encryption is used.

Overall organization of Coda

The internal organization of a Virtue workstation Designed to allow access to files even if server is unavailable Uses VFS to intercepts calls from client application

Communication

Page 28: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

o Coda uses RPC2: a sophisticated reliable RPC system Start a new thread for each request, server periodically informs client it is still

working on the requesto RPC2 supports side-effects: application-specific protocols

Useful for video streamingo RPC2 also has multicast support

Processes Coda maintains distinction between client and server processes Client – Venus processes Server – Vice processes Threads are nonpreemptive and operate entirely in user space Low-level thread handles I/O operations

Naming

Clients have access to a single shared name space.Notice Client A and Client B!Synchronization

File open: transfer entire file to client machine Uses session semantics: each session is like a transaction Updates are sent back to the server only when the file is closed

Caching Caching:

Achieve scalability Increases fault tolerance

How to maintain data consistency in a distributed system? Use callbacks to notify clients when a file changes If a client modifies a copy, server sends a callback break to all clients maintaining

copies of same file.Server Replication

Unit of replication: volume Volume Storage Group (VSG): set of servers that have a copy of a volume

Page 29: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

Accessible Volume Storage Group (AVSG): set of servers in VSG that the client cancontact

Use vector versioning One entry for each server in VSG When file updated, corresponding version in AVSG is updated

9. b) Explain NFS architecture and implementation.Ans: 4M theory and 2M for figuresNFS ArchitectureNFS (Network File System) allows hosts to mount partitions on a remote system and use them asthough they are local file systems. This allows the system administrator to store resources in a centrallocation on the network, providing authorized users continuous access to them.

Three versions of NFS are currently in use:o NFSv2o NFSv3o NFSv4

Basic NFS Architecture

Virtual File System (VFS) acts as an interface between the operating system’s systemcall layer and all file systems on a node.

The user interface to NFS is the same as the interface to local file systems. The callsgo to the VFS layer, which passes them either to a local file system or to the NFSclient

VFS is used today on virtually all operating systems as the interface to different localand distributed file systems.

NFS Client/Server Communication The NFS client communicates with the server using RPCs

File system operations are implemented as remote procedure calls At the server: an RPC server stub receives the request, “un-marshalls” the parameters

& passes them to the NFS server, which creates a request to the server’s VFS layer. The VFS layer performs the operation on the local file system and the results are

passed back to the client.Server-side Implementation

• NFS defines a virtual file system– Does not actually manage local disk layout on server

• Server instantiates NFS volume on top of local file system– Local hard drives managed by concrete file systems (EXT, ReiserFS, ...)

Page 30: IV/IV B. Tech (Regular/Supply) Degree Examination ... · a) D efine Distributed System. Ans: A Distributed system is a collection of independent computers that appears to its users

• Assuming a Unix-style scenario in which one machine requires access to data stored onanother machine:

– The server implements NFS daemon processes in order to make its data genericallyavailable to clients.

– The server administrator determines what to make available, exporting the names andparameters of directories.

– The server security-administration ensures that it can recognize and approve validatedclients.

– The server network configuration ensures that appropriate clients can negotiate with itthrough any firewall system.

– The client machine requests access to exported data, typically by issuing a mountcommand.

– If all goes well, users on the client machine can then view and interact with mountedfilesystems on the server within the parameters permitted.