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 <[email protected]> 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