Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explicit multi-core C# applications

Is there any easy way to explicitly make an already threaded application utilise a multicore environment? (if avaliable).

The first problem would be how do I determine if my runtime environment supports multi-core applications?

If I then determine that I can use multi core functionality, can I explicitly assign threads to run on different cores? If so Is the thread communication handled by the OS/Hardware or do I have to get my hands dirty?

like image 416
TK. Avatar asked Oct 10 '08 06:10

TK.


1 Answers

If your application is already threaded properly, you dont have to do anything. Thread context execution and handling is done for you.

Now when it comes to threading, is your app threaded in a way to utilize the cores? do you have processor intensive tasks split into seperate threads. If not, then you will need to make changes to split up your processing tasks into more threads. You can use Environment.ProcessorCount to get the core count and make as many threads as appropriate at runtime for your tasks.

As of now, there is not really any way to make an improperly threaded app(single thread) into a threaded app taking advantage of all the processors/cores, unless you look to future technologies, such as plinq and Parallel FX

like image 102
mattlant Avatar answered Oct 13 '22 19:10

mattlant