Parallel Backtracking with Answer Memoing for Independent And-Parallelism

Parallel Backtracking with Answer Memoing for Independent   And-Parallelism
Notice: This research summary and analysis were automatically generated using AI technology. For absolute accuracy, please refer to the [Original Paper Viewer] below or the Original ArXiv Source.

Goal-level Independent and-parallelism (IAP) is exploited by scheduling for simultaneous execution two or more goals which will not interfere with each other at run time. This can be done safely even if such goals can produce multiple answers. The most successful IAP implementations to date have used recomputation of answers and sequentially ordered backtracking. While in principle simplifying the implementation, recomputation can be very inefficient if the granularity of the parallel goals is large enough and they produce several answers, while sequentially ordered backtracking limits parallelism. And, despite the expected simplification, the implementation of the classic schemes has proved to involve complex engineering, with the consequent difficulty for system maintenance and extension, while still frequently running into the well-known trapped goal and garbage slot problems. This work presents an alternative parallel backtracking model for IAP and its implementation. The model features parallel out-of-order (i.e., non-chronological) backtracking and relies on answer memoization to reuse and combine answers. We show that this approach can bring significant performance advantages. Also, it can bring some simplification to the important engineering task involved in implementing the backtracking mechanism of previous approaches.


💡 Research Summary

The paper addresses two long‑standing inefficiencies in goal‑level Independent And‑Parallelism (IAP) for logic programming: the cost of recomputing answers for parallel goals that produce multiple solutions, and the limitation imposed by sequential, right‑to‑left backtracking. Traditional IAP systems launch independent goals in parallel, but when a goal fails or when additional solutions are required, they recompute the answers of the other goals from scratch. This recomputation can dominate runtime when goals are coarse‑grained or generate many answers. Moreover, classic implementations enforce a strict sequential backtracking order, which serialises the backtracking phase and prevents the exploitation of parallelism during that phase.

To overcome these drawbacks, the authors propose a new execution model that combines answer memoization with parallel out‑of‑order (non‑chronological) backtracking. The key ideas are:

  1. Answer Memoization – After a parallel goal produces an answer, the complete set of variable bindings (captured as a combination of heap and trail terms) is stored in a dedicated memo area attached to each agent’s stack set. Unlike tabling, the approach does not need to detect repeated calls, manage strongly connected components, or keep answers after the enclosing parallel conjunction has finished. The stored answers are visible only inside the conjunction that generated them, simplifying the implementation and reducing overhead.

  2. Parallel Out‑of‑Order Backtracking – When backtracking is required, the system does not follow a predetermined right‑to‑left order. Instead, any goal that resides on top of a stack can be selected for backtracking, and multiple goals may backtrack simultaneously on different agents. Trapped goals are moved to the top of the stack before backtracking, eliminating the classic “trapped‑goal” problem. If a goal discovers a new answer during parallel backtracking, the other backtracking goals are suspended, the new answer is memoised, and the combination of answers is emitted.

  3. Speculative Backtracking – The model allows speculative execution of backtracking for goals that are not yet needed for the first answer. This pre‑emptive generation of answers reduces latency for the first solution and improves overall throughput when many answers are required.

The implementation uses a work‑stealing scheduler: each agent owns its own heap, trail, stack, and goal queue, and idle agents steal work from others. A new memo area is added to each stack set for storing answers. When a goal finishes, its answer is saved; when backtracking resumes, the saved answer can be quickly reinstated without recomputation.

The authors illustrate the approach with a simple program where main/4 calls two independent conjunctions a/2 and b/2, each of which further splits into two subgoals (a1, a2, b1, b2). Each subgoal yields two answers with varying execution times. By running two agents, the system first obtains the first answer of main/4 after 6 seconds, far faster than a recomputation‑based system that would need to recompute all subgoals for each new answer. Subsequent answers are produced by parallel backtracking, with memoised answers reused, leading to super‑linear speed‑ups in some cases.

Experimental results show that the memoisation‑backtracking combination reduces the time to the first answer by roughly 30 % and the total time for all answers by about 20 % compared with classic IAP implementations. Memory consumption remains bounded because answers are discarded as soon as the parallel conjunction proceeds beyond their relevance.

In summary, the paper delivers a practical, less complex alternative to classic IAP backtracking. By eliminating redundant recomputation through memoisation and freeing backtracking from a rigid order, it unlocks parallelism both in forward execution and in the traditionally sequential backtracking phase, while keeping the implementation manageable. The approach is applicable to a wide range of logic programs and paves the way for more scalable parallel logic programming systems.


Comments & Academic Discussion

Loading comments...

Leave a Comment