[Lazarus] Multi-threading support in IDE

Graeme Geldenhuys graemeg at opensoft.homeip.net
Thu Aug 13 23:36:34 CEST 2009


Mattias Gaertner wrote:
>  
>> Examples where I think it could be used (if not already)
>>   - background parsing of units
> 
> Yes, this is planned. Some expensive parts can be done in worker

Excellent.


>>   - fpdoc lookups
> 
> That should be easier. This already works in several separate parts
> executed on idle.

Nice.


> available. The only problem is that TAsyncProcess bites the debugger
> under Linux. Compile LCL and IDE with -dUseAsyncProcess. Run an
> application. Close the IDE. The gui will close, but lazarus is still
> running.

I probably run my applications 1% of the times via the IDE. All other uses and testing is by running them from a command line. I few years ago when debugging via the IDE really sucked, I wrote various logging methods which I got so used to and always works. Logging gets done via a separate thread and I can log to various outputs. cached logging to file, cached logging to GUI or non-cached logging to console (stdout).

I'll recompile tomorrow with-dUseAsyncProcess and see how it goes.


> For example: An expensive function is "Find in files" which could be
> multithreaded. But the bottleneck here is the memory system and the
> disk, not the cpu.

That is an excellent candidate. We did some testing with a multi-threaded application that does CRC calculation on files, recursively through directories. It was one of the multi-threading entries to a Borland Multi-Threading competition held some years ago. We adapted the program for our needs and by using 2-4 threads on a multi-core system improved overall throughput a lot. The app did not work so well when the files were on CD-ROM though. :-) A major disk bottleneck, but hard drives or raid system is much faster.


> AFAIK Florian did some tests years ago and the bottleneck was the
> memory system and the disk.

I believe GCC can use threads for parallel compiling, so there must be some advantage. With faster hard drives or SSD drives it should make a difference - I guess. But yes, I understand your point regarding disk IO being slower than in-memory computations.

 
Regards,
 - Graeme -

________________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/





More information about the Lazarus mailing list