Re:Composable multi-threaded parallelism in Julia
by manigandham on Tuesday July 23, 2019 @08:58PM
(#20511519)
What do you mean by reusable exactly? And how does proactive computing differ? Do you have an example you can share?
[ Parent
| on HN ]
Re:Composable multi-threaded parallelism in Julia
by opportune on Tuesday July 23, 2019 @10:20PM
(#20511925)
Reusable as in, I can create a datastructure in a thread, do some computation, yield control from the thread (wait for something else to tell it to go again), then come back to the thread with the same datastructure and keep going. With Tasks, you are supposed to let tasks complete rather than let them pause/sync so anything you declare locally is lost when you want to restart it. The workaround is to declare things in a higher scope and pass them into tasks as they are reran - this makes tasks not suited to things where you want to persist data, since tasks are opinionated in that they are only meant to contain logic, not state, so you have to add your own external logic to manage the allocation of state to the tasks that you keep recreating
This trait of tasks makes sense when writing things like web servers because it prevents developers from shooting themselves in the foot by writing something that isn't stateless.
By proactive computing, I mean some program that always has control of the entire execution graph. For example, a simulation may initialize a bunch of datastructures, separate some of them into threads, run the threads, wait for all of them to complete x ticks, do some synchronization or measurement of the total system, then continue y times, and exit.
Re:Composable multi-threaded parallelism in Julia
by DNF2 on Wednesday July 24, 2019 @03:37AM
(#20513058)
What would be the purpose of yielding control from the thread and tell it to wait, rather than just let it run to completion?
Re:Composable multi-threaded parallelism in Julia
by ska on Wednesday July 24, 2019 @01:44PM
(#20517643)
Sometimes you don't know where you want to spend your CPU budget until you have more information.