I am using C#. I want to write the program using thread concept. I just to know maximum how many threads can run in dual core using C#. I attach my partial code:
Thread t1 = new Thread(threadJobA);
Thread t2 = new Thread(threadJobB);
t1.Start();
t2.Start();
You can use the
Environment.ProcessorCountto find out how many cores there are in the machine.However, that doesn’t limit the number of threads that you can start, that only tells you how many of the threads can run at the same time. In some situations there may be useful to start more threads than that, in some sitations less. It all depends on what the threads are supposed to be doing.