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

Michael Van Canneyt michael at freepascal.org
Wed Oct 13 22:24:47 CEST 2010



On Wed, 13 Oct 2010, Andrew Brunner wrote:

> On Wed, Oct 13, 2010 at 2:12 PM, Michael Van Canneyt
> <michael at freepascal.org> wrote:
>
>> FPC doesn't have anything to say about CPU allocation. The threads are
>> created by the C pthread library and Linux kernel.
>> They do the heavy work.
>
> Is it possible I have the pthread library in some sort of debug mode
> that is slowing down the process of thread creation?

I seriously doubt it.
What you could do to test, is write your program using direct Pthread 
calls. This way we can ascertain whether it is the FPC or Pthread code 
which is the bottleneck.

If need be, I can dig up my texts for the Kylix book, it describes how 
to do this in Object Pascal. I suspect the code would still be pretty 
much the same.

>
> What is needed to get directly to kernel api to /queue
> events/create/destroy/suspend/resume threads?
>
> Are there any alternatives to the cthreads unit?

Yes, write an object pascal version of it, which accesses the kernel 
directly and bypasses the C library.

It has been on many people's wish list for ages.

Michael.



More information about the fpc-pascal mailing list