Thank you Bill,

Are these two lines equivalent?

T.&''"0 (|change)#(*change){1 0 55

0&T.''0^:(0 < #)1$~(1>. (<:MAXTHREADS)-1 T.'')


Raul's example:

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


Ak.


On Wed., Dec. 21, 2022, 19:20 bill lam, <bbill....@gmail.com> wrote:

> create thread pool:
> MAXTHREADS_z_=: {: 8 T.''
> echo 'MAXTHREADS: ',": MAXTHREADS
> 3 : 0''
> if. 1<MAXTHREADS do.
>  0&T."0^:(0 < #) 0$~ (1 >. (<:9!:56'cores') <. (<:MAXTHREADS)- 1 T. '')
>  echo 'thread pool#0: ', ": n1=. 1 T. ''
>  0&T."0^:(0 < #) 1$~ (1 >. (<:MAXTHREADS)- 1 T. '')
>  echo 'thread pool#1: ', ": (1 T. '') - n1
> end.
> )
>
> for cpu intensive tasks
> f1 t.(0;<'worker';1)"0 foo
>
> for i/o bound tasks
> g t.(1;<'worker';1)"0 bar
>
>
>
>
> On Thu, Dec 22, 2022 at 9:53 AM Ak O <akin...@gmail.com> wrote:
>
> > Hi Bill,
> >
> > How is a threadpool assigned?
> > For clarity, can you please show two sample commands?
> > The command that creates threads in threadpool 0.
> > The command that creates threads in threadpool 1.
> >
> > Thank you for 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
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to