[osg-users] Osg and threads

2011-01-13 Thread Vincent Bourdier

Hi all,

Currently working on a way to manage the memory efficiently, I would 
like to know what are the osg threads running ?


I mean there are some threads in the databasePager, depending on the 
rendering threading mode there are threads for the render, the cull, or 
whatever...


Did I miss something important ?
What are the osg threads ?

I would like to be able to make some king of pause on all treads to be 
able to allocate the whole available memory for the process without 
having some crash because a thread would be working (and so allocating 
memory) during this operation.


Thanks for your help.

Regards,
Vincent.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Osg and threads

2011-01-13 Thread Vincent Bourdier

Hi Robert,

First of all thanks for your answer, I didn't know about the
Viewer::startThreading/stopThreading() and this sounds interesting

I know that my request seems to be a very strange way to manage memory 
by pausing threads ... But I am not (completely) crazy. The datas amount 
I have to manage is the reason why I need to be sure, before loading a 
file, that I have enought memory including a fixed amount that I reserve 
for the rest of the code... so I need to saturate memory for a little 
while to be sure of the amount I can use, and for that I need to stop 
other threads to be sure they won't crash because of bad_alloc errors 
that are not managed.


Thanks, I'll have a look at the things you gave to me.

Regards,
Vincent.

Le 13/01/2011 11:32, Robert Osfield a écrit :

Hi Vincent,

The OSG threads that will run automatically are the DatabasePager when
you have paged databases and any viewer threads.  There is a viewer
method for getting the threads.

However, the threads are designed to be arbitrarily paused, you can
start and stop the viewer threads via
Viewer::startThreading/stopThreading() but this creates and destroys
threads so not quite what you are after.

However, I'm kinda perplexed how you think you might be managing
memory more efficiently by pausing threads and doing stuff and then
un pausing.  I can't help but feel that you need to take a step back
and work out what you mean by managing memory efficiently, there are
lots of different ways of doing this, but given no information about
what you mean and you actual motivation for this others like myself
can't really point you in the right direction, the best I can say is
from the sound of it you are currently looking in the wrong place.

Robert.

On Thu, Jan 13, 2011 at 8:14 AM, Vincent Bourdier
vincent.bourd...@gmail.com  wrote:

Hi all,

Currently working on a way to manage the memory efficiently, I would like to
know what are the osg threads running ?

I mean there are some threads in the databasePager, depending on the
rendering threading mode there are threads for the render, the cull, or
whatever...

Did I miss something important ?
What are the osg threads ?

I would like to be able to make some king of pause on all treads to be
able to allocate the whole available memory for the process without having
some crash because a thread would be working (and so allocating memory)
during this operation.

Thanks for your help.

Regards,
Vincent.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Osg and threads

2011-01-13 Thread Vincent Bourdier

Hi,

I'm still having issues with that...
I use a composite viewer with only one view.

I tried to call startThreading/stopThreading() but it does nothing...
I also tried getAllThreads(...) to get for each thread its thread ID, 
and it returns me only one thread with ID to 0...  even if I know that 
there is 2 threads running for the rendering...


I know I'm not supposed to disturb the rendering threads, but if I 
cannot get them there is no risk at all...

Did I miss something ?

Thanks.

Regards,
Vincent.

Le 13/01/2011 11:49, Vincent Bourdier a écrit :

Hi Robert,

First of all thanks for your answer, I didn't know about the
Viewer::startThreading/stopThreading() and this sounds interesting

I know that my request seems to be a very strange way to manage memory 
by pausing threads ... But I am not (completely) crazy. The datas 
amount I have to manage is the reason why I need to be sure, before 
loading a file, that I have enought memory including a fixed amount 
that I reserve for the rest of the code... so I need to saturate 
memory for a little while to be sure of the amount I can use, and for 
that I need to stop other threads to be sure they won't crash because 
of bad_alloc errors that are not managed.


Thanks, I'll have a look at the things you gave to me.

Regards,
Vincent.

Le 13/01/2011 11:32, Robert Osfield a écrit :

Hi Vincent,

The OSG threads that will run automatically are the DatabasePager when
you have paged databases and any viewer threads.  There is a viewer
method for getting the threads.

However, the threads are designed to be arbitrarily paused, you can
start and stop the viewer threads via
Viewer::startThreading/stopThreading() but this creates and destroys
threads so not quite what you are after.

However, I'm kinda perplexed how you think you might be managing
memory more efficiently by pausing threads and doing stuff and then
un pausing.  I can't help but feel that you need to take a step back
and work out what you mean by managing memory efficiently, there are
lots of different ways of doing this, but given no information about
what you mean and you actual motivation for this others like myself
can't really point you in the right direction, the best I can say is
from the sound of it you are currently looking in the wrong place.

Robert.

On Thu, Jan 13, 2011 at 8:14 AM, Vincent Bourdier
vincent.bourd...@gmail.com  wrote:

Hi all,

Currently working on a way to manage the memory efficiently, I would 
like to

know what are the osg threads running ?

I mean there are some threads in the databasePager, depending on the
rendering threading mode there are threads for the render, the cull, or
whatever...

Did I miss something important ?
What are the osg threads ?

I would like to be able to make some king of pause on all treads 
to be
able to allocate the whole available memory for the process without 
having

some crash because a thread would be working (and so allocating memory)
during this operation.

Thanks for your help.

Regards,
Vincent.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 




___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] OSG and Threads

2007-11-21 Thread Robert Hansford
Hi all,

I'm in the process of redesigning our OSG application (the current
version is little better than a proof-of-principle prototype, and
wasn't written by me) and I'm trying to sort out how the threads will
interact.  The application has to render imagery from one or more
views of a common scene which is updated via a network connection.
The rendered imagery will probably need to be delivered back over the
network, either by reading back each frame or by using a separate
video capture card.

My current plan is to have a thread which interacts with the network
and converts the packets into updates to the scene graph, then have a
second thread which does the rendering, and possibly a third thread to
readback and compress the imagery (though this may be done separately
via a video capture card).  I am also considering a fourth thread to
do the scene management stuff, like applying updates from the
network and loading models in the background, but I'm not sure how
necessary this is.

So my questions are as follows:

Is my architecture sensible?
 -   Is there a 'better' way to do it?
 -   How closely should I integrate my application with OSG?  From a
design point of view I'm tempted to create lots of adapters or facades
(ie do it properly), but as I will also be the one doing the
implementation I'm not sure I can be bothered.

How easy is it use OSG in a multi-threaded environment?
 -   Do I need to provide my own mutual exclusion code when modifying
the scene graph or is it already taken care of?

I think I will need each of the viewpoints to be rendered to a
separate window, what is the best mechanism for doing this?
 -   Each view should use the same scene graph except they will each
have a different set of render passes and some different shaders and
uniforms, is this achievable, and how?
 -   Will each view need to run in a separate thread, or can they all
run in one thread?  Are there performance implications either way?

Thanks in advance for any help.

Rob.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org