I have built an application in C# that I would like to be optimized for multiple cores. I have some threads, should I do more?
Updated for more detail
- C# 2.0
- Run on Windows Vista and Windows Server 2003
Updated again
- This code is running as a service
- I do not want to have the complete code… my goal here is to get your experience and how to start. Like I say, I have already use threads. What more can I do?
I’d generalize that writing a highly optimized multi-threaded process is a lot harder than just throwing some threads in the mix.
I recommend starting with the following steps:
5.Comb through that code to ensure that resources are locked in consistent sequence to minimize deadly embrace.
Bear in mind that it is entirely possible that a multi-threaded version could perform worse than a single-threaded version of the same app. There is no excuse for good engineering measurement.