Hostname: page-component-cd9895bd7-lnqnp Total loading time: 0 Render date: 2024-12-23T10:44:54.074Z Has data issue: false hasContentIssue false

Towards multi-threaded local tabling using a common table space

Published online by Cambridge University Press:  05 September 2012

MIGUEL AREIAS
Affiliation:
CRACS & INESC TEC, Faculty of Sciences, University of Porto Rua do Campo Alegre, 1021/1055, 4169-007 Porto, Portugal (e-mail: [email protected], [email protected])
RICARDO ROCHA
Affiliation:
CRACS & INESC TEC, Faculty of Sciences, University of Porto Rua do Campo Alegre, 1021/1055, 4169-007 Porto, Portugal (e-mail: [email protected], [email protected])

Abstract

Multi-threading is currently supported by several well-known Prolog systems providing a highly portable solution for applications that can benefit from concurrency. When multi-threading is combined with tabling, we can exploit the power of higher procedural control and declarative semantics. However, despite the availability of both threads and tabling in some Prolog systems, the implementation of these two features implies complex ties to each other and to the underlying engine. Until now, XSB was the only Prolog system combining multi-threading with tabling. In XSB, tables may be either private or shared between threads. While thread-private tables are easier to implement, shared tables have all the associated issues of locking, synchronization and potential deadlocks. In this paper, we propose an alternative view to XSB's approach. In our proposal, each thread views its tables as private but, at the engine level, we use a common table space where tables are shared among all threads. We present three designs for our common table space approach: No-Sharing (NS) (similar to XSB's private tables), Subgoal-Sharing (SS) and Full-Sharing (FS). The primary goal of this work was to reduce the memory usage for the table space but, our experimental results, using the YapTab tabling system with a local evaluation strategy, show that we can also achieve significant reductions on running time.

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2012

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Chen, W. and Warren, D. S. 1996. Tabled evaluation with delaying for general logic programs. Journal of the ACM 43, 1, 2074.CrossRefGoogle Scholar
Freire, J., Hu, R., Swift, T. and Warren, D. S. 1995. Exploiting parallelism in tabled evaluations. In International Symposium on Programming Languages: Implementations, Logics and Programs. Number 982 in LNCS. Springer-Verlag, 115132.CrossRefGoogle Scholar
Freire, J., Swift, T. and Warren, D. S. 1996. Beyond depth-first: Improving tabled logic programs through alternative scheduling strategies. In International Symposium on Programming Language Implementation and Logic Programming. Number 1140 in LNCS. Springer-Verlag, 243258.CrossRefGoogle Scholar
Liang, S., Fodor, P., Wan, H. and Kifer, M. 2009. OpenRuleBench: An analysis of the performance of rule engines. In Internacional World Wide Web Conference. ACM Press, 601610.Google Scholar
Marques, R. 2007. Concurrent Tabling: Algorithms and Implementation, PhD Thesis, Department of Computer Science, New University of Lisbon.Google Scholar
Marques, R. and Swift, T. 2008. Concurrent and local evaluation of normal programs. In International Conference on Logic Programming. Number 5366 in LNCS. Springer-Verlag, 206222.CrossRefGoogle Scholar
Marques, R., Swift, T. and Cunha, J. C. 2010. A simple and efficient implementation of concurrent local tabling. In International Symposium on Practical Aspects of Declarative Languages. Number 5937 in LNCS. Springer-Verlag, 264278.CrossRefGoogle Scholar
Moura, P. 2008. ISO/IEC DTR 13211–5:2007 Prolog Multi-threading Predicates. Available from http://logtalk.org/plstd/threads.pdf.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.CrossRefGoogle Scholar
Rocha, R., Silva, F. and Santos Costa, V. 2004. Concurrent table accesses in parallel tabled logic programs. In International Euro-Par Conference. Number 3149 in LNCS. Springer-Verlag, 662670.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.CrossRefGoogle 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.CrossRefGoogle 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.CrossRefGoogle Scholar
Wielemaker, J. 2003. Native preemptive threads in SWI-Prolog. In International Conference on Logic Programming. Number 2916 in LNCS. Springer-Verlag, 331345.CrossRefGoogle Scholar