Question: Array or list for sharing large immutable data between tasks?

I'm using Maple 14 on 4-way and 6-way AMD 64 hardware running Windows Vista to numerically estimate inverses of a cumulative distribution function at hundreds of points, and am using the Task model to assign each point's inverse computation to a separate task. The cdf is a weighted sum of thousands of simpler functions, and so each task needs the weights. Initially I had set these up as a global variable, but after reading Darin Ohashi's MaplePrime's post here I am rewriting them to be private module variables to be shared by by calling functions exported from the module.

My question is this: What data type should I use to efficiently store, pass and access weights?

I'm using an Array during a preliminary phase of computation of the weights themselves, so that previously computed weights are not copied from list to list during creation, and because I had read elsewhere on MaplePrimes that Arrays are passed by reference rather than making a separate copy for the called function, which would save time for passing weights to each task. After the weights are computed, I changed the attributes of the Array to READONLY so that locks would not be needed to access weight values of the shared weight Array. On reflection, it seems to me that the decision to employ locks on weight references may be made before the READONLY attribute is set, (like if I compile the code, I imagine), and so I think I should be recasting my weight array as a (immutable) list that would not require locks for read access.

But if I hold the list as a private module variable and export a module procedure to return the weights, is Maple going to make a copy of the list every time a task invokes my module's "GetWeights" procedure?  If so, I'm paying a pretty high price to avoid the mutex locks on weight reads. Can I ask Maple to pass the list "by reference" rather than making a copy, or ss there some other way to avoid both the read locks AND the list copying? Are there places in the documentation where I can answer this question myself rather than bothering the wizards?

I sincerely apologize for incorrectly asking this question earlier as a comment on Darin's blog post.

Looking forward to your advice,

 - Jimmy

Please Wait...