[Lazarus] Threads in Lazarus code base

Dariusz Mazur darekm at emadar.com
Mon Sep 20 20:23:30 CEST 2010

  W dniu 2010-09-20 16:09, Sven Barth pisze:
> Am 20.09.2010 15:22, schrieb Dariusz Mazur:
>> W dniu 2010-09-20 13:55, Mattias Gärtner pisze:
>>> Zitat von Dariusz Mazur <darekm at emadar.com>:
>>>> [...]
>>>>> Before using multi threading, try to use a better single threaded
>>>>> algorithm. And when comparing multi with single threading speed, you
>>>>> must not compare a multi threaded algorithm running single threaded,
>>>>> but
>>>>> a multi threaded algorithm with a good single threaded algorithm.
>>>> I don;t talk about best solution of fibbonaci computing. But about
>>>> possibility do deal with some class of task using multithreading.
>>>> Its easy imagine task, which is hard to resolve with loops.
>>> Of course.
>>> I think, we both agree that CILK is a nice approach.
>> Nice to hear this.
>>> I just said, that there are not many multi threading examples that are
>>> easy to read and are practical at the same time. Computing Fibonacci
>>> numbers does not need multi threading.
>> Most of programs are huge count of simple computing. There are many
>> places, that things may run parallel without pain. But very often this
>> places are computing short, thus very often overhead of starting thread
>> is bigger than using second core.
> You are aware that for using a second core you need a thread (no 
> matter how fancy a syntax construct hides it)? Thus for reducing the 
> overhead of creating a thread at least one thread per core must be 
> created before the first call of a "spawned" function/procedure.
Of course, Some of workers (threads) sleep, Also queue must be 
initializing. But i think its not a problem.


More information about the Lazarus mailing list