[Lazarus] Threads in Lazarus code base

Mattias Gaertner nc-gaertnma at netcologne.de
Wed Sep 15 13:41:55 CEST 2010

On Wed, 15 Sep 2010 12:46:10 +0200 (CEST)
Michael Van Canneyt <michael at freepascal.org> wrote:

> On Wed, 15 Sep 2010, Michael Schnell wrote:
> > On 09/15/2010 10:48 AM, Michael Van Canneyt wrote:
> >> 
> >> Threads are a thing of the past as well. I've been programming threads 
> >> since years.
> >> There is nothing exciting about them, mostly they are a pain.
> > OK, but
> >
> > how do you make a program that is able to non sluggishly communicate with the 
> > user while performing decent work (without doing performance-killing polling 
> > stuff like "process Messages") ?
> What is so performance killing about process messages ?
> What do you think the OS does when switching threads ? 
> A thread switch is much more expensive than a "process messages".

Threads are not bad per se.
Just the implementation in many common languages are bad. There are
better designs since more than 20 years, but programmers are used to
think single threaded, so the ideas never got a hype.

> > how do you make a program doing huge calculations use multiple CPUs which are 
> > the contrary of "of the past" ?
> I didn't claim to have a better solution. 
> I just observed that the very idea of threads is basically flawed.
> These are not my words, but the conclusion of scientific research on the subject.



More information about the Lazarus mailing list