Implementing Snapshot Objects on Top of Crash-Prone Asynchronous - - PowerPoint PPT Presentation

implementing snapshot objects on top of crash prone
SMART_READER_LITE
LIVE PREVIEW

Implementing Snapshot Objects on Top of Crash-Prone Asynchronous - - PowerPoint PPT Presentation

Implementing Snapshot Objects on Top of Crash-Prone Asynchronous Message-Passing Systems Carole Delporte-Gallet, Hugues Fauconnier, Sergio Rajsbaum, Michel Raynal 1 Processes communicate by applying operations on and receiving response


slide-1
SLIDE 1

Implementing Snapshot Objects

  • n Top of Crash-Prone

Asynchronous Message-Passing Systems

Carole Delporte-Gallet, Hugues Fauconnier, Sergio Rajsbaum, Michel Raynal

1

slide-2
SLIDE 2
  • Processes communicate by applying operations on

and receiving response from shared objects

  • A shared objects is define by:
  • states
  • operations
  • sequential specification

2

slide-3
SLIDE 3

Register

  • Operations: read, write
  • state: item
  • sequential specification:

return y {state = y}write(x){state = x} {state = y}read(){state = y} return ok

3

slide-4
SLIDE 4

Implementation of object O

  • An operation on O is implemented using messages
  • Correctness ?

4

slide-5
SLIDE 5

Implementing an object

read() write(y) write(x)

  • k

x

  • k

5

message passing

slide-6
SLIDE 6

Histories

  • A history is a sequence of invocation and response

P1 P2 write(2) write(1) write(0) read()

  • k
  • k
  • k

6

write1(1)write2(2)ok1write1(0)ok2ok1read2()02

slide-7
SLIDE 7

7

P1 P2 write(2) write(1) write(0) read()

  • k
  • k
  • k

7

P3

slide-8
SLIDE 8

P1 P2 write(2) write(1) write(0) read()

  • k
  • k
  • k

8

slide-9
SLIDE 9

P1 P2 write(2) write(1) write(0) read()

  • k
  • k
  • k

9

slide-10
SLIDE 10

Atomic snapshot

  • Goal: reading multiple locations atomically

10

slide-11
SLIDE 11
  • Two operations:
  • update(v) return ok
  • snapshot() return an array of n items
  • Sequential specification:
  • state: an array A of n items
  • update(v) by process pi writes v in A[i]
  • snapshot () return an array X where X[i] is the last value

written by Pi

11

slide-12
SLIDE 12

P0 P1 update(1) update(2) snapshot() snapshot() [ , ,….] [1,2,…..] ⊥ ⊥

12

slide-13
SLIDE 13

P0 P1 update(1) Update(2) snapshot snapshot [ , ,…..] [1,2,…..] snapshot [1, , …. ]

⊥ ⊥

13

slide-14
SLIDE 14

One update per process

  • Property: all the snapshots are ordered
  • reduced the complexity of the implementation

Si ⊆ SjorSj ⊆ Si

14

slide-15
SLIDE 15

first attempt

initially shared R array of atomic register init [v,…v] local to Pi array C of n items init [v,…v] Code of Pi update(w){ R.[i]write(w) return (ok) } snapshot(){ for ( int j=0; j<n; j++) C[i]:=R[i].read() return C }

15

slide-16
SLIDE 16

P0 P1 update(1) Update(2) snapshot 1 2 [ ,2,….] ⊥

16

slide-17
SLIDE 17

initially shared R array of atomic register init [v,…v] local to Pi array C of n items init [v,…v] Code of Pi update(w){ R.[i]write(w) return (ok) } collect(){ for ( int j=0; j<n; j++) C[i]:=R[i].read() return C }

17

slide-18
SLIDE 18
  • C1=collect(); C2= collect ()
  • if C1=C2 then C2 is a snapshot !

18

slide-19
SLIDE 19

collect collect C1 C2

19

slide-20
SLIDE 20

initially shared R array of atomic register init [v,…v] local to Pi array C1,C2 of n items init [v,…v] Code of Pi update(w){ R[i].write(w) return (ok) } collect(){ for ( int j=0; j<n; j++) C[i]:=R[i].read() return C } snapshot(){ C1:=collect() forever C2:=collect (); if (C1==C2) return C1 else C1:=C2 }

20

slide-21
SLIDE 21

Safety : linearization points

collect collect C1 C2 C1==C2 snapshot C1 update

21

slide-22
SLIDE 22

Liveness

  • If update() concurrent to collect, snapshot never

terminate

  • Non blocking

22

slide-23
SLIDE 23

implementation in message passing

  • implementation register with crash failures
  • Attiya et al.
  • a majority of correct process is needed and

sufficient

23

slide-24
SLIDE 24
  • local variable REG
  • write(x): send (write, x) to all
  • upon receive (write, x) REG:=x
  • read(): return REG

24

end of write? what happen if only some process receive (write, x)? write(x) and write(y), what is the latest ?

slide-25
SLIDE 25
  • local variable REG,wts,rts
  • write(x): wts++;send (write, x,tws) to all; wait

(ok_write,ts)from a majority of processes

  • upon receive (write, x, t ) from p REG:=max(REG,

(x,t)) send(ok_write, t) to p

25

slide-26
SLIDE 26
  • local variable REG,wts,rst
  • read(): send (read, rts) to all; wait (ok_read,v,rts)

from a majority of processes; REG=max( REG, v), write(REG)

  • upon receive (read, t ) from p send(ok_read,REG, t)

to p

26

slide-27
SLIDE 27

Implementation

  • first registers (write 2n messages; read 4n)
  • second snapshot (double collect)
  • collect n read —> 4n2

27

slide-28
SLIDE 28

code of process i

28

update(v)

slide-29
SLIDE 29

29

slide-30
SLIDE 30

30

update(reg)

slide-31
SLIDE 31

31

slide-32
SLIDE 32

32

slide-33
SLIDE 33

33

slide-34
SLIDE 34

Number of messages

  • update : 2n messages
  • snapshot ( good case) : 2n messages

34

slide-35
SLIDE 35

wait free

  • helping mechanism

35

slide-36
SLIDE 36

Conclusion

  • less messages than
  • implementation of registers in MP
  • +
  • implementation of snapshot in SM

36