[fpc-pascal] Re: Threads executing in sequence instead of parallel

Graeme Geldenhuys graemeg.lists at gmail.com
Thu Sep 28 22:55:29 CEST 2006

Ok, I have tried this under Windows and Linux, with FPC 2.0.2, 2.0.4 and 2.1.1.

This seems to only be a problem under Linux. Threading works fine
under Windows (via WINE or native), but is screwed under Linux native!
 Under Linux, it has been tested with 2.0.4 and 2.1.1 (I saw no point
testing it with 2.0.2 as I don't use that version anymore under
Linux).  Threading runs sequential (one thread, after the other) in
Linux, instead of in parallel which totally defeats the point of
threads.  I take this as a critical bug with FPC - unless someone can
proof otherwise.  More testing under Linux revealed that I have quite
a few apps, that are affected by this.

I have tested this on 4 different machines all with the same outcome.
Is any body else using threading in their applications?  Are you
experiencing the same issues under Linux? If so, I will submit a bug
report with a sample app showing the issue tomorrow.

This is the output of 'uname -a' to show my kernel version.

graemeg at graemeg-laptop:~$ uname -a
Linux graemeg-laptop 2.6.15-27-386 #1 PREEMPT Sat Sep 16 01:51:59 UTC
2006 i686 GNU/Linux

  - Graeme -

On 28/09/06, Graeme Geldenhuys <graemeg.lists at gmail.com> wrote:
> We have a problem!!!
> The test project /fcl/tests/threads.pp as well as a Sort Demo (Bubble,
> Section and Quick Sort) all execute the threads in sequence, waiting
> for the previous thread to complete, before the next one executes.
> Kind of defeats the point of using threads.
> The Sort Demo, which is a port of the Threads demo included with
> Delphi 7, shows this clearly.  I can archive and post the source, but
> you would need Lazarus LCL to run it as it is visual. The sort demo
> has three columns with identical random data.  The three sort methods
> are applied to each column respectively and gives visual feedback as
> it sorts the data (horizontal lines of different lengths).
> The threads.pp test project in fcl, shown a lot of a's on the screen
> and after a while, starts displaying b's on the screen.  Looking at
> the source, I gather the a's and b's are supposed to be mixed as each
> thread gets processor time.
> I am using FPC 2.1.1 (svn version from a week ago) and running it
> under Ubuntu Linux 6.10 on x86 CPU  (Pentium 4).
> Regards,
>   - Graeme -

There's no place like

More information about the fpc-pascal mailing list