Hi Zach,

 

It might be interesting to try playing with the real-time process priority
class. You have to be careful with this but given that both threads will be
yielding the CPU periodically, this should not negatively impact the OS.

One nice thing about this priority class is that Windows does not do
boosting of thread priorities following I/O’s or other pending operations.
Thread boosting will occur for other priority class and may cause a thread
that is doing a lot of I/O’s being boosted to a higher priority once its
I/O’s completes since it did not effectively had the CPU for its time slice
and Windows is trying to make up for it.

 

// Set the base priority for all threads in the process

SetPriorityClass(hProcess, REALTIME_PRIORITY_CLASS);

 

// paging thread

SetThreadAffinityMask(hPagingThread, 0xyz); –> set to first physical CPU for
paging thread

SetThreadPriority(hPagingThread, THREAD_PRIORITY_IDLE);

 

// graphics thread

SetThreadAffinityMask(hGraphicsThread, 0xyz); –> set to second physical CPU
for graphics thread

SetThreadPriority(hGraphicsThread, THREAD_PRIORITY_TIME_CRITICAL);

 

André

 

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Zach Deedler
Sent: March-14-07 9:41 AM
To: 'osg users'
Subject: RE: [osg-users] Paging dual-core

 

Hi Robert,

 

I tried running the threads on separate cores last night.  (On the first 2
cpus, which should be the physcial cpus).  This did not help the
performance.  I verified the thread's affinity using the performance
monitor.  The threads were impacting each other.  This tells me there is a
potential thread synchronization problem.

 

I also timed some file loads linux vs. windows on the same hardware (in
seconds):

fileA lnx=13.1, win=37.0

fileB lnx=1.61, win=2.26

fileC lnx=1.20, win=1.60

 

fileA is a file that references a bunch of 200 other files about ~5MB each

fileB is 51.9MB

fileC is 41.2MB 

 

Paging is done more like fileA.  This tells me that if there were a thread
synchronization problem it could be hidden on linux, by its superior file
system.

 

Zach

 

 

  _____  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert Osfield
Sent: Wednesday, March 14, 2007 06:16
To: osg users
Subject: Re: [osg-users] Paging dual-core

Hi Zach,

On 3/14/07, Zach Deedler <[EMAIL PROTECTED]> wrote: 

Somehow the paging thread is running with disregard for the graphics thread.
I'm guessing this is when it is loading a large file, and there are no
checks in the code to relinquish control.  This is where the OS should step
in and say 'stop hogging the resources!', and switch to the other thread
(who has priority).  I don't know why this isn't happening.  I'm not sure
what 'resources' it is hogging though.  Should I just give up, and say the
OS sucks?  That's what everyone keeps telling me.  This is proof enough,
unless there is something wrong with OpenThreads setting of priorities.
Although, that doesn't seem to be the case looking at the graphs in the
previous email I sent.


The resource locking up does very much look an OS issue.  This means any
fixes are not really to problems inherit to the OSG's database paging but
workarounds to avoid pushing the OS too much. 

Perhaps it doesn't like changing of priorities the DatabasePager between
inside and outside the frame.  If you have processor assigned to the
database pager and one assigned to the graphics thread then you shouldn't
ever need to manage priorities - both threads should be able to run at top
priority and not impact each other.  The caveat to this is the other
processes running on the machine will need scheduling too, so I'm would set
the priority of the DatabasePager lower than then graphics thread anyway so
the OS will naturally plonk these processes on these cores. 

Another little thing to think about is the number of hyper-threading vs real
cores, so if you want to set affinity of two threads on the "four" core
Pentium D then assign the two threads to different physical cores rather
than the hyper-thread two processes on a single core. 

Robert.

 

 

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to