[fpc-pascal] Threading vs Parallelism ?

Ryan Joseph ryan at thealchemistguild.com
Fri Mar 31 08:43:14 CEST 2017

> On Mar 30, 2017, at 3:06 PM, Michael Schnell <mschnell at lumino.de> wrote:
>> Huh, ok, but why parallelism is better and how to do it with fpc ?
> Parallelism within a process always is based on threads.
> AFAIK, fpc does not (yet) provide a more convenient abstraction for parallelism (such as parallel loops) than TThread.
> -Michael

It’s my understanding that for parallelism to make sense you need to have at least more than 1 separate compute unit, be that a CPU core or a GPU.

If you had a GPU with 250 compute units or a CPU with 250 cores you would need to design your task in a way so that it could be broken down into as many discrete portions as possible so that you could take advantage of the multiple cores running in parallel. Even if you didn’t have a single thread and the execution blocked until finished you wouldn’t see any performance increases unless you designed your program to scale for parallelism. Running 250 threads on a single core isn’t going to be 250x faster but running 250 threads on 250 cores may be. 

	Ryan Joseph

More information about the fpc-pascal mailing list