High Level Thread-Based Competitive Or-Parallelism in Logtalk

  • Paulo Moura
  • Ricardo Rocha
  • Sara C. Madeira
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5418)


This paper presents the logic programming concept of thread-based competitive or-parallelism, which combines the original idea of competitive or-parallelism with committed-choice nondeterminism and speculative threading. In thread-based competitive or-parallelism, an explicit disjunction of subgoals is interpreted as a set of concurrent alternatives, each running in its own thread. The individual subgoals usually correspond to predicates implementing different procedures that, depending on the problem specifics, are expected to either fail or succeed with different performance levels. The subgoals compete for providing an answer and the first successful subgoal leads to the termination of the remaining ones. We discuss the implementation of thread-based competitive or-parallelism in the context of Logtalk, an object-oriented logic programming language, and present experimental results.


Or-parallelism speculative threading implementation 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Gupta, G., Pontelli, E., Ali, K., Carlsson, M., Hermenegildo, M.V.: Parallel Execution of Prolog Programs: A Survey. ACM Transactions on Programming Languages and Systems 23, 472–602 (2001)CrossRefGoogle Scholar
  2. 2.
    Ertel, W.: Performance Analysis of Competitive Or-Parallel Theorem Proving. Technical report fki-162-91, Technische Universität München (1991)Google Scholar
  3. 3.
    Shapiro, E.: The Family of Concurrent Logic Programming Languages. ACM Computing Surveys 21, 413–510 (1989)CrossRefGoogle Scholar
  4. 4.
    González, A.: Speculative Threading: Creating New Methods of Thread-Level Parallelization. Technology@Intel Magazine (2005)Google Scholar
  5. 5.
    Moura, P.: (ISO/IEC DTR 13211–5:2007 Prolog Multi-threading Support),
  6. 6.
    Moura, P.: Logtalk – Design of an Object-Oriented Logic Programming Language. PhD thesis, Department of Computer Science, University of Beira Interior (2003)Google Scholar
  7. 7.
    Ali, K., Karlsson, R.: The Muse Approach to OR-Parallel Prolog. International Journal of Parallel Programming 19, 129–162 (1990)MathSciNetCrossRefGoogle Scholar
  8. 8.
    Rocha, R., Silva, F., Santos Costa, V.: YapOr: an Or-Parallel Prolog System Based on Environment Copying. In: Barahona, P., Alferes, J.J. (eds.) EPIA 1999. LNCS (LNAI), vol. 1695, pp. 178–192. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  9. 9.
    Lusk, E., Butler, R., Disz, T., Olson, R., Overbeek, R., Stevens, R., Warren, D.H.D., Calderwood, A., Szeredi, P., Haridi, S., Brand, P., Carlsson, M., Ciepielewski, A., Hausman, B.: The Aurora Or-Parallel Prolog System. In: International Conference on Fifth Generation Computer Systems, Institute for New Generation Computer Technology, pp. 819–830 (1988)Google Scholar
  10. 10.
    Calderwood, A., Szeredi, P.: Scheduling Or-parallelism in Aurora – the Manchester Scheduler. In: International Conference on Logic Programming, pp. 419–435. MIT Press, Cambridge (1989)Google Scholar
  11. 11.
    Ali, K., Karlsson, R.: Full Prolog and Scheduling OR-Parallelism in Muse. International Journal of Parallel Programming 19, 445–475 (1990)CrossRefGoogle Scholar
  12. 12.
    Beaumont, A., Raman, S., Szeredi, P., Warren, D.H.D.: Flexible Scheduling of OR-Parallelism in Aurora: The Bristol Scheduler. In: Aarts, E.H.L., van Leeuwen, J., Rem, M. (eds.) PARLE 1991. LNCS, vol. 506, pp. 403–420. Springer, Heidelberg (1991)CrossRefGoogle Scholar
  13. 13.
    Sindaha, R.: Branch-Level Scheduling in Aurora: The Dharma Scheduler. In: International Logic Programming Symposium, pp. 403–419. MIT Press, Cambridge (1993)Google Scholar
  14. 14.
    Ciepielewski, A.: Scheduling in Or-parallel Prolog Systems: Survey and Open Problems. International Journal of Parallel Programming 20, 421–451 (1991)CrossRefGoogle Scholar
  15. 15.
    Ali, K., Karlsson, R.: Scheduling Speculative Work in MUSE and Performance Results. International Journal of Parallel Programming 21, 449–476 (1992)CrossRefzbMATHGoogle Scholar
  16. 16.
    Beaumont, A., Warren, D.H.D.: Scheduling Speculative Work in Or-Parallel Prolog Systems. In: International Conference on Logic Programming, pp. 135–149. MIT Press, Cambridge (1993)Google Scholar
  17. 17.
    Moura, P.: (Logtalk),
  18. 18.
    Pfaff, T.J., Tran, M.M.: The generalized jug problem. Journal of Recreational Mathematics 31, 100–103 (2003)Google Scholar
  19. 19.
    Boldi, P., Santini, M., Vigna, S.: Measuring with jugs. Theoretical Computer Science 282, 259–270 (2002)MathSciNetCrossRefzbMATHGoogle Scholar
  20. 20.
    Berger, E.D., Mckinley, K.S., Blumofe, R.D., Wilson, P.R.: Hoard: A scalable memory allocator for multithreaded applications. In: International Conference on Architectural Support for Programming Languages and Operating Systems, pp. 117–128 (2000)Google Scholar
  21. 21.
    Tamaki, H., Sato, T.: OLDT Resolution with Tabulation. In: Shapiro, E. (ed.) ICLP 1986. LNCS, vol. 225, pp. 84–98. Springer, Heidelberg (1986)CrossRefGoogle Scholar
  22. 22.
    Chen, W., Warren, D.S.: Tabled Evaluation with Delaying for General Logic Programs. Journal of the ACM 43, 20–74 (1996)MathSciNetCrossRefzbMATHGoogle Scholar
  23. 23.
    Chico de Guzmán, P., Carro, M., Hermenegildo, M.V., Silva, C., Rocha, R.: An Improved Continuation Call-Based Implementation of Tabling. In: Hudak, P., Warren, D.S. (eds.) PADL 2008. LNCS, vol. 4902, pp. 197–213. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  24. 24.
    Marques, R.: Concurrent Tabling: Algorithms and Implementation. PhD thesis, Department of Computer Science, New University of Lisbon (2007)Google Scholar
  25. 25.
    Marques, R., Swift, T., Cunha, J.: Extending tabled logic programming with multi-threading: A systems perspective (2008),
  26. 26.
    Bueno, F., Cabeza, D., Carro, M., Hermenegildo, M.V., López, P., Puebla, G.: (Ciao Prolog System Manual),
  27. 27.
    Madeira, S.C., Oliveira, A.L.: Biclustering algorithms for biological data analysis: a survey. IEEE/ACM Transactions on Computational Biology and Bioinformatics 1, 24–45 (2004)CrossRefGoogle Scholar
  28. 28.
    Mechelen, I.V., Bock, H.H., Boeck, P.D.: Two-mode clustering methods: a structured overview. Statistical Methods in Medical Research 13, 979–981 (2004)MathSciNetzbMATHGoogle Scholar
  29. 29.
    Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 2nd edn. The MIT Electrical Engineering and Computer Science Series. MIT Press, Cambridge (2001)zbMATHGoogle Scholar
  30. 30.
    Hastie, T., Tibshirani, R., Friedman, J.: The Elements of Statistical Learning. Data Mining, Inference and Prediction. Springer Series in Statistics (2001)Google Scholar
  31. 31.
    Moura, P., Crocker, P., Nunes, P.: High-Level Multi-threading Programming in Logtalk. In: Hudak, P., Warren, D.S. (eds.) PADL 2008. LNCS, vol. 4902, pp. 265–281. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  32. 32.
    Moura, P., Rocha, R., Madeira, S.C.: Thread-Based Competitive Or-Parallelism. In: Garcia de la Banda, M., Pontelli, E. (eds.) ICLP 2008. LNCS, vol. 5366, pp. 713–717. Springer, Heidelberg (2008)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2008

Authors and Affiliations

  • Paulo Moura
    • 1
    • 3
  • Ricardo Rocha
    • 2
    • 3
  • Sara C. Madeira
    • 1
    • 4
  1. 1.Dep. of Computer ScienceUniversity of Beira InteriorPortugal
  2. 2.Dep. of Computer ScienceUniversity of PortoPortugal
  3. 3.Center for Research in Advanced Computing SystemsINESC–PortoPortugal
  4. 4.Knowledge Discovery and Bioinformatics GroupINESC–IDPortugal

Personalised recommendations