A Lock-Free Hash Trie Design for Concurrent Tabled Logic Programs

Article
  • 147 Downloads

Abstract

Tabling is an implementation technique that improves the declarativeness and expressiveness of Prolog systems in dealing with recursion and redundant sub-computations. A critical component in the design of a concurrent tabling system is the implementation of the table space. One of the most successful proposals for representing tables is based on a two-level trie data structure, where one trie level stores the tabled subgoal calls and the other stores the computed answers. In previous work, we have presented a sophisticated lock-free design where both levels of the tries where shared among threads in a concurrent environment. To implement lock-freedom we used the CAS atomic instruction that nowadays is widely found on many common architectures. CAS reduces the granularity of the synchronization when threads access concurrent areas, but still suffers from problems such as false sharing or cache memory effects. In this work, we present a simpler and efficient lock-free design based on hash tries that minimizes these problems by dispersing the concurrent areas as much as possible. Experimental results in the Yap Prolog system show that our new lock-free design can effectively reduce the execution time and scales better than previous designs.

Keywords

Tabling Concurrency Hash tries Lock-freedom  Performance 

References

  1. 1.
    Areias, M., Rocha, R.: An efficient and scalable memory allocator for multithreaded tabled evaluation of logic programs. In: International Conference on Parallel and Distributed Systems, pp. 636–643. IEEE Computer Society (2012)Google Scholar
  2. 2.
    Areias, M., Rocha, R.: Towards multi-threaded local tabling using a common table space. J. Theory Pract. Logic Program. 12(4 & 5), 427–443 (2012)CrossRefMATHGoogle Scholar
  3. 3.
    Areias, M., Rocha, R.: On the correctness and efficiency of lock-free expandable tries for tabled logic programs. In: International Symposium on Practical Aspects of Declarative Languages, no. 8324 in LNCS, pp. 168–183. Springer (2014)Google Scholar
  4. 4.
    Bagwell, P.: Ideal hash trees. Es Grands Champs 1195 (2001)Google Scholar
  5. 5.
    Chen, W., Warren, D.S.: Tabled evaluation with delaying for general logic programs. J. ACM 43(1), 20–74 (1996)MathSciNetCrossRefMATHGoogle Scholar
  6. 6.
    Dawson, S., Ramakrishnan, C.R., Warren, D.S.: Practical program analysis using general purpose logic programming systems—a case study. In: ACM Conference on Programming Language Design and Implementation, pp. 117–126. ACM (1996)Google Scholar
  7. 7.
    Fredkin, E.: Trie memory. Commun. ACM 3, 490–499 (1962)CrossRefGoogle Scholar
  8. 8.
    Herlihy, M., Shavit, N.: The Art of Multiprocessor Programming. Morgan Kaufmann, Burlington (2008)Google Scholar
  9. 9.
    Herlihy, M., Wing, J.M.: Linearizability: a correctness condition for concurrent objects. ACM Trans. Program. Lang. Syst. 12(3), 463–492 (1990)CrossRefGoogle Scholar
  10. 10.
    Johnson, M.: Memoization in top-down parsing. Comput. Linguist. 21(3), 405–417 (1995)Google Scholar
  11. 11.
    Marques, R., Swift, T.: Concurrent and local evaluation of normal programs. In: International Conference on Logic Programming, no. 5366 in LNCS, pp. 206–222. Springer (2008)Google Scholar
  12. 12.
    Marques, R., Swift, T., Cunha, J.C.: A Simple and efficient implementation of concurrent local tabling. In: International Symposium on Practical Aspects of Declarative Languages, no. 5937 in LNCS, pp. 264–278. Springer (2010)Google Scholar
  13. 13.
    Moura, P.: ISO/IEC DTR 13211–5:2007 Prolog multi-threading predicates (2008). http://logtalk.org/plstd/threads.pdf
  14. 14.
    Prokopec, A., Bronson, N.G., Bagwell, P., Odersky, M.: Concurrent tries with efficient non-blocking snapshots. In: ACM Symposium on Principles and Practice of Parallel Programming, pp. 151–160. ACM (2012)Google Scholar
  15. 15.
    Ramakrishna, Y.S., Ramakrishnan, C.R., Ramakrishnan, I.V., Smolka, S.A., Swift, T., Warren, D.S.: Efficient model checking using tabled resolution. In: Computer Aided Verification, no. 1254 in LNCS, pp. 143–154. Springer (1997)Google Scholar
  16. 16.
    Rocha, R., Silva, F., Santos Costa, V.: On applying or-parallelism and tabling to logic programs. Theory Pract. Log. Program. 5(1 & 2), 161–205 (2005)MathSciNetCrossRefMATHGoogle Scholar
  17. 17.
    Sagonas, K., Swift, T., Warren, D.S.: XSB as an efficient deductive database engine. In: ACM International Conference on the Management of Data, pp. 442–453. ACM (1994)Google Scholar
  18. 18.
    Santos Costa, V., Rocha, R., Damas, L.: The YAP Prolog system. J. Theory Pract. Log. Program. 12(1 & 2), 5–34 (2012)MathSciNetCrossRefMATHGoogle Scholar
  19. 19.
    Shalev, O., Shavit, N.: Split-ordered lists: lock-free extensible hash tables. J. ACM 53(3), 379–405 (2006)MathSciNetCrossRefMATHGoogle Scholar
  20. 20.
    Triplett, J., McKenney, P.E., Walpole, J.: Resizable, scalable, concurrent hash tables via relativistic programming. In: USENIX Annual Technical Conference, p. 11. USENIX Association (2011)Google Scholar
  21. 21.
    Zou, Y., Finin, T.W., Chen, H.: F-OWL: An inference engine for semantic web. In: International Workshop on Formal Approaches to Agent-Based Systems, LNCS, vol. 3228, pp. 238–248. Springer (2004)Google Scholar

Copyright information

© Springer Science+Business Media New York 2015

Authors and Affiliations

  1. 1.CRACS & INESC TEC, Faculty of SciencesUniversity of PortoPortoPortugal

Personalised recommendations