[Lazarus] Threads in Lazarus code base

Mattias Gaertner nc-gaertnma at netcologne.de
Fri Sep 17 17:49:47 CEST 2010


On Fri, 17 Sep 2010 14:09:59 +0200
Dariusz Mazur <darekm at emadar.com> wrote:

>[...]
> Whats about CILK http://en.wikipedia.org/wiki/Cilk
> 
> 
> |_function_  fib (n: integer):integer;
> var
>    x,y : integer;
> begin
> 
>       if (n<  2)  then exit(n)
>       else begin
> 
>          x :=_spawn_  fib (n-1);
>          y := fib (n-2);
>          _sync_;
>          exit(x+y);
>      end;
> end;
> |

Have you noticed that most examples for multi threading are either 
- easy to understand, but completely impractical (the above is an
  order of magnitude slower than single threaded)
- OR practical, but hard to understand
?

Note: afaik CILK is the same as parallel loops: It allows to make some
special cases need less typing, can increase readability and can
decrease overhead. As always with multithreading: wrongly used it can
make code run much slower.


Mattias




More information about the Lazarus mailing list