Tuesday 12 May 2015

Distributed systems in glance

1) distributed system:

To understand DC one should understand Multiprocessors system.

Multiprocessor:

Machine with multiple processors.

Multipleprocessor can designed in two ways.

1) Loosely coupled   2) Tightly coupled

1) Loosely coupled= Collection of machines connected through network.

[Processor + Memory] ----network-----[Processor + Memory]

-Each processor has its own memory and clock.
-No Global memory nor clock

2) Tightly Coupled:

[Processor 1 + processor  2 +..........+ Process n]--------Sharing Single--- [Memory]

-Shared Memory
-Shared clock


Definition: Distributed system/Distriubted Computing are actually Loosely coupled machines


Design challenges of DC


1)Scalability: Adding new MACHINE to existing infrstructure.

Then users will feel heat, as burder on other users will increase.

how to avoid?

- asychronous transfer: Do not rely for response.
- Moving part of computation: Client side validation is best example. Which will move part of computation from serverto client
and reduce the burden on server.
- Distribution: By means of DNS. Like .COM, .GOVT,.IN. This will allow user to reduce burden on single server and
seggregate the process task as per requirement.

2) Lack of global knowledge:

- DC has local memory and local clock, no global clock nor memory. Hence this leads overall infrastruce knowledge gap.
 One machine memory does not knew the other machine tasking/processing/scheduling. as DC designer we have to address this.
3)Naming:
4)Compatability:
5)Process Sync
6)Resource Management
7)Security

Communication Primitives:

1) Synchrounous (Handshake b/w sender and reciever)
2) Asynchronous
3) Blocking (Send + recieve=without minimum response, i cannot proceed with other activity)
4) Non blocking

Logical CLOCKS: Since, There is no shared clock for all processing unit, Logical clock concept comes into picture.


a) Scalar time b) Vector time

CASUALITY?

Casuality can be defined based on inter-dependent events. If one Event in DC is dependent on other Event then this can be
termed as CASUALITY of one event with other. ( Cause and affect)

- Hence logical clock is associated with event.
- If there is a event1 with send message and other event 2 recieving same message then Clock time for e1(T)<e2(T)

SCALAR CLOCK


Lamport tried ordering events in a distributed system using two rules.
Rule1:
------
Before executing an event (send, receive, or internal),
process pi executes the following:
Ci:= Ci + d (d > 0)
In general, every time R1 is executed, d can have a
different value; however, typically d is kept at 1.

Rule2:
------
R2: Each message piggybacks the clock value of its
sender at sending time. When a process pi
receives a
message with timestamp Cmsg , it executes the following
actions:
 Ci:= max(Ci , Cmsg )
 Execute Rule1.
 Deliver the message.


VECTOR CLOCK:


P1(0,0)-----E1 P1(1,0) -----E3----
       
             P1 SENDS MESSAGE P2 at point E1

P2(0,0)---------- E2 P1(1,1) ------

While sending message, Sender node value will be compared with recipient node value. Max(sender,recipient)=(P1,P2)

then add "d" to reciepient node i.e (p1,p2+1)

Vector comparison:


P1(1,2,0)
P2(2,3,1)

P1--->P2(P1happens before p2)

P1(1,6,5)
P2(1,4,7)

P1||P2 are concurrent events


CASUAL ORDERING VIOLATION


Assume P1 sending message M1.
Assume P2 receiving message M1.
Assume p1 sending message M2 which is being recieved by P2 before arrival of M1.

We have algorithms which fixes the Causal order violation.