Skip Cave wrote:
> I believe that you are proposing the test script:
>
>    A =: var=: ([EMAIL PROTECTED] { ])bind'abcdefghijklmnopqrstuvwxyz'"0 bind 
> i.
>    B =: op=: ([EMAIL PROTECTED] { ])bind'+*%,-'"0 bind i.
>    C =: exp=: var,.'=',.':',.var,.op,.var
>    
>    parallel A
>    parallel B
>    parallel C
>    exp"0(4 4 4)

Oops, sorry, I was not clear.

I meant the set of scripts represented by:

   'A B C'=: exp"0(4 4 4)
   parallel each A;B;C

(Note that each time you evaluate this expression you
get a different A, B and C.)

> The priority of execution of the parallel functions is defined by the 
> order of parallel commands in the script. If two or more of the
parallel 
> functions access the same variable, the first parallel function
executed 
> in the script has precedence on the variable, so any other parallel 
> functions will block until the first is completed.

What does "first" mean in the context of "parallel"?  (Does it mean
anything
different than "randomly choosen"?)

For that matter, what does "lock" mean?  Does that mean that any attempt
to read that variable must wait until the other expression is complete?
Or does it mean that writes to the variable are atomic?  [Do you see how
these can be different?]  Or does it mean something else?  What
happens when thread A is waiting on thread B, but thread B is waiting on
thread A?

> > Random results and errors?  Modify in place gets replaced
> > by a slower technique?
> >   
> Not sure what you mean here. Perhaps an example would help me
understand.

Consider:

 a=:a,b

What happens here in a parallel context?  (Remember that J allocates
up to double the strictly necessary space for arrays to make
this expression fast in the typical case.)
 

> > (Would it acceptable to make J substantially slower in
> > contexts where it's currently fast so that it can run multiple
> > threads?)
>   
> No. The interpreter should be designed to attempt parallelization
> only if it will significantly speed up the execution of a
> specific primitive. 

I thought we were discussing your "parallel" operation, hinted at
above?  Are you saying that certain primitives would throw an
error if they were used in one of these threads?

-- 
Raul

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to