Program Multi Processor !
-
Hi all ! My computer have 3 Processor ( 3 CPU). My Application use only 1 processor for the work. Now I want to use all 3 Processor. Pls, show me How to program in order to using all 3 Processor. Thank you alots !
How is it possible your that computer has an odd number of CPUs? Am I missing something? However, you have to use multiple threads in order to use *more* than 1 CPU. In this case there are so many problems so the program should be re-designed. For example: is the main job (task) subdivisible in two or more separate execution lines? If the job, for example, computes a result from an array of values, it can be easily broken in some parts. Each part will be executed by a Thread. Other problems are: re-assembly the results of the various threads, manage their synchronization, manage the stop of the threads, that (if not manually stopped), will continue their execution until the end or the system shutdown (even if you close the app!). Moreover, you cannot know if the threads are REALLY executed, because the OS decides which thread(s) are to be executed. So multithreading is very hard to achieve without (unexpected) performance drops, strange behaviors, and so on. In C# the base namespace is System.Threading, try to search on CodeProject: you'll find many good articles. Hope this helps.
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi. [ENG] Tozzi is right: Gaia is getting rid of us.