Serial Algorithm vs Parallel Algorithm
To solve your problem, you will need to change your algorithm.
Today what you have is an application that runs all your logic in a single thread that will be run by a single processor. Called serial algorithm or sequentially.
Which means that all your logic is executed sequentially. You would have to rewrite part of your application by dividing it into subtasks - subtasks, and delivering them to threads - this would be the parallel algorithm. An addendum is not possible to parallelize your entire algorithm, you can only divide to a certain point.
The number of threads should be the number of processors available and for each thread you submit your tasks. Each thread is run by a processor. Do not confuse parallel computing with concurrent programming.
Other technologies such as . net and Java are already ready to use
efficiently Multi-core Cpus?
Java has always provided Apis and frameworks for concurrent programming and parallel computing. From Java 1.5 a framework called Executor Framework has been added. It offers several utility classes, interfaces, methods for manufacturing Thread Pools and methods for submitting tasks.
Already in Java 1.7 we won the Fork/Join framework. Which allows you to program an algorithm by defining Thresholds processing, which are limits, when this limit is reached you want the task in two - Fork. Once it is executed and the other tasks are completed, you make the Jois of them for the final result. Interestingly, this framework implements an algorithm called work-stealing. It’s a technique where when a thread finishes executing its task it steals the task from another thread that hasn’t finished executing it.
Last but not least
If you take over the project of migrating a new execution model, I recommend that you study the amdahl’s law that predicts the maximum time it is possible to optimize a program using multiple processors.
Sources:
Serial algorithm: https://en.wikipedia.org/wiki/Sequential_algorithm
Parallel algorithm: https://en.wikipedia.org/wiki/Parallel_algorithm
Parallel computing: https://en.wikipedia.org/? title=Parallel_computing
In your application you have multiple threads or just one?
– Math
As @Math commented, have you tried running this time-consuming process in more than one thread? http://stackoverflow.com/questions/9630686/delphi-7-how-to-implement-multi-threading
– PauloHDSousa
To use all COLORS, your programming has to have been designed for this. Even in . Net should use specific libraries and techniques to take advantage of all cores
– FernandoNomellini
@Math, only a single theads, but it is a unique process that could not be divided into threads. But a same thead could not send instructions to all processor cores?
– Fernando Leal
As far as I know you have to split into multi threads so that each one is rotated into a core, and you may still have to do something more than that. I’m no expert in threads, but surely if you put a single thread to run it won’t split into multiple cores, because there’s no way the processor can parallelize your code if your code is all, say, sequential.
– Math
You need to modify your application using system threads so that your application uses more than one core. This is not a limitation or problem of Delphi.
– Vinicius
Related: http://answall.com/q/1946/101
– Maniero