390 research outputs found
Tabling as a Library with Delimited Control
Tabling is probably the most widely studied extension of Prolog. But despite
its importance and practicality, tabling is not implemented by most Prolog
systems. Existing approaches require substantial changes to the Prolog engine,
which is an investment out of reach of most systems. To enable more widespread
adoption, we present a new implementation of tabling in under 600 lines of
Prolog code. Our lightweight approach relies on delimited control and provides
reasonable performance.Comment: 15 pages. To appear in Theory and Practice of Logic Programming
(TPLP), Proceedings of ICLP 201
Algorithms and Implementation
In the past few years Tabling has emerged as a powerful logic programming model.
The integration of concurrent features into the implementation of Tabling systems is
demanded by need to use recently developed tabling applications within distributed
systems, where a process has to respond concurrently to several requests. The support
for sharing of tables among the concurrent threads of a Tabling process is a desirable
feature, to allow one of Tabling’s virtues, the re-use of computations by other threads
and to allow efficient usage of available memory. However, the incremental completion
of tables which are evaluated concurrently is not a trivial problem.
In this dissertation we describe the integration of concurrency mechanisms, by the
way of multi-threading, in a state of the art Tabling and Prolog system, XSB. We begin
by reviewing the main concepts for a formal description of tabled computations,
called SLG resolution and for the implementation of Tabling under the SLG-WAM, the
abstract machine supported by XSB. We describe the different scheduling strategies
provided by XSB and introduce some new properties of local scheduling, a scheduling
strategy for SLG resolution.
We proceed to describe our implementation work by describing the process of integrating
multi-threading in a Prolog system supporting Tabling, without addressing
the problem of shared tables. We describe the trade-offs and implementation decisions
involved.
We then describe an optimistic algorithm for the concurrent sharing of completed
tables, Shared Completed Tables, which allows the sharing of tables without incurring
in deadlocks, under local scheduling. This method relies on the execution properties
of local scheduling and includes full support for negation. We provide a theoretical
framework and discuss the implementation’s correctness and complexity.
After that, we describe amethod for the sharing of tables among threads that allows
parallelism in the computation of inter-dependent subgoals, which we name Concurrent
Completion. We informally argue for the correctness of Concurrent Completion.
We give detailed performance measurements of the multi-threaded XSB systems
over a variety of machines and operating systems, for both the Shared Completed Tables
and the Concurrent Completion implementations. We focus our measurements inthe overhead over the sequential engine and the scalability of the system.
We finish with a comparison of XSB with other multi-threaded Prolog systems and we compare our approach to concurrent tabling with parallel and distributed methods for the evaluation of tabling. Finally, we identify future research directions
Parallelizing tabled evaluations
AbstractSLG is a table-oriented resolution method that extends SLD evaluation in two ways. It computes the well-founded model for logic programs with negation with polynomial data complexity,and it terminates for programs with the bounded-term-size property. Furthermore SLG has an efficient sequential implementation for modularly stratified programs in the SLG-WAM of XSB. This paper addresses general issues involved in parallelizing tabled evaluations by introducing a model of shared-memory parallelism which we call table parallelism and by comparing it to traditional models of parallelizing SLD. A basic architecture for supporting table parallelism in the framework of the SLG-WAM is also presented, along with an algorithm for detecting termination of subcomputations
- …