Now that Xojo is fully 64bit and supports true multicore pre-emptive threading, i am planning to refactor my app that currently uses shared system memory objects and child workers as separate processes. My application is parallel processing large scientific images.
After some thought I decided the following might be the best approach, and would like people’s advice before diving too deeply into the implementation.
-
A new class subclassed from Task which is co-operative, so running on same core as main. This master class will spawn and control N pre-emptive threads running on multiple cores, monitor their progress, and be the bridge to the UI.
-
a new class subclassed from Thread, set as pre-emptive, these are the workers doing the heavy lifting on multiple cores. #1 will instantiate N such workers and manage them.
All main has to do is call master’s init method to set things up, then Run the master Task, and the rest is taken care of.
Initially I thought of just having N pre-emptive worker instances and having main init and run them, but then it occurred to me that someone has to be idling in the background monitoring the workers’ progress, then report to the UI when complete. A master co-operative Task seemed like a good solution.
Is this a sound strategy? Appreciate any input.
P.