Hostname: page-component-78c5997874-g7gxr Total loading time: 0 Render date: 2024-11-11T19:44:30.137Z Has data issue: false hasContentIssue false

Swapping evaluation: A memory-scalable solution for answer-on-demand tabling*

Published online by Cambridge University Press:  09 July 2010

PABLO CHICO DE GUZM'AN
Affiliation:
U. Politécnica de Madrid (e-mail: pchico@clip.dia.fi.upm.es)
MANUEL CARRO
Affiliation:
U. Politécnica de Madrid (e-mail: mcarro@fi.upm.es)
DAVID S. WARREN
Affiliation:
State University of New York at Stony Brook (e-mail: warren@cs.sunysb.edu)

Abstract

One of the differences among the various approaches to suspension-based tabled evaluation is the scheduling strategy. The two most popular strategies are local and batched evaluation. The former collects all the solutions to a tabled predicate before making any one of them available outside the tabled computation. The latter returns answers one by one before computing them all, which in principle is better if only one answer (or a subset of the answers) is desired. Batched evaluation is closer to SLD evaluation in that it computes solutions lazily as they are demanded, but it may need arbitrarily more memory than local evaluation, which is able to reclaim memory sooner. Some programs which in practice can be executed under the local strategy quickly run out of memory under batched evaluation. This has led to the general adoption of local evaluation at the expense of the more depth-first batched strategy. In this paper we study the reasons for the high memory consumption of batched evaluation and propose a new scheduling strategy which we have termed swapping evaluation. Swapping evaluation also returns answers one by one before completing a tabled call, but its memory usage can be orders of magnitude less than batched evaluation. An experimental implementation in the XSB system shows that swapping evaluation is a feasible memory-scalable strategy that need not compromise execution speed.

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2010

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

Ait-Kaci, H. 1991. Warren's Abstract Machine, A Tutorial Reconstruction. MIT Press.CrossRefGoogle Scholar
Chen, W. and Warren, D. S. 1996. Tabled evaluation with delaying for general logic programs. Journal of the ACM 43, 1 (January), 2074.Google Scholar
Codish, M., Demoen, B., and Sagonas, K. F. 1998. Semantics-based program analysis for logic-based languages using XSB. STTT 2, 1, 2945.Google Scholar
Dawson, S., Ramakrishnan, C. R., and Warren, D. S. 1996. Practical program analysis using general purpose logic programming systems – A case study. In Proceedings of PLDI'96. ACM Press, New York, USA, 117126.CrossRefGoogle Scholar
Freire, J., Swift, T., and Warren, D. S. 2001. Beyond depth-first: Improving tabled logic programs through alternative scheduling strategies. In International Symposium on Programming Language Implementation and Logic Programming. Lecture Notes in Computer Science, vol. 1140. Springer, 243258.Google Scholar
Hermenegildo, M. and Nasr, R. I. 1986. Efficient management of backtracking in and-parallelism. In Third International Conference on Logic Programming. Lecture Notes in Computer Science, vol. 225. Imperial College, Springer, 4055.Google Scholar
Ramakrishna, Y., Ramakrishnan, C., Ramakrishnan, I., Smolka, S., Swift, T., and Warren, D. 1997. Efficient model checking using tabled resolution. In Computer Aided Verification. Lecture Notes in Computer Science, vol. 1254. Springer, 143154.Google Scholar
Ramakrishnan, R. and Ullman, J. D. 1993. A survey of research on deductive database systems. Journal of Logic Programming 23, 2, 125149.Google Scholar
Rocha, R., Silva, F. M. A., and Costa, V. S. 2005. Dynamic mixed-strategy evaluation of tabled logic programs. In ICLP. Lecture Notes in Computer Science, vol. 3668. Springer, 250264.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 (May), 586634.Google Scholar
Sagonas, K., Swift, T., and Warren, D. 1993. The XSB programming system. In ILPS Workshop on Programming with Logic Databases. Number TR #1183. University of Wisconsin, 164–164.Google Scholar
Sagonas, K. F. and Stuckey, P. J. 2004. Just enough tabling. In Principles and Practice of Declarative Programming. ACM, 7889.Google Scholar
Tamaki, H. and Sato, M. 1986. OLD resolution with tabulation. In Int'l. Conf. on Logic Programming. Lecture Notes in Computer Science. Springer, 8498.Google Scholar
Tarjan, R. 1972. Depth-first search and linear graph algorithms. SIAM Journal Computing 1, 140160.Google Scholar
Warren, D. S. 1992. Memoing for logic programs. Communications of the ACM 35, 3, 93111.CrossRefGoogle Scholar
Warren, R., Hermenegildo, M., and Debray, S. K. 1988. On the practicality of global flow analysis of logic programs. In Fifth International Conference and Symposium on Logic Programming. MIT Press, 684699.Google Scholar
Zou, Y., Finin, T., and Chen, H. 2005. F-OWL: An inference engine for semantic web. In Formal Approaches to Agent-Based Systems. Lecture Notes in Computer Science, vol. 3228. Springer, 238248.Google Scholar