It would be sufficient to create threadpool when starting an application.
No need to bother how many threads are available inside the application.
Eg if your machine has 8 CPU, then create 7 threads for pool 0 (for CPU
bounded tasks) and 56 threads for pool 1 (for I/O bounded tasks)

On Thu, Dec 22, 2022, 9:07 AM Ak O <akin...@gmail.com> wrote:

> 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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to