[Lazarus] Threads in Lazarus code base

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Sep 20 22:01:12 CEST 2010


On Mon, 20 Sep 2010 20:45:04 +0200
Dariusz Mazur <darekm at emadar.com> wrote:

>[...]
> > Start a wiki page with a proposal for the syntax.
> > Create a unit like mtprocs that demonstrates CILK and how the syntax 
> > should be converted by the compiler.
> > Find someone to implement and, more important, maintain this.
> > Then there is a good chance to get this into the fpc main branch.
> I know, every one say this. But without help (or even permission) of 
> core developer its none chance to achieve this. I can prepare some of 
> units, but because i;m rather poor with documentation its little chance 
> to achieve this.

You will get permission when you convince them that someone will
maintain it for the next years.
First do the wiki and a unit to test.


> >> [...]
> > for i:=1 to 10 paralleldo
> >   for j:=1 to 10 paralleldo begin
> >     if j=1 then DoAlotOfWork else DoLittleWork;
> >   end;
> >
> > With mtprocs all threads will work until the end when the everything 
> > was done except the last DoAlotOfWork, which is then executed by only 
> > one thread.
> >
> > mtprocs is just a unit, it can not auto parallelize DoAlotOfWork as a 
> > compiler could.
> No, its just by architecture. Iterations are divide between threads. 
> Because thread are limited and costly we must limit granularity.
> CILK may work the same, also with loops, but main difference is under.

I don't understand what you want to say here, but I guess the answers
will lead too far away from lazarus anyway. I will wait for your
implementation.


> >> [...]
> >> I thinking about Fifo queue, I use one Lock free,
> >> its need 16 byte per spawn (func addres, param and result)
> >> time of swich less than 1us
> >
> > Are you sure about the 1us switch? The algorithm looks more dramatic.
> 
> Which algorithm? I say about pop and push form lock free queue. I use 
> this heavy with my webserver to distributing messages.

Sorry, I thought you was talking about the CILK scheduler.


Mattias




More information about the Lazarus mailing list