Hostname: page-component-cd9895bd7-8ctnn Total loading time: 0 Render date: 2024-12-28T13:45:41.406Z Has data issue: false hasContentIssue false

Table space designs for implicit and explicit concurrent tabled evaluation

Published online by Cambridge University Press:  27 July 2018

MIGUEL AREIAS
Affiliation:
CRACS & INESC-TEC and Faculty of Sciences, University of Porto, Rua do Campo Alegre, 1021/1055, 4169-007 Porto, Portugal (e-mail: miguel-areias@dcc.fc.up.pt, ricroc@dcc.fc.up.pt)
RICARDO ROCHA
Affiliation:
CRACS & INESC-TEC and Faculty of Sciences, University of Porto, Rua do Campo Alegre, 1021/1055, 4169-007 Porto, Portugal (e-mail: miguel-areias@dcc.fc.up.pt, ricroc@dcc.fc.up.pt)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

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.

Type
Original Article
Copyright
Copyright © Cambridge University Press 2018 

Footnotes

*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.

References

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.Google Scholar
Ali, K. and Karlsson, R. 1990. The muse approach to OR-parallel prolog. International Journal of Parallel Programming 19, 2, 129162.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
Areias, M. and Rocha, R. 2017. On scaling dynamic programming problems with a multithreaded tabling system. Journal of Systems and Software 125, 417426.Google Scholar
Bagwell, P. 2001. Ideal Hash Trees. Technical report.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
Chapman, B., Jost, G. and van der Pas, R. 2008. Using OpenMP: Portable Shared Memory Parallel Programming. The MIT Press.Google Scholar
Chen, W. and Warren, D. S. 1996. Tabled evaluation with delaying for general logic programs. Journal of the ACM 43, 1, 2074.Google Scholar
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.Google Scholar
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.Google Scholar
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>..>Google Scholar
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.Google Scholar
Evans, J. 2006. A scalable concurrent malloc(3) implementation for FreeBSD. In Proc. of the Technical BSD Conference.Google Scholar
Fonseca, N. A., Srinivasan, A., Silva, F. M. A. and Camacho, R. 2009. Parallel ILP for distributed-memory architectures. Machine Learning 74, 3, 257279.Google Scholar
Fredkin, E. 1962. Trie memory. Communications of the ACM 3, 490499.Google Scholar
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.Google Scholar
Ghemawat, S. and Menage, P. TCMalloc: Thread-Caching Malloc. Accessed 10 November 2014. URL: http://goog-perftools.sourceforge.net/doc/tcmalloc.html [online].Google Scholar
Gidenstam, A., Papatriantafilou, M. and Tsigas, P. 2010. NBmalloc: Allocating memory in a lock-free manner. Algorithmica 58, 2, 304338.Google Scholar
Gloger, W. Ptmalloc. Accessed 15 November 2014. URL: http://www.malloc.de/en/.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
Herlihy, M. and Wing, J. M. 1987. Axioms for concurrent objects. In Proc. ACM Symposium on Principles of Programming Languages. ACM, 13–26.Google Scholar
Hermenegildo, M. V. and Greene, K. 1991. The &-prolog system: Exploiting independent and-parallelism. New Generation Computing 9, 3–4, 233257.Google Scholar
Herrmann, C. A. and Lengauer, C. 2000. HDC: A higher-order language for divide-and-conquer. Parallel Processing Letters 10, 2/3, 239250.Google Scholar
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.Google Scholar
Knuth, D. E. 1998. The Art of Computer Programming, volume 3: (2nd ed.) Sorting and Searching. Addison-Wesley Longman.Google Scholar
Kumar, V. 2002. Introduction to Parallel Computing, 2nd ed. Addison-Wesley.Google Scholar
Kumar, V., Grama, A., Gupta, A. and Karypis, G. 1994. Introduction to Parallel Computing: Design and Analysis of Algorithms. Benjamin-Cummings Publishing Co., Inc.Google Scholar
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.Google Scholar
Loogen, R., Ortega-Mallén, Y. and Peña-Marí, R. 2005. Parallel functional programming in Eden. Journal of Functional Programming 15, 3, 431475.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
Martello, S. and Toth, P. 1990. Knapsack Problems: Algorithms and Computer Implementations. John Wiley and Sons.Google Scholar
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.Google Scholar
Moura, P. 2008. ISO/IEC DTR 13211–5:2007 Prolog Multi-threading Predicates.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
Reinders, J. 2007. Intel Threading Building Blocks, 1st ed. O'Reilly & Associates, Inc., Sebastopol, CA, USA.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
Saha, D. 2006. Incremental Evaluation of Tabled Logic Programs. Ph.D. thesis, Department of Computer Science, State University of New York.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
Swift, T. and Warren, D. S. 2012. XSB: Extending prolog with tabled logic programming. Theory and Practice of Logic Programming 12, 1–2, 157187.Google Scholar
Tenenbaum, A. M., Langsam, Y. and Augenstein, M. J. 1990. Data Structures Using C. Prentice Hall.Google Scholar
Zhou, N.-F. 2012. The language features and architecture of B-Prolog. Journal of Theory and Practice of Logic Programming 12, 1–2, 189218.Google Scholar
Zhou, N.-F., Kjellerstrand, H. and Fruhman, J. 2015. Constraint Solving and Planning with Picat. Springer.Google Scholar