Joe Duffy states in the MSDN article ‘Using concurrency for scalability‘ that the cost of creating a thread is approximately 200,000 cycles, and the cost of destroying is about 100,000 cycles.
When I try to create a new thread to perform some calculations, I would like to be sure that the calculations themselves are more expensive than 200,000 cycles.
How could I measure the CPU cycles? I think it would be more interesting than measuring the execution time.
You could use a sampling profiler like Intel’s Vtune to obtain a measure of how many CPU cycles are being consumed with a minimum amount of disturbance on the system being measured.
When using threads however the goal is to avoid needless spawning new threads. Look into using the thread pool. This will let you run work items asynchronously, but without having to spawn a new thread for each item.