Skip to main content
Log in

A backtracking algorithm for the stream AND-parallel execution of logic programs

  • Published:
International Journal of Parallel Programming Aims and scope Submit manuscript

Abstract

We present the first backtracking algorithm for stream AND-parallel logic programs. It relies on compile-time knowledge of the dataflow graph of each clause to let it figure out efficiently which goals to kill or restart when a goal fails. This crucial information, which we derive from mode declarations, was not available at compile-time in any previous stream AND-parallel system.

We show that modes can increase the precision of the backtracking algorithm, though our algorithm allows this precision to be traded off against overhead on a procedure-by-procedure and call-by-call basis. The modes also allow our algorithm to handle efficiently programs that manipulate partially instantiated data structures and an important class of programs with circular dependency graphs. On code that does not need backtracking, the efficiency of our algorithm approaches that of the committed-choice languages; on code that does need backtracking its overhead is comparable to that of the independent AND-parallel backtracking algorithms.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. R. Bahgat, Towards an Integrated Don’t-know Stream-and-parallel Logic Language, Research Report DOC 88/1, Department of Computing, Imperial College of Science and Technology, University of London, England, 59 pgs. (February 1988).

    Google Scholar 

  2. K. L. Clark and S. Gregory, Parlog and Prolog United,Proc. of the Fourth Intl. Conf. on Logic Programming, Melbourne, Australia, pp. 927–961 (May 1987).

  3. L. Naish, Parallelizing NU-Prolog,Proc. of the Fifth Intl. Conf./Symp. on Logic Programming, Seattle, Washington, pp. 1546–1564 (August 1988).

  4. M. Codish and E. Shapiro, Compiling OR-parallelism into AND-parallelism,Proc. of the Third Intl. Conf. on Logic Programming, London, England, pp. 283–297, (July 1986) published as Lecture Notes in Computer Science 225 by Springer-Verlag.

  5. K. Ueda, Making Exhaustive Search Programs Deterministic,Proc. of the Third Intl. Conf. on Logic Programming, London, England, pp. 270–282, (July 1986). Published as Lecture Notes in Computer Science 225 by Springer-Verlag.

  6. G. M. Weinberg, The Psychology of Computer Programming Van Nostrand Reinhold, New York 288 pgs. (1971).

    Google Scholar 

  7. R. Yang, and H. Aiso, P-Prolog: A Parallel Language Based on Exclusive Relation,Proc. of the Third Intl. Conf. on Logic Programming, London, England, pp. 255–269, (July 1986). Published as Lecture Notes in Computer Science 225 by Springer-Verlag.

  8. S. Haridi, and P. Brand, Andorra Prolog—An Integration of Prolog and Committed Choice Languages,Proc. of the 1988 Intl. Conf. on Fifth Generation Computer Systems, Tokyo, Japan, pp. 745–754. (December 1988).

  9. J. S. Conery, The AND/OR Process Model for Parallel Interpretation of Logic Programs, Ph. D. thesis, Department of Information and Computer Science, University of California, Irvine (June 1983).

    Google Scholar 

  10. J. S. Conery, Implementing Backward Execution, in Non-deterministic AND-parallel systems,Proc. of the Fourth Intl. Conf. on Logic Programming, Melbourne, Australia, pp. 633–653 (May 1987).

  11. Y. J. Lin, V. Kumar, and C. Leung, An Intelligent Backtracking Algorithm for Parallel Execution of Logic Programs,Proc. of the Third Intl. Conf. on Logic Programming, London, England, pp. 55–68, (July 1986). Published as Lecture Notes in Computer Science 225 by Springer-Verlag.

  12. N. S. Woo and K. M. Choe, Selecting the Backtrack Literal in the AND/OR Process Model,Proc. of the Third IEEE Symp. on Logic Programming, Salt Lake City, Utah, pp. 200–210 (September 1986).

  13. Z. Somogyi, A System of Precise Modes for Logic Programs,Proc. of the Fourth Intl. Conf. on Logic Programming, Melbourne, Australia, pp. 769–787 (May 1987).

  14. J. W. Lloyd, Foundations of Logic Programming (second, extended edition), Springer series in symbolic computation, Springer-Verlag, New York, 212 pgs. (1987).

    MATH  Google Scholar 

  15. J. W. Lloyd and R. W. Topor, Making Prolog More Expressive,J. of Logic Programming,1 (3) 225–240 (October 1984).

    Article  MathSciNet  MATH  Google Scholar 

  16. Z. Somogyi, Stability of Logic Programs: How to Connect Don’t-know Nondeterministic Logic Programs to the Outside World, Technical Report 87/11, Department of Computer Science, University of Melbourne, Melbourne, Australia, 26 pgs. (September 1987) (Revised November 1988).

    Google Scholar 

  17. W. Winsborough, Semantically Transparent Selective Reset for AND Parallel Interpreters Based on the Origin of Failures,Proc. of the Fourth IEEE Symp. on Logic Programming, San Francisco, California, pp. 134–152 (August 1987).

  18. J. L. Armstrong, N. A. Elshiewy, and R. Virding. The Phoning Philosopher’s Problem or Logic Programming for Telecommunication Applications,Proc. of the Third IEEE Symp. on Logic Programming, Salt Lake City, Utah, pp. 28–33. (September 1986).

  19. P. Borgwardt and D. Rea, Distributed Semi-intelligent Backtracking for a Stack-based AND-parallel Prolog,Proc. of the Third IEEE Symp. on Logic Programming, Salt Lake City, Utah, pp. 211–222 (September 1986).

  20. M. V. Hermenegildo, and R. I. Nasr, Efficient Management of Backtracking in AND-parallelism,Proc. of the Third Intl. Conf. on Logic Programming, London, England, pp. 40–54, (July 1986). Published as Lecture Notes in Computer Science 225 by Springer-Verlag.

  21. L. M. Pereira, L. Monteiro, J. Cunha, and J. N. Aparicio, Delta Prolog: A Distributed Backtracking Extension with Events,Proc. of the Third Intl Conf. on Logic Programming, London, England, pp. 69–83 (July 1986). Published as Lecture Notes in Computer Science 225 by Springer-Verlag.

  22. D. H. D. Warren, An Abstract Prolog Instruction Set, Technical Note 309,SRI International, Menlo Park, California, (October 1983).

  23. K. L. Clark and S. Gregory, PARLOG: Parallel Programming in Logic,ACM Transactions on Programming Languages and Systems,8(1) 1–49 (January 1986).

    Article  MATH  Google Scholar 

  24. J. A. Toh and K. Ramamohanarao, Failure Directed Backtracking, Technical Report 86/9, Department of Computer Science, University of Melbourne, Melbourne, Australia, 30 pgs. (1986).

    Google Scholar 

  25. L. M. Pereira and A. Porto, Selective Backtracking for Logic Programs,Proc. of the Fifth Conf. on Automated Deduction, Les Arcs, France, pp. 306–317 (1980). Published as Lecture Notes in Computer Science 87 by Springer-Verlag.

  26. V. Kumar, and Y. J. Lin, A Data-dependency-based Intelligent Backtracking Scheme for Prolog,J. of Logic Programming,5(2):165–181 (June 1988).

    Article  MathSciNet  MATH  Google Scholar 

  27. J. S. Conery and D. F. Kibler, AND Parallelism and Nondeterminism in Logic Programs,New Generation Computing,3(1):43–70 (1985).

    MATH  Google Scholar 

  28. C. S. Mellish, Some Global Optimisations for a Prolog Compiler,J. of Logic Programming,2(1):43–66 (April 1985).

    Article  MATH  Google Scholar 

  29. L. Naish, Automating Control of Logic Programs,J. of Logic Programming,2(3):167–183 (October 1985).

    Article  MATH  Google Scholar 

  30. M. Bruynooghe, Analysis of Dependencies to Improve the Behaviour of Logic Programs,Proc. of the Fifth Conf. on Automated Deduction, Les Arcs, France, pp. 293–305 (1980). Published as Lecture Notes in Computer Science 87 by Springer-Verlag.

  31. H. Tamaki and T. Sato, Unfold/fold Transformation of Logic Programs,Proc. of the Second Intl. Logic Programming Conf., Uppsala, Sweden, pp. 127–138. (July 1984).

  32. P. T. Cox, and T. Pietrzykowski, Deduction Plants: A Basis for Intelligent Backtracking,IEEE Transactions on Pattern Analysis and Machine Intelligence,3(1):52–65 (January 1981).

    Article  MATH  Google Scholar 

  33. D. DeGroot, Restricted AND-parallelism,Proc. of the 1984 Intl. Conference on Fifth Generation Computer Systems, Tokyo, Japan, pp. 471–478 (November 1984).

  34. J. H. Chang, A. M. Despain, and D. DeGroot, AND-parallelism of Logic Programs Based on a Static Data Dependency Analysis,Digest of Papers of the Thirtieth IEEE Computer Society Intl. Conf. (CompCon 85 Spring): Technological Leverage: a Competitive Necessity, San Francisco, California, pp. 218–226 (February 1985).

  35. J. Cleary, B. Unger and X. Li, A Distributed AND-parallel Backtracking Algorithm Using Virtual Time,Proc. of the 1988 Conf. on Distributed Simulation (part of Multi’88), San Diego, California, (February 1988).

  36. Y., J. Lin, and V. Kumar, A Parallel Execution Scheme for Exploiting AND-parallelism of Logic Programs,Proc. of the 1986 Intl. Conf. on Parallel Processing, University Park, Pennsylvania, p. 972–975 (August 1986).

  37. B. S. Fagin, and A. M. Despain, Goal Caching in Prolog,Proc. of the Nineteenth Annual Hawaii Intl. Conf. on System Sciences, Volume 1, Honolulu, Hawaii, pp. 277–281 (January 1986).

  38. S. W. Dietrich, Extension Tables: Memo Relations in Logic Programming,Proc. of the Fourth IEEE Symp. on Logic Programming, San Francisco, California, pp. 264–272 (August 1987).

  39. K. L. Clark and F. G. McCabe, The Conrol Facilities of IC-Prolog, in: D. Michie (ed.),Expert Systems in the Microelectronic Age, Edinburgh University Press, pp. 122–149 (1979).

  40. K. L. Clark and S. Gregory, A Relational Language for parallel Programming,Proc. of the 1981 Symp. on Functional Programming and Computer Architecture, Portsmouth, New Hampshire, pp. 171–178 (October 1981).

  41. E. Y. Shapiro and A. Takeuchi, Object Oriented Programming in Concurrent Prolog,New Generation Computing,1(1):25–48 (1983).

    Article  Google Scholar 

  42. J. Vaghani, Towards a Practical Intelligent Backtracking Scheme for Full Prolog, Honours report, Department of Computer Science, University of Melbourne, Melbourne, Australia, 25 pgs. (November 1987).

    Google Scholar 

  43. D. DeGroot, Restricted AND-parallelism and Side Effects,Proc. of the Fourth IEEE Symp on Logic Programming, San Francisco, California, pp. 80–89 (August 1987).

  44. P. Boizumault, General Model for Implementing DIF and FREEZE,Proc. of the Third Intl. Conf. on Logic Programming, London, England, pp. 585–592, (July 1986). Published as Lecture Notes in Computer Science 225 by Springer-Verlag.

  45. H. Matsumoto, A Static Analysis of Prolog Programs,SIGPLAN Notices 20(10):48–59 (October 1985).

    Article  Google Scholar 

  46. D. A. Patterson, Reduced Instruction Set Computers,Communications of the ACM,28:1:8–21 (January 1985).

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Somogyi, Z., Ramamohanarao, K. & Vaghani, J. A backtracking algorithm for the stream AND-parallel execution of logic programs. Int J Parallel Prog 17, 207–257 (1988). https://doi.org/10.1007/BF02427851

Download citation

  • Received:

  • Revised:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF02427851

Key Words

Navigation