سؤال

In the introduction to The Art of Prolog, Sterling and Shapiro defer a discussion of parallelism, concurrency, and logic programming to another book. My question is whether there is such a resource:

[the] promise of parallel computers, combined with the parallelism that seems to be available in the logic programming model, have lead to numerous attempts, which are still ongoing, to execute Prolog in parallel, and to devise novel concurrent programming languages based on the logic programming computation model. This, however, is a subject for another book (The Art of Prolog, p. xx).

Searching on Google, I found a parallel implementation of Prolog and concurrency libraries for Mercury, in addition to hundreds of research papers and dissertations. But it's harder to locate resources on the second part of the paragraph, about concurrent programming and programming languages based on the execution models of logic programming languages. Is there a good resource on these topics? I'm particularly interested in references on compiling and writing parallel and concurrent logic programs.

هل كانت مفيدة؟

المحلول

In Prolog you can have both non-determinism and concurrency. Non-determinsim is what is usually described as unification and backtracking. You can imagine that a Prolog clause is full of implicit amb statements. It is less known that concurrency is also supported by logic-programming.

But today we might just go with treads inside logic programming. Here is an example to implement a findall via threads. This can also be modded to perform all kinds of tasks on the collection, or maybe even produce agent networks towards distributed artificial intelligence.

There is a even a proposal for a set of ISO standard predicates that support threading inside Prolog. These predicates also cover synchronization and queueing primitives. But more important, light weighted Prolog based web servers wouldn't work, there werent multi-threaded Prolog systems around:

ISO/IEC DTR 13211–5:2007 Prolog multi-threading support
http://logtalk.org/plstd/threads.pdf

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top