I wrote two versions of a small test program that calculates sin(x) using a Taylor series expansion. The single thread version calculates each term of the expansion sequentially and then adds them up for the final result. The multi thread version calculates each term in a separate thread then adds them up when all threads have completed. The programs calculate a million values just so I can time them with a stopwatch. On my XP machine with a quad core processor the multi thread version runs much faster than the single thread version. When I moved the programs to a Windows 7 machine with a quad core processor the multi thread version runs SLOWER than the single thread version! Has anyone else seen this type behavior? I have tried changing various Windows parameters, such as processor affinity and thread priority, but to no avail. Thanks in advance.
Red Flag Submitted
Thank you for helping keep Tek-Tips Forums free from inappropriate posts. The Tek-Tips staff will check this out and take appropriate action.
Reply To This Thread
Posting in the Tek-Tips forums is a member-only feature.