You can also make this dynamic by having the whole array owned by a single 
actor which can hand out restricted views to it, keeping track of not allowing 
overlapping writers; this would be called the Loan Pattern.

Regards,

Roland

5 jun 2014 kl. 21:07 skrev √iktor Ҡlang <[email protected]>:

> If you never write you just need to make the view read only and can allow 
> overlap
> 
> On Jun 5, 2014 7:02 PM, "Daniel Armak" <[email protected]> wrote:
> If they only need readonly access, then why does it matter if the views are 
> overlapping?
> 
> Daniel Armak
> 
> 
> On Thu, Jun 5, 2014 at 8:01 PM, Marco Luca Sbodio <[email protected]> 
> wrote:
> Hi,
> 
> thank you for your suggestion, but I think I this is not applicable to my 
> case for two reasons:
> 
> - I don't know at the actor creation time which slice of the array that actor 
> may need
> - I can't guarantee to have non-overlapping sections handed out to actors: 
> two actors may actually request the same section or overlapping sub-sections.
> 
> Any other idea?
> 
> 
> On Thursday, 5 June 2014 14:34:27 UTC+1, √ wrote:
> Hi,
> 
> This sounds plausible to me:
> 
> Create an interface that wraps a section of the float array and pass an 
> instance of that section into the actor when it is created (carefully making 
> sure that you do not have any overlapping sections handed out).
> 
> 
> On Thu, Jun 5, 2014 at 3:22 PM, Marco Luca Sbodio <[email protected]> wrote:
> Hello everyone,
> 
> after having thought for some time about this problem, I can't find a good 
> solution, and so I decided to ask for help.
> 
> I essentially have a large (multi-dimensional) array of numbers (float), that 
> is the result of some computation. I would like to have a clean, safe and 
> efficient way to enable multiple actors to read elements and/or slices of 
> this array (obviously without having to create a copy of the array in each 
> actor). What is the best/recommended way of doing this?
> 
> I can of course have an actor that "contains" that array as a private field, 
> and respond to messages such as GetValueAtCoodinates(...) or GetSlice(...). 
> However, messages of type GetValueAtCoodinates(...) don't seem a good idea, 
> because I would end up having millions of this messages from actors 
> requesting values from my array. On the other hand messages of type 
> GetSlice(...) would require me to copy the requested slice in an array that 
> is passed back as answer: I can use System.arraycopy(...) but it seems kind 
> of a overhead, especially considering that all my actors will access this 
> array in read-only mode!
> 
> I've also read about Agents, but an Agent doesn't seem to be a good idea in 
> my case, because an array is obviously mutable (though I know that my agents 
> will not mutate it)
> 
> So, I'm not sure what's the best way of achieving what I need.
> 
> Any help is highly appreciated!
> 
> Best Regards,
> Marco
> 
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: 
> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> 
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> 
> -- 
> Cheers,
> √
> 
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: 
> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
> 
> 
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: 
> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ: 
> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe – Reactive apps on the JVM.
twitter: @rolandkuhn


-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to