Subj : Re: Win32 Threads vs pthread performance To : comp.os.ms-windows.programmer.win32,comp.programming.threads From : Stuart Dunn Date : Fri Jan 07 2005 08:39 pm "Olivier Langlois" wrote in message news:6a9bd009.0407171004.631e972@posting.google.com... > Hi, > > I have written a program that performs parallel computing through > threads for a class project. I wrote this project in C++ and I have > use the facade pattern to encapsulate the synchronization object > implementation details (I took some code from the ACE framework to do > that). This allows me to switch back and forth from a Win32 platform > to a Unix platform using pthreads. > > I got very disappointing results with Win32. Here are the results with > 2 processors: > > Acceleration with Win32 (XP professionnal): 1.13176 > Acceleration with pthreads (AIX 4.3): 1.99851 > > I was wondering if someone have an explanation to offer that would > explain why I got so bad results with Windows. > You are probably overlooking some common porting pitfalls. For example, pthread mutexes and win32 mutexes are not the same: a win32 mutex is a kernal object, critical sections are the corect replacment. Also due to API design differences some thread coding techniques do not port well between the two platforms. A lot of these cross platform porting tools are designed just to get your code working, but not nessesaraly as fast. What mechanisms are you using to syncronize access? Is it fine-grained or course-grained syncronisation? .