40 research outputs found

    On Extending a Linear Tabling Framework to Support Batched Scheduling

    Get PDF
    Tabled evaluation is a recognized and powerful technique that overcomes some limitations of traditional Prolog systems in dealing with recursion and redundant sub-computations. During tabled execution, several decisions have to be made. These are determined by the scheduling strategy. Whereas a strategy can achieve very good performance for certain applications, for others it might add overheads and even lead to unacceptable inefficiency. The two most successful tabling scheduling strategies are local scheduling and batched scheduling. In previous work, we have developed a framework, on top of the Yap system, that supports the combination of different linear tabling strategies for local scheduling. In this work, we propose the extension of our framework, to support batched scheduling. In particular, we are interested in the two most successful linear tabling strategies, the DRA and DRE strategies. To the best of our knowledge, no single tabling Prolog system supports both strategies simultaneously for batched scheduling

    Beyond depth-first strategies: improving tabled logic programs through alternative scheduling

    Get PDF
    Journal ArticleTabled evaluation ensures termination for programs with finite models by keeping track of which subgoals have been called. Given several variant subgoals in an evaluation, only the fi rst one encountered will use program-clause resolution; the rest will resolve with the answers generated by the first subgoal. This use of answer resolution prevents infi nite looping that sometimes happens in SLD. Because answers that are produced in one path of the computation may be consumed, asynchronously, in others, tabling systems face an important scheduling choice not present in traditional top-down evaluation: when to schedule answer resolution. This paper investigates alternate scheduling strategies for tabling in a WAM implementation, the SLG-WAM. The original SLG-WAM had a simple mechanism for scheduling answer resolution that was expensive in terms of trailing and choice-point creation. We propose here a more sophisticated scheduling strategy, batched scheduling, which reduces the overheads of these operations and provides dramatic space reduction as well as speedups for many programs. We also propose a second strategy, local scheduling, which has applications to nonmonotonic reasoning, and when combined with answer subsumption, can arbitrarily improve the performance of some programs

    Beyond depth-first: improving tabled logic programs through alternative scheduling strategies

    Get PDF
    Journal ArticleTabled evaluations ensure termination of logic programs with fi nite models by keeping track of which subgoals have been called Given several variant subgoals in an evaluation, only the fi rst one encountered will use program clause resolution the rest uses answer resolution This use of answer resolution prevents infi nite looping which happens in SLD Given the asynchronicity of answer generation and answer return, tabling systems face an important scheduling choice not present in traditional top-down evaluation How does the order of returning answers to consuming subgoals affect program efficiency This paper investigates alternate scheduling strategies for tabling in a WAM implementation, the SLG-WAM. The original SLG-WAM had a simple mechanism of scheduling answers to be returned to callers which was expensive in terms of trailing and choice point creation We propose here a more sophisticated scheduling strategy, Batched Scheduling, which reduces the overheads of these operations and provides dramatic space reduction as well as speedups for many programs We also propose a second strategy, Local Scheduling, which has applications to non-monotonic reasoning and when combined with answer subsumption can improve the performance of some programs by arbitrary amounts

    Algorithms and Implementation

    Get PDF
    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

    On Applying Linear Tabling to Logic Programs

    Get PDF
    As linguagens de Programação em Lógica que derivam da lógica de Horn, tal como oProlog, têm mecanismos de resolução baseados em inferência que são bastante conhecidos.Embora o Prolog seja uma linguagem com bastante sucesso, o seu potencial é limitadopelo seu mecanismo de resolucão, que é baseado na resolucão SLD. O mecanismode resolução SLD foi provado ser bastante ineficiente quando avalia programas logicosque têm ciclos infinitos ou sub-computações redundantes. A tabulacão é uma técnicade implementação bastante reconhecida e poderosa que permite ultrapassar essaslimitações em sistemas de Prolog que são baseados na resolução SLD. Actualmente,a técnica de tabulação pode ser dividida em dois grandes mecanismos: por suspensãodas pilhas de execução e por execução linear. Os mecanismos por suspensão daspilhas de execução são considerados terem melhores resultados, no entanto eles têmmais requisitos em termos de memória e são mais complexos de implementar do queos mecanismos lineares.O trabalho apresentado nesta tese pretende fazer um estudo aprofundado sobre osmecanismos de tabulação linear, de forma a perceber como as diferentes estratégiasde tabulação afectam o fluxo de avaliação de um programa lógico e melhoram a performancegeral do sistema. As estratégias SLDT e DRA são duas das mais conhecidase bem sucedidas estratégias implementadas em sistemas de tabulação linear. Nestetrabalho, propomos uma nova estratégia, que foi denominada de DRS, e apresentamosuma plataforma integrada, que suporta a combinação das três estratégias. A nossaimplementação partilha o ambiente de execução e a maioria das estructuras de dadosusadas pela máquina de execução do YapTab, que é o actual mecanismo de tabulaçãobaseado em suspensão de pilhas do sistema Yap Prolog. A combinação de todasas estratégias e mecanismos na nossa plataforma permitiu-nos fazer uma primeiracomparação justa entre todas as estratégias lineares, usadas sozinhas ou combinadas,e o mecanismo original do YapTab, de forma a perceber as vantagens e desvantagens decada um. Os resultados obtidos, confirmam que os mecanismos baseados em suspensão têm, no geral, melhores resultados do que os mecanismos lineares, sendo que a diferençaentre os resultados de ambos os sistemas pode ser em grande parte reduzida atravésda combinação correcta das melhores estratégias lineares.Logic programming languages, such as Prolog, are derived from Horn Clause Logicand provide a well understood resolution based inference mechanism. Although Prologis a popular and successful language, its potential is limited by the SLD resolutionmethod on which it is based. SLD resolution was proven to be inecient whendealing with innite loops and redundant subcomputations. Tabled evaluation isa recognized and powerful technique that overcomes those limitations on traditionalProlog systems based on SLD resolution. We can distinguish two main categoriesof tabling mechanisms: suspension-based tabling and linear-based tabling. Whilesuspension-based mechanisms are considered to obtain better results in general, theyhave more memory space requirements and are more complex and hard to implementthan linear tabling mechanisms.The work presented on this thesis was focused on making a deep study about lineartabling, in order to understand how dierent linear tabling strategies can aect theevaluation ow of tabled programs and improve its overall performance. Arguably,the SLDT and DRA strategies are the two most successful extensions to standardlinear tabled evaluation. In this work, we propose a new strategy, named DRS, andwe present a framework, on top of the Yap system, that supports the combinationof all these three linear tabling strategies. Our implementation shares the underlyingexecution environment and most of the data structures used to implement tablingin the YapTab engine, which is the actual suspension-based tabling mechanism ofthe Yap Prolog system. All these common features allows us to make a rst andfair comparison between the linear tabling strategies, used solely or combined withthe other, and YapTab's suspension-based mechanism, in order to better understandthe advantages and weaknesses of each feature. The obtained results conrmed thatsuspension-based mechanisms have, in general, better performance than linear tablingand that the dierence between both mechanisms can be highly reduced by using thecorrect combination of linear tabling strategies

    Supporting pruning in tabled LP

    Get PDF
    This paper analyzes issues which appear when supporting pruning operators in tabled LP. A version of the once/1 control predicate tailored for tabled predicates is presented, and an implementation analyzed and evaluated. Using once/1 with answer-on-demand strategies makes it possible to avoid computing unneeded solutions for problems which can benefit from tabled LP but in which only a single solution is needed, such as model checking and planning. The proposed version of once/1 is also directly applicable to the efficient implementation of other optimizations, such as early completion, cut-fail loops (to, e.g., prune at the top level), if-then-else, and constraint-based branch-and-bound optimization. Although once/1 still presents open issues such as dependencies of tabled solutions on program history, our experimental evaluation confirms that it provides an arbitrarily large efficiency improvement in several application areas
    corecore