Presentation is loading. Please wait.

Presentation is loading. Please wait.

Carlos DamásioTAPD 2000, Vigo1 A Distributed Tabling System Carlos Viegas Damásio Dept. Informática, Univ. Nova de Lisboa Portugal.

Similar presentations


Presentation on theme: "Carlos DamásioTAPD 2000, Vigo1 A Distributed Tabling System Carlos Viegas Damásio Dept. Informática, Univ. Nova de Lisboa Portugal."— Presentation transcript:

1 Carlos DamásioTAPD 2000, Vigo1 A Distributed Tabling System Carlos Viegas Damásio (cd@di.fct.unl.pt) Dept. Informática, Univ. Nova de Lisboa Portugal

2 Carlos DamásioTAPD 2000, Vigo2 Overview Objectives of this work The Distributed Tabling Architecture Architecture Components A running example Completion and Termination Conclusions

3 Carlos DamásioTAPD 2000, Vigo3 Objectives Define a general and “open” architecture for distributed tabled query-evaluation of definite logic programs. Address the issue of table completion resorting to known distributed algorithms.

4 Carlos DamásioTAPD 2000, Vigo4 Architecture Components 1 Goal Manager 1 Table Manager N Table Storage Clients N Prover Clients

5 Carlos DamásioTAPD 2000, Vigo5 Goal Manager Interfaces the distributed tabling system with the “outside” world. It accepts queries and provides answers to the queries. Detects termination of the computation

6 Carlos DamásioTAPD 2000, Vigo6 Table Manager Decides the location of the tables among the several table storage clients, guaranteeing uniqueness of the tables. If all prover clients know where a goal should be tabled, then the Table Manager can be removed from the architecture

7 Carlos DamásioTAPD 2000, Vigo7 Table Storage Clients Keep the answers for given goal calls, avoiding redundant answers. They manage the delivery of solutions to the appropriate invoking goals

8 Carlos DamásioTAPD 2000, Vigo8 Prover Clients Perform the logical expansion operations on the set of active goals.

9 Carlos DamásioTAPD 2000, Vigo9 Message Protocol Goal ManagerTable Manager query(Vars, Body, N) answer(Lit,Gid) call(Lit,Gid) Table StorageProver call(Lit,Gid) table(Lit,TS) call(Lit,Tid) answer(Lit,Gid) answer(Lit,Tid) call(Lit,Gid) answer(Vars, N)

10 Carlos DamásioTAPD 2000, Vigo10 Message Complexity Goal call: – at least 1 message and at most 4 messages. – If the table manager is not involved, at least 1 message and at most 2 messages. Answer return: –1 plus the number of consumers of the table. So, at least 2 messages.

11 Carlos DamásioTAPD 2000, Vigo11 An Example a(X)  b(X), c(X). a(1). b(X)  a(X). b(0). c(0). ?- b(X).

12 Carlos DamásioTAPD 2000, Vigo12 Goal ManagerTable Manager 1. query([X], b(X), 5) 2. assert(q0(X)  b(X) ) table[q0(_)] := ts1 3. call(q0(X), 0) Prover 1 T. Storage 1 Prover 2 T. Storage 2 4. assert(q0(X)  b(X) ) 5. assert(q0(X)  b(X) ) 6. table(q0(_), ts1) 7. call(q0(X),0) tabling[q0(_)] := t0 consumer[t0] := {(gm,0)} 8. call(q0(X1),t0) [t0] 0: q0(X1)  b(X1) 9. call(b(X1),0) tabling[b(_)] := t0 consumer[t0] := {(p1,0)} 10. call(b(X2),t0) [t0] 0: b(X3)  a(X3) [t0] b(0).

13 Carlos DamásioTAPD 2000, Vigo13 Prover 2T. Storage 2 tabling[b(_)] := t0 consumer[t0] := (p1,0) 11. call(a(X3),0) [t0] 0: b(X3)  a(X3) [t0] b(0). tabling[a(_)] := t1 consumer[t1] := {(p2,0)} 12. call(a(X4),t1) [t1] 1: a(X4)  b(X4), c(X4). [t1] a(1). 13. answer(b(0),t0) solution[t0] := b(0) 14. call(b(X4),1) 15. answer(a(1),t1), (p2,1) solution[t1] := a(1) 16. answer(b(0),1) 17. answer(a(1),0) [t0] b(1). [t1] 2: a(0)  c(0). 18. answer(b(1),t0), b(1) 19. answer(b(1),1) [t1] 3: a(1)  c(1).

14 Carlos DamásioTAPD 2000, Vigo14 Goal Manager Prover 1 T. Storage 1 T. Storage 2 tabling[b(_)] := t0 consumer[t0] := (p1,0) solution[t0] := b(0), (p2,1) 20. answer(b(0),0), b(1) [t0] 0: q0(X1)  b(X1) [t0] q0(0). 21. answer(q0(0),t0) tabling[q0(_)] := t0 consumer[t0] := {(gm,0)} solution[t0] := q0(0) 22. answer(q0(0),0) 23. answer(0,5) 24. answer(b(1),0) 25. answer(q0(1),t0) [t0] q0(1)., q0(1) 26. answer(q0(1),0) 27. answer(1,5)

15 Carlos DamásioTAPD 2000, Vigo15 T. Storage 2 T. Storage 1 Prover 1 Prover 2 29. call(c(0),t1) tabling[c(0)] := t1 consumer[t1] := {(p2,2)} solution[t1] := c(0) 33. answer(c(0),2) 28. call(c(0),2) tabling[b(_)] := t0 consumer[t0] := (p1,0) tabling[a(_)] := t1 consumer[t1] := {(p2,0)} solution[t0] := b(0), b(1) solution[t1] := a(1) [t0] 0: q0(X1)  b(X1) [t0] q0(0). [t0] q0(1). tabling[c(1)] := t2 consumer[t2] := {(p2,3)} [t0] 0: b(X3)  a(X3) [t0] b(0). [t1] 1: a(X4)  b(X4), c(X4). [t1] a(1). [t0] b(1). [t1] 2: a(0)  c(0). [t1] 3: a(1)  c(1). 30. call(c(1),3) [t1] c(0). 31. call( c(1), t2) 32. answer(c(0),t1) [t1] a(0). 35. answer(a(0),0) 34. answer(a(0),t1), a(0) [t0] b(0). 36. answer(b(0),t0)

16 Carlos DamásioTAPD 2000, Vigo16 Termination Detection The computation stops when activity ceases in the system (no messages and all processes are idle). A classical distributed termination detection algorithm suffices to detect global termination (it doubles in the worst case the number of messages)

17 Carlos DamásioTAPD 2000, Vigo17 Completion Detection Completion is important for –Reclaiming of space and global evaluation structures. –Evaluation of default negation (not...) Algorithm for distributed completion of tables without goal dependency propagation

18 Carlos DamásioTAPD 2000, Vigo18 Credit Recovery Algorithm

19 Carlos DamásioTAPD 2000, Vigo19 Completion by Credit Change Construct a static goal dependency graph To each strongly connected component of this graph we associate a zone. Each zone has table storage controller running an instance of the credit recovery algorithm We exchange credits from different zones

20 Carlos DamásioTAPD 2000, Vigo20 Returning to the Example We have three zones: –Zone 0 for queries, controller goal manager –Zone 1 for a/1 and b/1, controller T. Storage 2 –Zone 2 for c/1, controller T. Storage 1

21 Carlos DamásioTAPD 2000, Vigo21 Goal ManagerTable Manager [0] query([X], b(X), 5) 2. assert(q0(X)  b(X) ) [1] 3. call(q0(X), 0) [2] Prover 1 T. Storage 1 Prover 2 T. Storage 2 4. assert(q0(X)  b(X) ) [3] 5. assert(q0(X)  b(X) ) [4] 6. table(q0(_), ts1) [5] 7. call(q0(X),0) [6] 10. call(b(X2),t0) [9] W := [2,5]W := [1,6] W := [3]W := [4] W := [6] RC 0 =1,2,3,4,5,6 W := [6] W := [7] 9. call(b(X1),0) [8] W := [8] W := [9] 8. call(q0(X1),t0) [7] W := [7] To exchange: [8],7,8

22 Carlos DamásioTAPD 2000, Vigo22 Prover 2T. Storage 2 call(a(X3),0) 10 call(a(X4),t1) 11 answer(b(0),t0) 12 call(b(X4),1) 13 answer(a(1),t1) 14 answer(b(0),1) 15 answer(a(1),0) 16 answer(b(1),t0) 17 answer(b(1),1) 18 W := 9,11,12,13,16,18W := 10,14,15,17,18

23 Carlos DamásioTAPD 2000, Vigo23 Goal Manager Prover 1 T. Storage 1 T. Storage 2 20. answer(b(0),0) [9] 21. answer(q0(0),t0) [10] 22. answer(q0(0),0) [11] 23. answer(0,5) 24. answer(b(1),0) [10] 25. answer(q0(1),t0) [11] 26. answer(q0(1),0) [12] 27. answer(1,5) W := [9,11,12,13,16,18] To exchange: [8] RC 0 =1,2,3,4,5,6,7,8 [9],10 [10],9 RC 1 = 9,11,12,13,16,18

24 Carlos DamásioTAPD 2000, Vigo24 RC 1 = 9,11,12,13,16,18 T. Storage 1 Prover 1 Prover 2 29. call(c(0),t1) [20] 33. answer(c(0),2) [21] 28. call(c(0),2) [19] 30. call(c(1),3) [20] 31. call( c(1), t2) [20] 32. answer(c(0),t1) [20] 35. answer(a(0),0) [23] 34. answer(a(0),t1) [22] 36. answer(b(0),t0) [24] W := 10,14,15,17,18 W := 10,14,15,17,19 W:=10,14,15,17,20 To exchange: 19,20 RC 2 = 19, 20 To exchange: [10] Goal Manager RC 0 =1,2,3,4,5,6,7,8,9,10RC 0 =0 RC 1 = 9,10,11,12,13,14,15,16,17,18,20 T. Storage 2,21 RC 1 = 8 W := 22,24 W := 23,24 RC 1 = 9,10,11,12,13,14,15,16,17,18,19,20,21

25 Carlos DamásioTAPD 2000, Vigo25 Practical Results Too bad to be told: –The current implementation has been done entirely as a Prolog Interpreter over PVM- Prolog. –The main cause of inefficiency is the (ab)use of asserts/retracts to keep the global state.

26 Carlos DamásioTAPD 2000, Vigo26 Conclusions A general and open distributed tabling system was presented. Polynomial complexity. An extension for completion detection without goal dependency has been introduced. Relatively low message overhead.

27 Carlos DamásioTAPD 2000, Vigo27 Goal Manager Prover 1 T. Storage 1 T. Storage 2 tabling[b(_)] := t0 consumer[t0] := (p1,0) solution[t0] := b(0), (p2,1) 20. answer(b(0),0), b(1) [t0] 0: q0(X1)  b(X1) [t0] q0(0). 21. answer(q0(0),t0) tabling[q0(_)] := t0 consumer[t0] := {(gm,0)} solution[t0] := q0(0) 22. answer(q0(0),0) 23. answer(0,5) 24. answer(b(1),0) 25. answer(q0(1),t0) [t0] q0(1)., q0(1) 26. answer(q0(1),0) 27. answer(1,5)


Download ppt "Carlos DamásioTAPD 2000, Vigo1 A Distributed Tabling System Carlos Viegas Damásio Dept. Informática, Univ. Nova de Lisboa Portugal."

Similar presentations


Ads by Google