8/17/2019 scalar+ vector + matrix clock- done
1/22
CS4231CS4231
Parallel and Distributed AlgorithmsParallel and Distributed Al
gorithms
AY 2006/2007 Semester 2 AY 2006/2007 Semester 2
Leture 4
!nstrutor" #ai$eng Y%
8/17/2019 scalar+ vector + matrix clock- done
2/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 2
&e'ie( o$ Last Leture&e'ie( o$ Last Leture
8/17/2019 scalar+ vector + matrix clock- done
3/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 3
)oda*+s &oadma,)oda
*+s &oadma,
Cha,ter 7 -.odels and Clos oal" De$ine -time in a distributed s*stem
Logial lo
etor lo
.atri lo
8/17/2019 scalar+ vector + matrix clock- done
4/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 4
Assum,tions Assum
,tions
Proess an ,er$orm three inds o$ atomi ations/e'ents Loal om,utation
Send a single message to a single ,roess
&eei'e a single message $rom a single ,roess
o atomi broadast
Communiation model
Point5to5,oint
rror5$ree in$inite bu$$er
Potentiall* out o$ order
8/17/2019 scalar+ vector + matrix clock- done
5/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 5
.oti'ation.oti'ation .an* ,rotools need to im,ose an ordering among e'ents
!$ t(o ,la*ers o,en the same treasure hest -almost at the sametime (ho should get the treasure8
Ph*sial los"
Seems to om,letel* sol'e the ,roblem
9ut (hat about theor* o$ relati'it*8
'en (ithout theor* o$ relati'it* : e$$iien* ,roblems
#o( aurate is su$$iient8
;ithout out5o$5band ommuniation" .inimum message,ro,agation dela*
;ith out5o$5band ommuniation" distane/s,eed o$ light
!n other (ords some time it has to be -
8/17/2019 scalar+ vector + matrix clock- done
6/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 6
So$t(are -ClosSo$t(are -Clos
So$t(are -los an inur muh lo(er o'erhead than maintaining=su$$iientl* aurate> ,h*sial los
Allo(s a ,rotool to in$er ordering among e'ents
oal o$ so$t(are -los" Ca,ture e'ent ordering that are 'isible to users 9ut (hat orderings are 'isible to users (ithout ,h*sial los8
8/17/2019 scalar+ vector + matrix clock- done
7/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 7
isible ?rdering to %sersisible ?rdering to %sers
A→ 9 =,roess order>
9→ C =send5reei'e order>
A→ C =transiti'it*>
user1 =,roess1>
user2 =,roess2>
user3 =,roess3>
A 9
C
D
A 8 D
9 8 D
C 8 D
8/17/2019 scalar+ vector + matrix clock- done
8/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 8
--#a,,ened59e$ore &elation#a,,ened59e$ore &elation
-#a,,ened5be$ore relation a,tures the ordering thatis 'isible to users (hen there is no ,h*sial lo
A ,artial order among e'ents
Proess5order send5reei'e order transiti'it*
@irst introdued b* Lam,ort : Considered to be the
$irst $undamental result in distributed om,uting
oal o$ so$t(are -lo is to a,ture the abo'e-ha,,ened5be$ore relation
8/17/2019 scalar+ vector + matrix clock- done
9/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 9
So$t(are -Clo 1" Logial ClosSo$t(are -Clo 1" Logial Clos ah e'ent has a single integer as its logial lo 'alue
ah ,roess has a loal ounter C !nrement C at eah -loal om,utation and -send e'ent
;hen sending a message logial lo 'alue is attahed to
the message At eah -reei'e e'ent C B ma=C > 1
user1 =,roess1>
user2 =,roess2>
user3 =,roess3>
1 2 3 4
1
3 B ma=12>1
4
1 2
3
4 B ma=33>1
8/17/2019 scalar+ vector + matrix clock- done
10/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 10
Logial Clo Pro,ertiesLogial Clo Pro,erties
)heorem" 'ent s ha,,ens be$ore t
⇒
the logial lo 'alue o$ s is
smaller than the logial lo 'alue o$ t
)he re'erse ma* not be true
user1 =,roess1>
user2 =,roess2>
user3 =,roess3>
1 2 3 4
1 4
1 2
3
8/17/2019 scalar+ vector + matrix clock- done
11/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 11
So$t(are -Clo 2" etor ClosSo$t(are -Clo 2" etor Clos Logial lo"
'ent s ha,,ens be$ore e'ent t⇒
the logial lo 'alue o$ s
is smaller than the logial lo 'alue o$ t
etor lo"
'ent s ha,,ens be$ore e'ent t the 'etor lo 'alue o$ s
is -smaller than the 'etor lo 'alue o$ t
ah e'ent has a 'etor o$ n integers as its 'etor
lo 'alue
'1 B '2 i$ all n $ields same
'1 ≤ '2 i$ e'er* $ield in '1 is less than or e
8/17/2019 scalar+ vector + matrix clock- done
12/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 12
etor Clo Protooletor Clo Protool ah ,roess i has a loal 'etor C
!nrement CGiH at eah -loal om,utation and -send e'ent
;hen sending a message 'etor lo 'alue is attahed to
the message At eah -reei'e e'ent C B ,air(ise5ma=C >I
CGiHI
user1 =,roess1>
user2 =,roess2>
user3 =,roess3>
=100> =200> =300>
=002>
=022>=010>
=001>
=232>
=233>
C B =010> B =002>
,air(ise5ma=C > B =012>
8/17/2019 scalar+ vector + matrix clock- done
13/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 13
etor Clo Pro,ertiesetor Clo Pro,erties 'ent s ha,,ens be$ore t
⇒
'etor lo 'alue o$ s E 'etor lo 'alue o$ t"
)here must be a hain $rom s to t
'ent s ha,,ens be$ore t 'etor lo 'alue o$ s E 'etor lo 'alue o$ t
!$ s and t on same ,roess done
!$ s is on , and t is on
8/17/2019 scalar+ vector + matrix clock- done
14/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 14
am,le A,,liation o$ etor Cloam,le A,,liation o$ etor Clo
ah user has an order ,laed b* a ustomer ;ant all users to no( all orders
ah order has a 'etor lo 'alue
user1 =,roess1>
user2 =,roess2>
user3 =,roess3>
D1 =100> =200> =300>
=002>
=022>D2 =010>
D3 =001>
=232>
=233>
D1
D3 D1 D2 D3
! ha'e seen all orders (hose 'etor lo is smaller than
=232>"
! an a'oid linear searh $or eistene testing
8/17/2019 scalar+ vector + matrix clock- done
15/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 15
So$t(are -Clo 3" .atri ClosSo$t(are -Clo 3" .atri Clos
.oti'ation
.* 'etor lo desribe (hat ! -see
!n some a,,liations ! also (ant to no( (hat other ,eo,le see
.atri lo"
ah e'ent has n 'etor los one $or eah ,roess
)he i th 'etor on ,roess i is alled ,roess i +s ,rini,le 'etor
Prini,le 'etor is the same as 'etor lo be$ore
on5,rini,le 'etors are Just ,igg*baed on messages to u,date -no(ledge
8/17/2019 scalar+ vector + matrix clock- done
16/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 16
.atri Clo Protool.atri Clo Protool
@or ,rini,le 'etor C on ,roess i
!nrement CGiH at eah -loal om,utation and -send e'ent
;hen sending a message all n 'etors are attahed to the message
At eah -reei'e e'ent let be the ,rini,le 'etor o$ the sender C B ,air(ise5ma=C >I CGiH
I
@or non5,rini,le 'etor C on ,roess i su,,ose it orres,onds to ,roess J
At eah -reei'e e'ent let be the 'etor orres,onding to ,roess J as in the reei'ed
message C B ,air(ise5ma=C >
8/17/2019 scalar+ vector + matrix clock- done
17/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 17
.atri Clo am,le.atri Clo am,le
user1 =,roess1>
user2 =,roess2>
user3 =,roess3>
=100>
=000>
=000>
=000>
=010>
=000>
=000>
=000>
=001>
=200>
=000>
=000>
=300>
=000>
=000>
=000>
=000>
=002>
=000>
=022>
=002>
=200>
=232>
=002>
=200>=232>
=233>
8/17/2019 scalar+ vector + matrix clock- done
18/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 18
.atri Clo am,le.atri Clo am,le
=100>
=000>
=000>
=000>
=010>
=000>
=000>
=000>
=001>
=200>
=000>
=000>
=300>
=000>
=000>
=000>
=000>
=002>
=000>
=022>
=002>
=200>
=232>
=002>
=200>
=232>
=233>
)heorem"
?n an* gi'en
,roess an*non5,rini,le
'etor is
smaller than
the ,rini,le
'etor
8/17/2019 scalar+ vector + matrix clock- done
19/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 19
A,,liation o$ .atri Clo A,,liation o$ .atri Clo
user1 =,roess1>
order D1 B =100>
user2 =,roess2>
order D2 B =010>
user3 =,roess3>
order D3 B =001>
=100>
=000>
=000>
=000>
=010>
=000>
=000>
=000>
=001>
=200>
=000>
=000>
=300>
=000>
=000>
=000>
=000>
=002>
=000>
=022>
=002>
=200>
=232>
=002>
=200>
=232>
=233>
D1
D3D1 D2 D3
user3 no(
no(s
that all 3users
ha'e seen
D1
8/17/2019 scalar+ vector + matrix clock- done
20/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 20
A Sna $or .ind A Sna $or .ind
etor lo tells me (hat ! no( one5dimensional data struture
.atri lo tells me (hat ! no( about (hat other
,eo,le no( )(o5dimensional data struture
88 tells me (hat ! no( about (hat other ,eo,le
no( about (hat other ,eo,le no( 885dimensional data struture
8/17/2019 scalar+ vector + matrix clock- done
21/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 21
Summar*Summar *
Cha,ter 7 -.odels and Clos
oal" De$ine -time in a distributed s*stem
Logial lo
-ha,,ened be$ore⇒ smaller lo 'alue
etor lo
-ha,,ened be$ore⇔ smaller lo 'alue
.atri lo
i'es a ,roess no(ledge about (hat other ,roesses no(
8/17/2019 scalar+ vector + matrix clock- done
22/22
CS4231 Parallel and Distributed Algorithms AY2006/2007 Semester 2 22
#ome(or Assignment#ome(or Assignment Pro'e the $ollo(ing"
!$ e'ent s ha,,ens be$ore t then the logial lo 'alue o$ s
is smaller than the logial lo 'alue o$ t
Page 126
Problem 72 : gi'e a ounter5eam,le
Problem 74
Problem 77 : Pro'e that the solution satis$ies the ,ro,ert*
o$ logial los
#ome(or due a (ee $rom toda*