Now I'm not expecting anyone to debug my code for me--I'll do that.
But I did want to see if anyone out there with SMP/thread experience
had seen/heard something like this.
I have a small raytracing application I wrote (nothing fancy--yet),
and recently I decided I should make it multithreaded to take
advantage of multiprocessors (I have a dual Pentium Pro 200). Using
the framework from the recently-posted pi.c, I created two threads
to raytrace half the scene each. (I had one thread to the even
scanlines, while the other did the odd scanlines.)
The scene is a simple checkerboarded sphere over a checkerboarded
plane, with a slight specular (reflective) coefficient for each
object. When I run my application single-threaded, everything looks
as it should. But running the application with two threads, the
reflection(s) do not show up... ...most of the time. If I run my
application (the two-threaded one) over and over and over, sometimes
I get what looks like the beginnings of some reflection, but it is
not as it should be when compared to the single-threaded output.
I haven't changed any code other than the pthread_create/join stuff.
In fact, even when I create a single thread to do the tracing of rays,
it turns out correctly. Only when there are two threads working
at the same time does the iamge turn out wrong. I have
pthread_mutex_lock/unlock around my calls to draw each pixel, so I don't
bombard the X server--this helped performance, but didn't change the
results.
For those that are truly interested, I have put up a web pagelet at
http://u2.netgate.net/~brmiller/raytrace.html that shows what I'm
talking about.
Again, I'll probably debug this on my own evenutally (or come up with
better questions for the group), but if anyone has any light to shed,
please do--this is my first threading application in Linux.
Brendan Miller
-
Linux SMP list: FIRST see FAQ at http://www.irisa.fr/prive/mentre/smp-faq/
To Unsubscribe: send "unsubscribe linux-smp" to [EMAIL PROTECTED]