distributed os

4
1sol:- a) The lamport time stamp of the given processes are as follows:- P1 P2 P3 a=1 f=3 i=4 b=2 g=4 j=5 c=3 d=5 e=6 b) Vector time stamp are as follows:- P1 P2 P3 a=(1,0,0) f=(2,1,0) i=(3,0,0) b=(2,0,0) g=(2,2,0) j=(3,0,1) c=(3,0,0) d=(3,2,0) e=(5,2,2) c) For the events dependent on c look at the first varible in vector and if its greater than 3 then the event is depedent on c else not. If we observe the vector time stamps d,e,i,j are dependent on c. Thus the events dependent on c are d,e,i,j. 2solution:- Previously process 6 was coordinator but it has crashed, process 3 identifie it and sends a election message to all the processes higher than it, namely 4,5,6 as shown process 4,5 both respond ok, upon getting the responses, 4 takes over and becomes coordinator and send the coordinator message to all running processes . if process 6 restarted it will just send coordinated message and then bully them into submission.

Upload: vishwakiran

Post on 01-Oct-2015

212 views

Category:

Documents


0 download

DESCRIPTION

Some questions

TRANSCRIPT

  • 1sol:-

    a) The lamport time stamp of the given processes are as follows:-

    P1 P2 P3

    a=1 f=3 i=4

    b=2 g=4 j=5

    c=3

    d=5

    e=6

    b) Vector time stamp are as follows:-

    P1 P2 P3

    a=(1,0,0) f=(2,1,0) i=(3,0,0)

    b=(2,0,0) g=(2,2,0) j=(3,0,1)

    c=(3,0,0)

    d=(3,2,0)

    e=(5,2,2)

    c) For the events dependent on c look at the first varible in vector and if its greater than 3 then the

    event is depedent on c else not. If we observe the vector time stamps d,e,i,j are dependent on c.

    Thus the events dependent on c are

    d,e,i,j.

    2solution:-

    Previously process 6 was coordinator but it has crashed, process 3 identifie it and sends a

    election message to all the processes higher than it, namely 4,5,6 as shown process 4,5 both respond

    ok, upon getting the responses, 4 takes over and becomes coordinator and send the coordinator

    message to all running processes . if process 6 restarted it will just send coordinated message and

    then bully them into submission.

  • 3sol:-

    Network traffic

    blogging is the major

    problem related to client

    server model. As

    number of client request

    increase the server

    becomes overheaded.

    If a server fail whole network fails in client server system

    Thus , in peer to peer every client acts as server reducing the server overload. If any one peer

    fails network will not fail. And no need of full time admisnistration as every machine can control their

    shared resourses.

    4sol:-

    It really depends on how the client is organized. It may be possible to

    divide the client-side code into smaller parts that can run separately. In that

    case, when one part is waiting for the server to respond, we can schedule

    another part. Alternatively, we may be able to rearrange the client so that it can

    do other work after having sent a request to the server. This last solution effec-

    tively replaces the synchronous client-server communication with asyn-

    chronous one-way communication.

    5 sol:-

    A system is said to be k-fault tolerant if it can survive faults in k componenets and still meet

    its specifications.

    a) for aggrement:-

    n-k>3/4*k

    which gives that 4n>7k

    and minimum n value is n=3k+1

    b) for majority election:-

    n-k>=k+1

    n>=2k+1

    thus n=2k+1

    6sol:-

    Basic idea is that only one processor handles the shared resources which is known as critical

    section.Only one process can attain critical section thus it attains mutual exclusion.

    How token is passes:-

    A completely different approach to achieving mutual exclusion in a distributed system. Here

    we have a bus network (for e.g. ethernet).

  • A logical ring is constructed in which each process is assigned a position in the ring. The ring

    positions may be allocated in numerical order of network addresses or some other means. It does

    not matter what the ordering is.

    All that matters is that each process knows who is next in line after itself.

    When the ring is initialized, process A (say) is given a token. The token circulates around the ring. It

    is passed 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 is attempting to enter a CS.

    If so, the process enters the CS, does all the work it needs to, and leaves the section.

    After it has exited, it passes the token along the ring. It is not permitted to enter a second CS using

    the same token.

    If a process is handed the token by its neighbor and is not interested in entering a CS, it just passes it

    along.

    As a consequence, when no processes want to enter any CS, the token just circulates at high speed

    around the ring.

    Messages taken:-

    using ricart agarwala token ring algorithm number of messages exchanged for a

    process to enter critical sectoi are 1 to infinite and delay taken by a processor to enter CS is 0 to n-1.

    using ricart agarwala non-token ring algorithm number of messages exchanged for a process to enter

    critical sectoi are 3 to 2n-1.

    7sol:-

    Disadvantages of ring based algorithm:-

    1) If any token is lost ot must be regenerated

    2)A token circulated even in absence of any request (unnecessary traffic)

    3) Long path (O(n)) :- the waiting time for a token to arrive may be high.

    8sol:-

    The map reduce scheduler can arrange for maptask to execute on same node that stores

    data, avoiding copy across the network.

    9sol:-

    P

    0P

    1P

    2

    m

    0 m

    1

    m

    2

    m

    3 m

    4

    m

    5

    m

    7 m

    6

    Recovery Line

  • Each process periodically saves its state on stable storage.

    The saved state contains sufficient information to restart process execution.

    A consistent global checkpoint is a set of N local checkpoints, one from each process, forming a

    consistent system state.

    Any consistent global checkpoint can be used to restart process execution upon a failure.

    The most recent consistent global checkpoint is termed as the recovery line.

    In the uncoordinated checkpointing paradigm, the search for a consistent state might lead to

    domino effect.

    Recovery:-

    Step 1: Include last checkpoint of each failed process as an element in set RootSet;

    Step 2: Include current state of each surviving process as an element in RootSet;

    While(at least one member of RootSet is marked)

    Replace each marked element in RootSet by the last unmarked checkpoint of the same process;

    Mark all checkpoints reachable by following at least one edge from any member of RootSet

    End While

    RootSet is the recovery line.

    10sol:- Orphan process:-

    An orphan process is a computer process whose parent process has finished or

    terminated, though it remains running itself.

    Extermination is the most commonly used technique; in this case the orphan is killed.

    Solutions to avoid orphan processes:-

    1. Extermination is the most commonly used technique; in this case the orphan is killed.

    2. Reincarnation is a technique in which machines periodically try to locate the parents of any

    remote computations; at which point orphaned processes are killed.

    3. Expiration is a technique where each process is allotted a certain amount of time to finish

    before being killed. If need be a process may "ask" for more time to finish before the allotted

    time expires.