I have a C++ (Visual Studio 2003) server process that accepts sockets, reads XML-RPC requests, processes the request, then returns an XML-RPC response. I am experimenting by threading it with OpenMP, and analyzing it with the Thread Checker and Thread Profiler VTune modules.
1) The OpenMP "parallel" section doesn't perform any better than a serial process. I know that if the code is CPU bound, multi-threads won't help, but this shouldn't be the case. For each request, a connection is made to a SQL Server 2005 instance using ADO, and the data is formatted and returned. Performance is slightly slower with multiple threads (3-5 threads versus 1). All data returned is correct and no errors occur. It could be too granular locking, but the one "critical" block is pretty small. Any thoughts regarding what could be going on?
2) When I run either of the threading tools, the server fails badly. It doesn't seem to crash (most of the time), but the data is badly skewed. Console output is seriously interleaved and returned data is similarly corrupted. This is the exact same EXE module that runs without problems (other than slow multithreaded performance) when run outside of the threading tools. This seems pretty serious as I wouldn't expect runtime results to vary when invoked by the tools.
My development machine is a 3.2GHz HT P4 laptop with 1GB RAM running Windows XP Pro. I've tried the project in both VS2003 and 2005, compiled with the MS and the Intel compilers.
Help would be very much appreciated!
-Arian