Skip to main content
×
×
Home

Table space designs for implicit and explicit concurrent tabled evaluation

  • MIGUEL AREIAS (a1) and RICARDO ROCHA (a1)
Abstract

One of the main advantages of Prolog is its potential for the implicit exploitation of parallelism and, as a high-level language, Prolog is also often used as a means to explicitly control concurrent tasks. Tabling is a powerful implementation technique that overcomes some limitations of traditional Prolog systems in dealing with recursion and redundant sub-computations. Given these advantages, the question that arises is if tabling has also the potential for the exploitation of concurrency/parallelism. On one hand, tabling still exploits a search space as traditional Prolog but, on the other hand, the concurrent model of tabling is necessarily far more complex, since it also introduces concurrency on the access to the tables. In this paper, we summarize Yap's main contributions to concurrent tabled evaluation and we describe the design and implementation challenges of several alternative table space designs for implicit and explicit concurrent tabled evaluation that represent different trade-offs between concurrency and memory usage. We also motivate for the advantages of using fixed-size and lock-free data structures, elaborate on the key role that the engine's memory allocator plays on such environments, and discuss how Yap's mode-directed tabling support can be extended to concurrent evaluation. Finally, we present our future perspectives toward an efficient and novel concurrent framework which integrates both implicit and explicit concurrent tabled evaluation in a single Prolog engine.

Copyright
Footnotes
Hide All

*This work is partially funded by the ERDF (European Regional Development Fund) through Project 9471-RIDTI – Reforçar a Investigação, o Desenvolvimento Tecnológico e a Inovação – and through the COMPETE 2020 Programme within project POCI-01-0145-FEDER-006961, and by National Funds through the FCT (Fundação para a Ciência e a Tecnologia) as part of project UID/EEA/50014/2013. Miguel Areias is funded by the FCT grant SFRH/BPD/108018/2015.

Footnotes
References
Hide All
Alba, E., Almeida, F., Blesa, M. J., Cabeza, J., Cotta, C., Dí-az, M., Dorta, I., Gabarró, J., León, C., Luna, J., Moreno, L. M., Pablos, C., Petit, J., Rojas, A., and Xhafa, F. 2002. MALLBA: A library of skeletons for combinatorial optimisation (research note). In Proc. of International Euro-Par Conference, LNCS, vol. 2400. Springer, 927–932.
Ali, K. and Karlsson, R. 1990. The muse approach to OR-parallel prolog. International Journal of Parallel Programming 19, 2, 129162.
Areias, M. and Rocha, R. 2011. On combining linear-based strategies for tabled evaluation of logic programs. Journal of Theory and Practice of Logic Programming, International Conference on Logic Programming, Special Issue 11, 4–5, 681696.
Areias, M. and Rocha, R. 2012a. An efficient and scalable memory allocator for multithreaded tabled evaluation of logic programs. In International Conference on Parallel and Distributed Systems. IEEE Computer Society, 636643.
Areias, M. and Rocha, R. 2012b. Towards multi-threaded local tabling using a common table space. Journal of Theory and Practice of Logic Programming, International Conference on Logic Programming, Special Issue 12, 4–5, 427443.
Areias, M. and Rocha, R. 2013. Batched evaluation of linear tabled logic programs. Journal of Computer Science and Information Systems, Special Issue on Advances in Model Driven Engineering, Languages and Agents 10, 4, 17751797.
Areias, M. and Rocha, R. 2014. On the correctness and efficiency of lock-free expandable tries for tabled logic programs. In Proc. of International Symposium on Practical Aspects of Declarative Languages, Flatt, M. and Guo, H.-F., Ed. LNCS, vol. 8324. Springer, San Diego, California, USA, 168–183.
Areias, M. and Rocha, R. 2015. Batched evaluation of full-sharing multithreaded tabling. In Proc. of Post-Proceedings of the 4th Symposium on Languages, Applications and Technologies. CCIS, vol. 563. Springer, 113–124.
Areias, M. and Rocha, R. 2016. A lock-free hash trie design for concurrent tabled logic programs. International Journal of Parallel Programming 44, 3, 386406.
Areias, M. and Rocha, R. 2017. On scaling dynamic programming problems with a multithreaded tabling system. Journal of Systems and Software 125, 417426.
Bagwell, P. 2001. Ideal Hash Trees. Technical report.
Berger, E. D., McKinley, K. S., Blumofe, R. D. and Wilson, P. R. 2000. Hoard: A scalable memory allocator for multithreaded applications. ACM SIGPLAN Notices 35, 11, 117128.
Blumofe, R. D., Joerg, C. F., Kuszmaul, B. C., Leiserson, C. E., Randall, K. H., and Zhou, Y. 1995. Cilk: An efficient multithreaded runtime system. SIGPLAN Not. 30, 8, 207216.
Carro, M. and Hermenegildo, M. V. 1999. Concurrency in prolog using threads and a shared database. In Proc. of International Conference on Logic Programming. The MIT Press, 320–334.
Chapman, B., Jost, G. and van der Pas, R. 2008. Using OpenMP: Portable Shared Memory Parallel Programming. The MIT Press.
Chen, W. and Warren, D. S. 1996. Tabled evaluation with delaying for general logic programs. Journal of the ACM 43, 1, 2074.
Chico, P., Carro, M., Hermenegildo, M. V., Silva, C. and Rocha, R. 2008. An improved continuation call-based implementation of tabling. In Proc. of International Symposium on Practical Aspects of Declarative Languages, LNCS, vol. 4902. Springer, 197–213.
Costa, J., Raimundo, J. and Rocha, R. 2009. A term-based global trie for tabled logic programs. In Proc. of International Conference on Logic Programming. LNCS, vol. 5649. Springer, 205–219.
Cruz, F. and Rocha, R. 2010. Retroactive subsumption-based tabled evaluation of logic programs. In Proc. of European Conference on Logics in Artificial Intelligence, LNAI, vol. 6341. Springer, 130–142>.
Desouter, B., van Dooren, M. and Schrijvers, T. 2015. Tabling as a library with delimited control. Journal of Theory and Practice of Logic Programming 15, 4–5, 419433.
Evans, J. 2006. A scalable concurrent malloc(3) implementation for FreeBSD. In Proc. of the Technical BSD Conference.
Fonseca, N. A., Srinivasan, A., Silva, F. M. A. and Camacho, R. 2009. Parallel ILP for distributed-memory architectures. Machine Learning 74, 3, 257279.
Fredkin, E. 1962. Trie memory. Communications of the ACM 3, 490499.
Freire, J., Swift, T. and Warren, D. S. 1996. Beyond depth-first: Improving tabled logic programs through alternative scheduling strategies. In Proc. of International Symposium on Programming Language Implementation and Logic Programming, LNCS, vol. 1140. Springer, 243–258.
Ghemawat, S. and Menage, P. TCMalloc: Thread-Caching Malloc. Accessed 10 November 2014. URL: http://goog-perftools.sourceforge.net/doc/tcmalloc.html [online].
Gidenstam, A., Papatriantafilou, M. and Tsigas, P. 2010. NBmalloc: Allocating memory in a lock-free manner. Algorithmica 58, 2, 304338.
Gloger, W. Ptmalloc. Accessed 15 November 2014. URL: http://www.malloc.de/en/.
Guo, H.-F. and Gupta, G. 2001. A simple scheme for implementing tabled logic programming systems based on dynamic reordering of alternatives. In Proc. of International Conference on Logic Programming. LNCS, vol. 2237. Springer, 181–196.
Gupta, G. and Pontelli, E. 1999. Stack splitting: A simple technique for implementing or-parallelism on distributed machines. In Proc. of International Conference on Logic Programming. The MIT Press, 290–304.
Gupta, G., Pontelli, E., Ali, K., Carlsson, M. and Hermenegildo, M. V. 2001. Parallel execution of prolog programs: A survey. ACM Transactions on Programming Languages and Systems 23, 4, 472602.
Herlihy, M. and Wing, J. M. 1987. Axioms for concurrent objects. In Proc. ACM Symposium on Principles of Programming Languages. ACM, 13–26.
Hermenegildo, M. V. and Greene, K. 1991. The &-prolog system: Exploiting independent and-parallelism. New Generation Computing 9, 3–4, 233257.
Herrmann, C. A. and Lengauer, C. 2000. HDC: A higher-order language for divide-and-conquer. Parallel Processing Letters 10, 2/3, 239250.
Johnson, E., Ramakrishnan, C. R., Ramakrishnan, I. V. and Rao, P. 1999. A space efficient engine for subsumption-based tabled evaluation of logic programs. In Proc. of Fuji International Symposium on Functional and Logic Programming, LNCS, vol. 1722. Springer, 284–300.
Knuth, D. E. 1998. The Art of Computer Programming, volume 3: (2nd ed.) Sorting and Searching. Addison-Wesley Longman.
Kumar, V. 2002. Introduction to Parallel Computing, 2nd ed. Addison-Wesley.
Kumar, V., Grama, A., Gupta, A. and Karypis, G. 1994. Introduction to Parallel Computing: Design and Analysis of Algorithms. Benjamin-Cummings Publishing Co., Inc.
Liang, S., Fodor, P., Wan, H. and Kifer, M. 2009. OpenRuleBench: An analysis of the performance of rule engines. In Proc. of International World Wide Web Conference. ACM, 601–610.
Loogen, R., Ortega-Mallén, Y. and Peña-Marí, R. 2005. Parallel functional programming in Eden. Journal of Functional Programming 15, 3, 431475.
Lusk, E., Butler, R., Disz, T., Olson, R., Overbeek, R., Stevens, R., Warren, D. H. D., Calderwood, A., Szeredi, P., Haridi, S., Brand, P., Carlsson, M., Ciepielewski, A. and Hausman, B. 1988. The aurora Or-parallel prolog system. In Proc. of International Conference on 5th Generation Computer Systems. Institute for New Generation Computer Technology, 819–830.
Marques, R. and Swift, T. 2008. Concurrent and local evaluation of normal programs. In Proc. of International Conference on Logic Programming, LNCS, vol. 5366. Springer, 206–222.
Marques, R., Swift, T. and Cunha, J. C. 2010. A simple and efficient implementation of concurrent local tabling. In Proc. of International Symposium on Practical Aspects of Declarative Languages, LNCS, vol. 5937. Springer, 264–278.
Martello, S. and Toth, P. 1990. Knapsack Problems: Algorithms and Computer Implementations. John Wiley and Sons.
Masmano, M., Ripoll, I. and Crespo, A. 2006. A comparison of memory allocators for real-time applications. In Proc. of the 4th International Workshop on Java Technologies for Real-time and Embedded Systems, JTRES '06. ACM, 68–76.
Moura, P. 2008. ISO/IEC DTR 13211–5:2007 Prolog Multi-threading Predicates.
Peláez, I., Almeida, F. and Suárez, F. 2007. DPSKEL: A skeleton based tool for parallel dynamic programming. In Proc. of International Conference on Parallel Processing and Applied Mathematics, LNCS, vol. 4967. Springer, 1104–1113.
Pontelli, E. and Gupta, G. 1997. Implementation mechanisms for dependent and-parallelism. In Proc. of International Conference on Logic Programming. The MIT Press, 123–137.
Ramakrishnan, I. V., Rao, P., Sagonas, K., Swift, T. and Warren, D. S. 1999. Efficient access mechanisms for tabled logic programs. Journal of Logic Programming 38, 1, 3154.
Rao, P., Ramakrishnan, C. R. and Ramakrishnan, I. V. 1996. A thread in time saves tabling time. In Proc. of Joint International Conference and Symposium on Logic Programming. The MIT Press, 112–126.
Reinders, J. 2007. Intel Threading Building Blocks, 1st ed. O'Reilly & Associates, Inc., Sebastopol, CA, USA.
Rocha, R., Silva, F. and SantosCosta, V. Costa, V. 1999. Or-parallelism within tabling. In Proc. of International Workshop on Practical Aspects of Declarative Languages. LNCS, vol. 1551. Springer, 137–151.
Rocha, R., Silva, F. and SantosCosta, V. Costa, V. 2001. On a tabling engine that can exploit or-parallelism. In Proc. of International Conference on Logic Programming, LNCS, vol. 2237. Springer, 43–58.
Rocha, R., Silva, F. and Santos Costa, V. 2005. On applying or-parallelism and tabling to logic programs. Theory and Practice of Logic Programming 5, 1–2, 161205.
Sagonas, K. and Swift, T. 1998. An abstract machine for tabled execution of fixed-order stratified logic programs. ACM Transactions on Programming Languages and Systems 20, 3, 586634.
Saha, D. 2006. Incremental Evaluation of Tabled Logic Programs. Ph.D. thesis, Department of Computer Science, State University of New York.
Santos, J. and Rocha, R. 2013. On the efficient implementation of mode-directed tabling. In Proc. of International Symposium on Practical Aspects of Declarative Languages, LNCS, vol. 7752. Springer, 141–156.
SantosCosta, V. Costa, V., Rocha, R. and Damas, L. 2012. The YAP prolog system. Journal of Theory and Practice of Logic Programming 12, 1–2, 534.
SantosCosta, V. Costa, V., Warren, D. H. D. and Yang, R. 1991. Andorra-I: A parallel prolog system that transparently exploits both and- and or-parallelism. In Proc. of ACM Symposium on Principles and Practice of Parallel Programming. ACM, 83–93.
Shen, K. 1992. Exploiting dependent and-parallelism in prolog: The dynamic dependent and-parallel scheme (DDAS). In Proc. of Joint International Conference and Symposium on Logic Programming. The MIT Press, 717–731.
Somogyi, Z. and Sagonas, K. 2006. Tabling in mercury: Design and implementation. In Proc. of International Symposium on Practical Aspects of Declarative Languages, LNCS, vol. 3819. Springer, 150–167.
Stivala, A., Stuckey, P., de la Banda, M. G., Hermenegildo, M. and Wirth, A. 2010. Lock-free parallel dynamic programming. Journal of Parallel and Distributed Computing 70, 8, 839848.
Swift, T. and Warren, D. S. 2012. XSB: Extending prolog with tabled logic programming. Theory and Practice of Logic Programming 12, 1–2, 157187.
Tenenbaum, A. M., Langsam, Y. and Augenstein, M. J. 1990. Data Structures Using C. Prentice Hall.
Zhou, N.-F. 2012. The language features and architecture of B-Prolog. Journal of Theory and Practice of Logic Programming 12, 1–2, 189218.
Zhou, N.-F., Kjellerstrand, H. and Fruhman, J. 2015. Constraint Solving and Planning with Picat. Springer.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Theory and Practice of Logic Programming
  • ISSN: 1471-0684
  • EISSN: 1475-3081
  • URL: /core/journals/theory-and-practice-of-logic-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Keywords

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed