Die Präsentation wird geladen. Bitte warten

Die Präsentation wird geladen. Bitte warten

Mehrbenutzerzugriff auf GIS-Daten

Ähnliche Präsentationen


Präsentation zum Thema: "Mehrbenutzerzugriff auf GIS-Daten"—  Präsentation transkript:

1 Mehrbenutzerzugriff auf GIS-Daten
Geoinformation Vorlesung 5 Mehrbenutzerzugriff auf GIS-Daten

2 Szenario Geodatenserver mehrere Benutzer Transaktionen T
1 Szenario Geodatenserver mehrere Benutzer Transaktionen T Anfragen, Methoden, Programme Items „A“ Variable, Tupel, Relation, Objekt Modi Lesen (an und für sich unproblematisch) Schreiben Erforderlich: Synchronisation Protokolle

3 Problemfall Write A Programm (P): Read A; A:=A+1; Write A;
2 Problemfall Programm (P): Read A; A:=A+1; Write A; =/= 6 ! A in Datenbank 5 5 5 5 6 6 T1: Read A A:=A+1 Write A T2: Read A A:=A+1 Write A A im Arbeitsspeicher T1 5 5 6 6 6 6 A im Arbeitsspeicher T2 5 5 6 6

4 Lösung: Sperren (Lock und Unlock)
3 Lösung: Sperren (Lock und Unlock) Sperren verschafft dem Prozess P exklusiven Zugriff auf das Item A. P : Read A; Write A; A:=A+1; Lock A; Unlock A

5 Problem: Gegenseitige Blockade („Deadlock“)
4 Problem: Gegenseitige Blockade („Deadlock“) T 1: Lock A; Lock B; Unlock A; Unlock B; T 2: Lock B; Lock A; Unlock B; Unlock A;

6 Vermeidung von Deadlocks:
5 Vermeidung von Deadlocks: Protokolle des Laufzeitsystems: alle Ressourcen werden auf einmal angefordert und gleichzeitig gewährt (falls nicht alle Ressourcen verfügbar, kommt der Prozess in die Warteschlange) die Ressourcen unterliegen einer linearen Ordnung, und bei der Bedarfsanmeldung wird diese Reihenfolge eingehalten

7 Aber wie steuert man Nebenläufigkeit?
6 Aber wie steuert man Nebenläufigkeit? wird erst T1 ganz und dann T2 ganz ausgeführt, heisst diese Reihenfolge seriell Problem: welche Überlappung ist zulässig? eine Reihenfolge heisst serialisierbar, wenn sie einer seriellen Reihenfolge äquivalent ist wie erkennt man Serialisierbarkeit? T 1: A:=A-10; Read B; Write B; Read A; Write A; B:=B+10; T 2: B:=B-20; Read C; Write C; C:=C+20;

8 Beispiele T 1 T 2 T 1 T 2 T 1 T 2 A:=A-10 Read B A:=A-10 A:=A-10
7 Beispiele T 1 T 2 T 1 T 2 T 1 T 2 Read A Read A Lock A A:=A-10 Read B A:=A-10 Write A A:=A-10 Lock B Read B B:=B-20 Unlock A B:=B+10 Write A B:=B-20 Write B Write B Lock B Read B Read B Unlock B B:=B-20 Read C B:=B+10 B:=B+10 Lock C Write B Read C C:=C+20 Unlock B C:=C+20 Write B C:=C+20 Write C Write C Unlock C seriell serialisierbar nicht serialisierbar A 3x

9 Prüfung auf Serialisierbarkeit (a posteriori)
8 Prüfung auf Serialisierbarkeit (a posteriori) Algorithmus: Input: Eine überlappte Ausführung von Transformationen T1,...,Tk Output: Prüfung der Serialisierbarkeit. Methode: Konstruiere einen Graphen mit den Knoten a1, a2, ... an wobei jedes ai eine der beiden folgenden Formen hat: Tj: Lock Am oder Tj: Unlock Am Wenn ein Lock Am auf einen Unlock Am folgt, werden diese beiden Knoten miteinander verbunden. Die Reihenfolge ist serialisierbar, wenn der entstandene Graph azyklisch ist; eine serielle Reihenfolge kann durch eine geeignete Durchlaufstrategie ermittelt werden.

10 Serialisierbar Lock A . Unlock A Lock A Lock B . Unlock B . Lock B
9 Serialisierbar Lock A . Unlock A Lock A Lock B . Unlock B . Lock B Unlock B T1 T2

11 Serialisierbarkeit a priori durch Zwei-Phasen-Protokoll
10 Serialisierbarkeit a priori durch Zwei-Phasen-Protokoll Zwei-Phasen-Protokoll in jeder Transaktion T gehen alle Sperrungen (Locks) den Freigaben (Unlocks) voraus Vorteil: leicht zu überprüfen Nachteil: ev. großräumige Sperrung T2: Lock A; Lock B; Unlock A; Unlock B;

12 11 Beispiel T2: Lock A; Lock B; Unlock A; Unlock B;

13 Verfeinerungen differenziere zwischen Read und Write-Locks
12 Verfeinerungen differenziere zwischen Read und Write-Locks berücksichtige hierarchische Strukturen Aggregierte Objekte B-Bäume

14 Baum-Protokoll 1 (knoten-orientiert)
13 Baum-Protokoll 1 (knoten-orientiert) Lock eines Knotens setzt Verfügung (Lock) über den Vaterknoten voraus Ausnahme: 1. Lock einer Transaktion Kein Knoten wird durch die gleiche Transaktion mehrmals gesperrt A B C G F E D

15 Baum-Protokoll 1 (knoten-orientiert)
14 Baum-Protokoll 1 (knoten-orientiert) (1) (2) (4) (3) (9) (8) (5) (10) (6) (7) (12) (11) (14) (13) (16) (15) (18) (17) Lock D Lock B Unlock B Lock A Lock C Lock E Unlock D Lock F Unlock A Unlock C Unlock E Lock G Unlock F Unlock G A B C G F E D A A B B B B C C D D E E E E F F G G T1 T2 T3 A 36x

16 Warn-Protokoll (Teilbaum-orientiert)
15 Warn-Protokoll (Teilbaum-orientiert) Anwendungsbeispiel: B-Baum 3 Modi: Warn, Lock und Unlock Warnungen sind untereinander nicht exklusiv mehrere Prozesse können den gleichen Knoten warnen ein gewarnter Knoten kann von einem anderen nicht mit Lock gesperrt werden Die Transaktion T beginnt mit der Warnung der Wurzel des Baumes Sperrung eines Knotens setzt Warnung des Vaterknotens voraus ein Knoten kann nur entsperrt oder entwarnt werden, nachdem alle Sperrungen / Warnungen auf Kinder entfernt wurden 2-Phasen-Protokoll: alle Warnungen und Sperrungen gehen allen Freigaben voraus

17 16 A B C G F E D

18 Warn-Protokoll (Beispiel)
17 Warn-Protokoll (Beispiel) (1) Warn A (2) Warn A (3) Warn A A B C G F E D (4) Warn B (5) Lock C (6) Lock D C C (7) Unlock C (8) Unlock D (9) Unlock A (10) Unlock B D D (11) Lock B (12) Warn C (13) Lock F (14) Unlock A (15) Unlock B (16) Unlock F (17) Unlock C (18) Unlock A T1 T2 T3 A 36x

19 Warn-Protokoll (Beispiel)
17 Warn-Protokoll (Beispiel) (1) Warn A (2) Warn A (3) Warn A A B C G F E D (4) Warn B (5) Lock C (6) Lock D C C (7) Unlock C (8) Unlock D (9) Unlock A (10) Unlock B D D (11) Lock B (12) Warn C (13) Lock F (14) Unlock A (15) Unlock B (16) Unlock F (17) Unlock C (18) Unlock A T1 T2 T3 A 36x

20 Warn-Protokoll (Beispiel)
17 Warn-Protokoll (Beispiel) (1) Warn A (2) Warn A (3) Warn A A B C G F E D (4) Warn B (5) Lock C (6) Lock D B C C (7) Unlock C (8) Unlock D (9) Unlock A (10) Unlock B D D F (11) Lock B (12) Warn C (13) Lock F (14) Unlock A (15) Unlock B (16) Unlock F (17) Unlock C (18) Unlock A T1 T2 T3 A 36x

21 Warn-Protokoll (Beispiel)
17 Warn-Protokoll (Beispiel) (1) Warn A (2) Warn A (3) Warn A A B C G F E D (4) Warn B (5) Lock C (6) Lock D B B C C (7) Unlock C (8) Unlock D (9) Unlock A (10) Unlock B D D F F (11) Lock B (12) Warn C (13) Lock F (14) Unlock A (15) Unlock B (16) Unlock F (17) Unlock C (18) Unlock A T1 T2 T3 A 36x

22 Warn-Protokoll (Beispiel)
17 Warn-Protokoll (Beispiel) (1) Warn A (2) Warn A (3) Warn A A B C G F E D (4) Warn B (5) Lock C (6) Lock D B B C C (7) Unlock C (8) Unlock D (9) Unlock A (10) Unlock B D D F F (11) Lock B (12) Warn C (13) Lock F (14) Unlock A (15) Unlock B (16) Unlock F (17) Unlock C (18) Unlock A T1 T2 T3 A 36x

23 Warn-Protokoll (Beispiel)
17 Warn-Protokoll (Beispiel) (1) Warn A (2) Warn A (3) Warn A A B C G F E D (4) Warn B (5) Lock C (6) Lock D B B C C (7) Unlock C (8) Unlock D (9) Unlock A (10) Unlock B D D F F (11) Lock B (12) Warn C (13) Lock F (14) Unlock A (15) Unlock B (16) Unlock F (17) Unlock C (18) Unlock A T1 T2 T3 A 36x


Herunterladen ppt "Mehrbenutzerzugriff auf GIS-Daten"

Ähnliche Präsentationen


Google-Anzeigen