Pobieranie prezentacji. Proszę czekać

Pobieranie prezentacji. Proszę czekać

Spójność i replikacja Wykład 7.

Podobne prezentacje


Prezentacja na temat: "Spójność i replikacja Wykład 7."— Zapis prezentacji:

1 Spójność i replikacja Wykład 7

2 Zwielokrotnianie obiektów (1)
Organizacja rozproszonego obiektu zdalnego, dzielonego przez różnych klientów.

3 Zwielokrotnianie obiektów (2)
System rozproszony obiektów świadomych zwielokrotnienia System rozproszony odpowiedzialny za zarządzanie kopiami

4 Zwielokrotnianie obiektów (3)
A distributed system for replication-aware distributed objects. A distributed system responsible for replica management

5 Modele spójności nastawione na dane
Ogólna organizacja logicznej pamięci danych, fizycznie rozproszona między różnymi procesami.

6 „Każde czytanie zmiennej x zwraca wartość = ostatniemu zapisowi x”.
Spójność ścisła „Każde czytanie zmiennej x zwraca wartość = ostatniemu zapisowi x”. Zachowanie 2 procesów działających na tej samej danej. Pamięć spójna ściśle. Pamięć, która niespójna ściśle.

7 Liniowość i spójność sekwenycjna (1)
“Wynik dowolnego wykonania jest taki sam, jak gdyby operacje (RW) wszystkich procesów na pamięci danych były wykonane w pewnym porządku jedna po drugiej, przy czym operacje każdego procesu wystąpiły w tym ciągu w kolejności określonej przez jego program” Pamięć danych spójna sekwencyjne. Pamięć danych niespójna sekwencyjne.

8 Liniowość i spójność sekwencyjna (2)
Process P1 Process P2 Process P3 x = 1; print ( y, z); y = 1; print (x, z); z = 1; print (x, y); Trzy procesy współbieżne.

9 Liniowość i spójność sekwencyjna (3)
x = 1; print (y, z); y = 1; print (x, z); z = 1; print (x, y); Drukuje: Sygnatura: (a) Drukuje: Sygnatura: (b) Drukuje: Sygnatura: 110101 (c) Drukuje: 111111 (d) Czas 4 z 90 dozwolonych ciągów wykonań procesów z poprzedniego slajdu.

10 Spójność przyczynowa (1)
„Zapisy potencjalnie powiązane przyczynowo muszą być oglądane przez wszystkie procesy w takim samym porządki. Zapisy współbieżne mogą być oglądane w różnej kolejności.”

11 Spójność przyczynowa (2)
zapisy współbieżne zapisy przyczynowe Sekwencja dozwolona w pamięci przyczynowej, zabroniona w pamięci sekwencyjnej.

12 Spójność przyczynowa (3)
Naruszenie spójności przyczynowej. Poprawna przyczynowo kolejność zdarzeń.

13 Spójność FIFO (1) „Zapisy wykonane przez 1 proces, są oglądane przez wszystkie inne procesy w porządku, w którym powstawały. Zapisy pochodzące od różnych procesów mogą być oglądane w różnym porządku.”.

14 Dozwolony ciąg zdarzeń przy spójności FIFO
Spójność FIFO (2) Dozwolony ciąg zdarzeń przy spójności FIFO

15 Spójność FIFO (3) x = 1; print (y, z); y = 1; print(x, z); z = 1; print (x, y); Drukuje: 00 (a) Drukuje: 10 (b) print (x, z); Drukuje: 01 (c) Wykonanie instrukcji z punktu widzenia 3 procesów z poprzedniego slajdu. Instrukcje wytłuszczone generują wyniki.

16 Spójność słaba (1) 3 cechy:
Dostępy do zmiennej synchronizacji są spójne sekwencyjnie Działanie na zmiennej synchronizacji jest zabronione do czasu, aż wszystkie poprzednie zapisy zostaną ukończone Na jednostce danych zabrania się wykonywania operacji R/W dopóty, dopóki nie zostaną wykonane wszystkie poprzednie operacje na zmiennych synchronizacji.

17 Spójność słaba (2) int a, b, c, d, e, x, y; /* zmienne*/ int *p, *q; /* wskaźniki*/ int f( int *p, int *q); /* prototyp funkcji */ a = x * x; /* a w rejestrze */ b = y * y; /* b w rejestrze */ c = a*a*a + b*b + a * b; /* używane później */ d = a * a * c; /* używane później */ p = &a; /* p wskazuje na a */ q = &b /* q wskazuje na b */ e = f(p, q) /* wywołanie funkcji */ Fragment programu, w którym niektóre zmienne mogą być przechowywane w rejestrach.

18 Spójność słaba (3) Ciąg zdarzeń dozwolony w spójności słabej.
Ciąg zdarzeń niedozwolony w spójności słabej.

19 Spójność zwalniania (1)
Ciąg zdarzeń dozwolony w spójności zwalniania.

20 Spójność zwalniania (2)
Warunki: Przed wykonaniem operacji R/W, proces musi sfinalizować wszystkie poprzednie nabycia. Zanim będzie można wykonać zwolnienie, w procesie należy zakończyć wszystkie operacje RW Dostęp do zmiennych synchronizacji wykazują spójność FIFO (nie jest wymagana spójność sekwencyjna).

21 Entry Consistency (1) Conditions:
An acquire access of a synchronization variable is not allowed to perform with respect to a process until all updates to the guarded shared data have been performed with respect to that process. Before an exclusive mode access to a synchronization variable by a process is allowed to perform with respect to that process, no other process may hold the synchronization variable, not even in nonexclusive mode. After an exclusive mode access to a synchronization variable has been performed, any other process's next nonexclusive mode access to that synchronization variable may not be performed until it has performed with respect to that variable's owner.

22 A valid event sequence for entry consistency.

23 Summary of Consistency Models
Description Strict Absolute time ordering of all shared accesses matters. Linearizability All processes must see all shared accesses in the same order. Accesses are furthermore ordered according to a (nonunique) global timestamp Sequential All processes see all shared accesses in the same order. Accesses are not ordered in time Causal All processes see causally-related shared accesses in the same order. FIFO All processes see writes from each other in the order they were used. Writes from different processes may not always be seen in that order (a) Weak Shared data can be counted on to be consistent only after a synchronization is done Release Shared data are made consistent when a critical region is exited Entry Shared data pertaining to a critical region are made consistent when a critical region is entered. (b) Consistency models not using synchronization operations. Models with synchronization operations.

24 Eventual Consistency The principle of a mobile user accessing different replicas of a distributed database.

25 Monotonic Reads The read operations performed by a single process P at two different local copies of the same data store. A monotonic-read consistent data store A data store that does not provide monotonic reads.

26 Monotonic Writes The write operations performed by a single process P at two different local copies of the same data store A monotonic-write consistent data store. A data store that does not provide monotonic-write consistency.

27 Read Your Writes A data store that provides read-your-writes consistency. A data store that does not.

28 Writes Follow Reads A writes-follow-reads consistent data store
A data store that does not provide writes-follow-reads consistency

29 Replica Placement The logical organization of different kinds of copies of a data store into three concentric rings.

30 Server-Initiated Replicas
Counting access requests from different clients.

31 Pull versus Push Protocols
Issue Push-based Pull-based State of server List of client replicas and caches None Messages sent Update (and possibly fetch update later) Poll and update Response time at client Immediate (or fetch-update time) Fetch-update time A comparison between push-based and pull-based protocols in the case of multiple client, single server systems.

32 Remote-Write Protocols (1)
Primary-based remote-write protocol with a fixed server to which all read and write operations are forwarded.

33 Remote-Write Protocols (2)
The principle of primary-backup protocol.

34 Local-Write Protocols (1)
Primary-based local-write protocol in which a single copy is migrated between processes.

35 Local-Write Protocols (2)
Primary-backup protocol in which the primary migrates to the process wanting to perform an update.

36 The problem of replicated invocations.
Active Replication (1) The problem of replicated invocations.

37 Active Replication (2) Forwarding an invocation request from a replicated object. Returning a reply to a replicated object.

38 Quorum-Based Protocols
Three examples of the voting algorithm: A correct choice of read and write set A choice that may lead to write-write conflicts A correct choice, known as ROWA (read one, write all)

39 Orca OBJECT IMPLEMENTATION stack; top: integer; # variable indicating the top stack: ARRAY[integer 0..N-1] OF integer # storage for the stack OPERATION push (item: integer) # function returning nothing BEGIN GUARD top < N DO stack [top] := item; # push item onto the stack top := top + 1; # increment the stack pointer OD; END; OPERATION pop():integer; # function returning an integer BEGIN GUARD top > 0 DO # suspend if the stack is empty top := top – 1; # decrement the stack pointer RETURN stack [top]; # return the top item OD; END; BEGIN top := 0; # initialization END; A simplified stack object in Orca, with internal data and two operations.

40 Management of Shared Objects in Orca
Four cases of a process P performing an operation on an object O in Orca.

41 Casually-Consistent Lazy Replication
The general organization of a distributed data store. Clients are assumed to also handle consistency-related communication.

42 Processing Read Operations
Performing a read operation at a local copy.

43 Processing Write Operations
Performing a write operation at a local copy.


Pobierz ppt "Spójność i replikacja Wykład 7."

Podobne prezentacje


Reklamy Google