Hi Marcus,

thanks for your input! Now I understand the aspect/thread relation. 
Hopefully Gerrit or Carsten can bring some light into the dark regarding 
the handling of the # of aspects in opensg2. Probably you are right and 
the second threads in the example sets itself to a new aspect.

Kind regards,
Christoph

Marcus Lindblom schrieb:
> Christoph Schäfer wrote:
>   
>> Hi List,
>>
>> I'm currently working on a little project using multiple (external) 
>> threads to perform cpu-intensive calculations. I studied almost 
>> everything on information available on threading with opensg and the 
>> provided mechanics to support multiple threads accessing the scene 
>> graph. I still have some questions and hopefully someone can investigate 
>> some time to bring clarity to me ;-)
>>
>> Aspects
>> As far as I understand this from the docs, each aspect is a copy of the 
>> scene graph data threads operate on. If I got it right, there are two 
>> aspects by default. One of the aspects is used for rendering (btw, how 
>> do I figure out which one it is?) and the other one is used for parallel 
>> calculations.
>>     
>
> Since you call window->render() yourself, you define which aspect does 
> which.
>
> In general, it's not wise to have two threads work on the same aspect at 
> once, but I think it might be feasible provided that you work on 
> separate objects that are not connected (in any way).
>
>   
>> 1) I've seen the examples (13multithreading.cpp, 13multithreading2.cpp) 
>> using 2 threads. What about 3 or more? Do I need more aspects as well 
>> and if, how can I introduce new aspects? What are the limitations of 
>> multiple threads working on the same aspect?
>>     
>
> The # of aspects is compile-time fixed in 1.8, so you need to recompile.
> I'm not sure about 2.0 though. There are plans for setting it at runtime,
>
>   
>> 2) Do the examples use 2 aspects at all?
>>     
>
> They don't seem to do that. Which is strange.
>
> The 13multithreading2.cpp at least uses two threads that access the 
> scene graph. I'd expect one of the threads to set itself to some aspect 
> other than zero (which is the default one).
>
> Unless I've misunderstood (or the thread's default aspect is 
> auto-incremented in 2.0. It wasn't in 1.x at least.)
>
>   
>> 3) How do changelists and aspects work together in terms of syncing? 
>> There is a changelists for each thread, but from what I've read I think 
>> there may be more than 1 thread operating on a specific aspect.
>>     
>
> One changelist per thread, noting what has been changed in that thread's 
> aspect. To sync to another aspect, the change list is used as a record 
> of what to copy (a dirty list), so you don't have to copy everything, 
> only the fields that have changed.
>
> Since change-lists are per-thread, they won't clash. You can change 
> fields A,B,C in one thread, and D, E, F in another (on the same aspect, 
> provided they are in disconnected containers, which is tricky to 
> guarantee), then sync those changes to another aspect.
>
> I suppose Gerrit or Carsten has more knowledge of this, so they might be 
> able to fill in the gaps.
>
> Cheers,
> /Marcus
>   

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to