From: bokkie@uctvax.uct.ac.za
Newsgroups: comp.lang.prolog
Subject: Re: PARLOG
Date: 16 Apr 92 10:52:21 +0200
Organization: University of Cape Town

The following was posted by me some days ago:
>>I teach courses in Cognitive Science and Cognitive Psychology to
>>undergrads and graduates...
>>PARLOG, instead of PROLOG, seems a fine medium for such exercises because 
>>the parallel pursuit of goals is a more intuitively satisfactory model of 
>>human coginition for use in such courses.

There were two replies to this.  

The first from BURT@DFKI.UNI-KL.DE concurred that PARLOG "is 
an elegant language with few basic constructs that provides an 
easy introduction to a concurrent reactive style of programming". 

The second reply from JAMIE@CS.SFU.CA is quoted below.  This one 
prompted me to go and dig up Steve Gregory's book _Parallel Logic 
Programming in PARLOG_ before I could give an intelligent response: 

>                I believe (correct me if I'm wrong) that
>Parlog is not completely "parallel" in the sense of "trying to
>search all branches in the search tree simultaneously".
>I believe that it is parallel up to a certain number of branches
>(number of processors? predefined limit?), but beyond that it
>behaves much like a depth-first interpreter, exploring a branch
>iff there is a processor available.  Thus it can get stuck in
>loops that a true breadth-first interpreter cannot get stuck in.

Perhaps I'm naive on this, (I have never used PARLOG) but I read
in Gregory that in the extreme case of a single-processor machine
implementation of PARLOG, and when there are several processes 
to be evaluated in parallel, then these are evaluated by some 
time-sharing mechanism. Thus, as I understand it, from the user's 
point of view PARLOG is transparent regarding the number of 
physical processors.

Regarding the physical implementation, Gregory states that
"a depth-first scheduling strategy is always used. That is,
if several processes are to be evaluated in parallel, they are 
actually evaluated one at a time, in textual order. (...) if
a process suspends, control continues with the next process to 
the right (...) To avoid problems caused by a non-terminating
process (*i.e. loop - my comment*), the current process can be
scheduled (i.e. placed on the runnable list) at any time, and
another process on the runnable list made current".  This sounds
like PARLOG will do a true breadth-first search even when there
is only one processor available to do it.  (Don't ask about 
speed of execution relative to a multi-processor machine.)

>
>     The second comment is that I agree with your comment about
>intuitiveness, if we are in fact talking about a complete,
>breadth-first strategy (or equivalent).  After all, when faced
>with two different ways of solving a problem, we don't explore
>one way exclusively at first and ignore the other; if the first
>way doesn't look like it's having results, we try the other way
>for a while, and so on back and forth.  Is this what you meant?

Yes, except that like many concurrent systems PARLOG is non-
deterministic.  This seems to me a paradox when talking about
logic programming, but it adds an ingredient which could make
a PARLOG program that is simulating some aspect of human cognition
behave more interestingly.  Remember, I'm talking about using
PARLOG as a tool for teaching:  To give students an opportunity
to work with computers because the 'computer metaphor' is so
pervasive (and for undergrads often NOT so persuasive) in 
cognitive psychology.  

Frank Bokhorst
Dept. of Psychology
University of Cape Town
South Africa
------------