Question

This may be a bit of an odd question, sorry i'm new to stack overflow.

I Have an application in visual studio(C#) that is multi-threaded, my development machine is a 4GB, Dual Core, each with 2 threads so virtually a 4 Core machine.

The application however will run on a straight Dual Core machine, what is happening is, when i build and install an executable of the application I keep getting what appears to be a deadlock, its really hard to find this out because when debugging on either machine there is obviously enough time to stop this happening.

I would like to find out is there any way in Visual Studio, to limit the application to a certain number of cores to mimic what will happen on the deployment machine. This way i can ensure the code i am developing regardless of development machine will work when installed on the client machines.

Was it helpful?

Solution

You could still run 10 threads on a single core, so I don't know what you are trying to achieve...

You should be looking for situations in your code where:

Thread A is blocked awaiting a resource / lock that is locked by thread B, and Thread B is blocked awaiting a resource / lock that is locked by thread A.

In other words, look for scenarios where a running thread takes locks on more than one resource - that's your starting point...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top