Thank you Raul,

  Conceptually, the primitives are simple. T. is for configuration and
  setup. You always have one thread (the master thread), and you
  probably should have one additional thread for each cpu "core" (which
  you might think of as a register set -- a small set of variables that
  represent the machine itself).
-NB. This is important know. Thank you.

  setthreadcount=: {{
     change=. y-1 T.''
     T.&''"0 (|change)#(*change){0 0 55
     1 T.''
  }}

  To accomplish this, you might use a routine like
  setthreadcount=: {{
   change=. y-1 T.''
-NB. Does this set 'change' to a maximum of one less than the number of
cores?
   T.&''"0 (|change)#(*change){0 0 55
-NB. Does this provide (pass) the attributes to each thread created by
execution of this routine?
-NB. What does 0 0 55 specify?
-NB. (Aside) How are tasks passed to a thread
   1 T.''
-NB. Does this return the number of threads created by execution of this
routine?
   }}
     setthreadcount <:{.8T.''
-NB. Does this create less than or equal to the number of cores on the
executing system?


*****


  ...That said, I haven't found any good candidates for
  threading, yet. (By this I mean: simple code which gets improved
  performance using (t.'') (or (t.{{)n}})) vs using (<@)

-NB. How about cases where operations might lean on boxing?
Overhead (maybe unnecessary)can quickly accumulate with boxing.

I appreciate your help.

Ak.





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

Reply via email to