High-Level Multi-threading Programming in Logtalk

  • Paulo Moura
  • Paul Crocker
  • Paulo Nunes
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4902)


Logtalk, an object oriented logic programming language, provides experimental support for multi-threading programming with selected back-end Prolog compilers. By making use of core, low-level Prolog predicates that interface with operating-system native threads, Logtalk provides a high-level set of directives and predicates that allows programmers to easily take advantage of modern multi-processor and multi-core computers without worrying about the details of creating, synchronizing, or communicating with threads. Logtalk multi-threading programming features include support for concurrent calls akin to and-parallelism and or-parallelism, non-deterministic thread goals, asynchronous calls, and predicate synchronization. The integration with the Logtalk object-oriented features allows objects to send and receive both synchronous and asynchronous messages and to call local predicates concurrently. Logtalk multi-threading features are orthogonal to object-oriented concepts and can be useful even in the context of plain Prolog.


logic-programming concurrency threads 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    ISO/IEC. International Standard ISO/IEC 9945-1:1996. Information Technology–Portable Operating System Interface (POSIX)–Part 1: System Application: Program Interface (API). ISO/IEC (1996)Google Scholar
  2. 2.
    Butenhof, D.R.: Programming with POSIX Threads. Professional Computing Series. Addison-Wesley, Reading (1997)Google Scholar
  3. 3.
    Chandra, R., Dagum, L., Kohr, D., Maydan, D., McDonald, J., Menon, R.: Parallel Programming in OpenMP. Morgan Kaufmann Publishers, Los Altos, CA 94022, USA (2001)Google Scholar
  4. 4.
    OpenMP: Simple, Portable, Scalable SMP Programming,
  5. 5.
    Intel Threading Building Blocks,
  6. 6.
    Gupta, G., Pontelli, E., Ali, K., Carlsson, M., Hermenegildo, M.: Parallel Execution of Prolog Programs: A Survey. ACM Transactions on Programming Languages and Systems 23(4), 472602 (2001)CrossRefGoogle Scholar
  7. 7.
    Costa, V.S., Warren, D.H.D., Yang, R.: Andorra-I: A Parallel Prolog System that Transparently Exploits both And- and Or-Parallelism. SIGPLAN Not. 26(7), 83–93 (1991)CrossRefGoogle Scholar
  8. 8.
    Ali, K., Karlsson, R.: The Muse Or-parallel Prolog model and its performance. In: Proceedings of the 1990 North American conference on Logic programming, pp. 757–776. MIT Press, Cambridge (1990)Google Scholar
  9. 9.
    Moura, P.: Logtalk – Design of an Object-Oriented Logic Programming Language. PhD thesis, Department of Computer Science, University of Beira Interior, Portugal (September 2003)Google Scholar
  10. 10.
    Moura, P.: Logtalk web site,
  11. 11.
    Moura, P., Marchetti, V.: Logtalk Processing of STEP Part 21 Files. In: Etalle, S., Truszczyński, M. (eds.) ICLP 2006. LNCS, vol. 4079, pp. 453–454. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  12. 12.
    Wielemaker, J.: Native preemptive threads in SWI-Prolog. In: Palamidessi, C. (ed.) ICLP 2003. LNCS, vol. 2916, pp. 331–345. Springer, Heidelberg (2003)Google Scholar
  13. 13.
    Costa, V.S.: YAP Home Page,
  14. 14.
    Clark, K.L., Robinson, P., Hagen, R.: Multi-threading and Message Communication in Qu-Prolog. Theory and Practice of Logic Programming 1(3), 283–301 (2001)zbMATHCrossRefGoogle Scholar
  15. 15.
  16. 16.
    Tarau, P.: BinProlog 2006 11.x Professional Edition – Advanced BinProlog Programming and Extensions Guide (2006)Google Scholar
  17. 17.
    Tarau, P.: BinNet Corporation. BinProlog Home Page,
  18. 18.
    The XSB Research Group. The XSB Programmer’s Manual: version 3.1 (2007)Google Scholar
  19. 19.
    The XSB Research Group. XSB Home Page,
  20. 20.
    Carro, M., Hermenegildo, M.: Concurrency in Prolog Using Threads and a Shared Database. In: International Conference on Logic Programming, pp. 320–334 (1999)Google Scholar
  21. 21.
    Moura, P.(ed.): ISO/IEC DTR 132115:2007 Prolog Multi-threading predicates,
  22. 22.
    Hermenegildo, M.V., Rossi, F.: Strict and Nonstrict Independent And-Parallelism in Logic Programs: Correctness, Efficiency, and Compile-Time Conditions. Journal of Logic Programming 22(1), 1–45 (1995)zbMATHCrossRefMathSciNetGoogle Scholar
  23. 23.
    González, A.: Speculative Threading: Creating New Methods of Thread-Level Parallelization (December 2005),
  24. 24.
    Wikipedia: Dining philosophers problem,
  25. 25.
    Eskilson, J., Carlsson, M.: SICStus MT—A Multithreaded Execution Environment for SICStus Prolog. In: Palamidessi, C., Glaser, H., Meinke, K. (eds.) ALP 1998 and PLILP 1998. LNCS, vol. 1490, pp. 36–53. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  26. 26.
    Hedqvist, P.: A Parallel and Multithreaded Erlang Implementation. Master’s thesis, Uppsala University, Uppsala, Sweden (June 1998)Google Scholar
  27. 27.
    Erlang Home Page,
  28. 28.
    Hodgson, J.: ISO/IEC/ JTC1/SC22/WG17 Official Home Page,

Copyright information

© Springer-Verlag Berlin Heidelberg 2007

Authors and Affiliations

  • Paulo Moura
    • 1
  • Paul Crocker
    • 1
  • Paulo Nunes
    • 2
  1. 1.Dep. of Computer ScienceUniversity of Beira InteriorCovilhPortugal
  2. 2.Polytechnic Institute of Guarda, 6301-559 GuardaPortugal

Personalised recommendations