Each execution of (u t. '') creates a task. The task is added to a list
of tasks for its threadpool. When a thread in the threadpool becomes
available, it executes the task. That's all there is to it.
Execution starts immediately. When you create a task, all the waiting
tasks in the threadpool are awakened, and one takes the task. (yes,
maybe we should awaken fewer threads). When a task completes, its
thread grabs another task if there is one.
You just create the tasks; we will execute them. :)
Henry Rich
On 1/5/2023 9:41 PM, Ak O wrote:
On Tue Dec 20 17:52:26 UTC 2022
You suggested,
... or, if the blockverbs are the same, you could use
pyx012 =. blockverb t. ''"0 block0args;block1args;block2args...
I think is similar to what you suggest here.
Can explain how the execution is distributed?
When is the execution started?
Ak
On Thu., Jan. 5, 2023, 16:51 Henry Rich, <henryhr...@gmail.com> wrote:
You don't need multiple threadpools, or a work_list. Just have
something like
tabulation_task@>/ x (?@[ A. i.@]) t. ''"0 y
Henry Rich
On 1/5/2023 6:38 PM, Ak O wrote:
Is this the correct way to consider scheduling? Is there a better way
to
structure the distribution of this execution?
Ak
NB. Simulated long running tasks, of variable execution length.
] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
] x=. 90 31 235 77 83 99 17 62 122 23
] y=. 12 4 _17 8 5 _8 9 6 15 _4
NB. The solution pyx look like this:
(x wrk_prcs y)
] notional_work_list =: ,.<;._1
',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
'
] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))
NB. Execution is pre-assigned to threadpools. Intermediate results are
locked from a calling tabulation task.
NB. The Final tabulation task executes when each pool has signaled that
all
of its assigned tasks are complete.
] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2
(,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))
NB. Threadpools are initialized with an execution task (passed a task).
By
Thread configuration, on completion of
NB. an execution, the worker checks for remaining tasks (from the
Work_List). If there are no remaining tasks, the pool destroyed.
NB. If there are remaining tasks, the task is locked and executed by
the
worker. This series repeats to completion.
NB. When signaled the final tablution task is executed.
On Thu., Jan. 5, 2023, 03:40 Ak O, <akin...@gmail.com> wrote:
NB. Simulated long running tasks, of variable execution length.
] wrk_prcs =: ([: < (1 ? [) A. ([: i. ]))"0 0
] x=. 90 31 235 77 83 99 17 62 122 23
] y=. 12 4 _17 8 5 _8 9 6 15 _4
NB. The solution pyx look like this:
(x wrk_prcs y)
] notional_work_list =: ,.<;._1
',(<(1?90)A.(i.12)),(<(1?31)A.(i.4)),(<(1?235)A.(i._17)),(<(1?77)A.(i.8)),(<(1?83)A.(i.5)),(<(1?99)A.(i._8)),(<(1?17)A.(i.9)),(<(1?62)A.(i.6)),(<(1?122)A.(i.15)),(<(1?23)A.(i._4))
'
] Exec_sched_form1 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2 (,.10 $ <"_1 ( 1 +i.4))
NB. Execution is pre-assigned to threadpools. Intermediate results are
locked from a calling tabulation task.
NB. The Final tabulation task executes when each pool has signaled
that
all of its assigned tasks are complete.
] Exec_sched_form2 =. 2 1": ((<'Tasks'),(<'Executing Threadpool'
)),(notional_work_list) ,."2
(,.<"_1(1),(2),(3),(4),(_),(_),(_),(_),(_),(_))
NB. Threadpools are initialized with an execution task (passed a
task).
By
Thread configuration, on completion of
NB. an execution, the worker checks for remaining tasks (from the
Work_List). If there are no remaining tasks, the pool destroyed.
NB. If there are remaining tasks, the task is locked and executed by
the
worker. This series repeats to completion.
NB. When signaled the final tablution task is executed.
Ak
On Wed., Jan. 4, 2023, 22:14 Raul Miller, <rauldmil...@gmail.com>
wrote:
It's also worth noting that threads do not spin down immediately --
they only spin down when they're idle.
And, as you have noted it's basically a stack of threads.
So what you'd have to do is spin down as many threads as necessary to
eliminate the thread you wish to eliminate and then spin back up the
threads which you wish to remain.
Or, shut down J completely and initialize a new instance of J with
your desired thread pool structure.
(That said... why would you want to restructure your thread pools
like
this?)
--
Raul
On Wed, Jan 4, 2023 at 8:33 PM Ak O <akin...@gmail.com> wrote:
In a case where,
{{0 T. 2}}''
{{0 T. 4}}''
{{0 T. 7}}''
How do I spin down the thread in pool number 4?
I think operation,
{{55 T. ''}}
spins down only the most recently created thread.
Thank you Henry.
Ak
On Wed., Jan. 4, 2023, 16:29 Henry Rich, <henryhr...@gmail.com>
wrote:
Yes, that's right.
Henry
On 1/4/
Rich
2023 6:11 PM, Ak O wrote:
Happy New Year,
I hope you are all well.
I am still struggling, please continue to have patience with me.
Where,
{{0 T. ''}}''
creates a new thread.
Does this,
{{0 T. 7}}''
create a new thread in pool number 7? Or how is this function
treated?
Thank you,
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
----------------------------------------------------------------------
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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm