[fpc-pascal] Re: Multi-threaded project with few locks (no Thread.waitfor). Memory consumption keeps increasing on Ubuntu 10.10 x64

Andrew Brunner andrew.t.brunner at gmail.com
Fri Oct 15 17:45:05 CEST 2010


On Fri, Oct 15, 2010 at 10:24 AM, Sven Barth
<pascaldragon at googlemail.com> wrote:
> The problem isn't the pthreads library. The problem is the POSIX threading
> specification of which pthreads is an implementation (look at the comment in
> CSuspendThread again).

POSIX is just like you say a specification.  Suspend and Resume is a
feature.  There are many ways to implement a feature such as suspend
and resume.  A semaphore is one way.  Unfortunately, because FPC uses
PThreads and PThreads uses libc FPC apps get slow during a high scale
thread creation process where a barrier is required.

I was able to work around not having an RTLEvent per thread to bybass
in this case, but other cases will come where I need to have events or
signals going to each thread.  And if a semaphore is created for each
thread object over each "layer" to implement you can see these
inefficiencies compound.

If we go native, at lease we can share the 1 semaphore that is needed
to introduce suspend and resume features.



More information about the fpc-pascal mailing list