[Lazarus] Threads in Lazarus code base
Dariusz Mazur
darekm at emadar.com
Tue Sep 21 12:24:29 CEST 2010
W dniu 2010-09-21 09:51, Michael Schnell pisze:
> On 09/18/2010 06:08 PM, Dariusz Mazur wrote:
>> with CILK approach we deal with task, not threads.
> IMHO this does not make much sense.
>
> For the user-programmer, the relevant difference between tasks and
> threads is that thread share memory.
>
> This results in the increasing complexity with mutually accessed
> variables which of course provides a real challenge.
>
> But you can think of a programming paradigm (=CILK") that does not
> allow the user programmer to share the variables between the "tasks"
> even though the "tasks" in fact are threads as far as the OS is
> concerned.
>
> Not the tasks switch is done with a lot less overhead as the OS does
> not need to change the environment (such as MMU tables), the cache is
> used more efficiently (especially on ARM as here the cache needs to be
> cleared with each change in the MMU tables).
>
> The communication between the tasks (here done not by the user but by
> would be automated the system (e.g. CILK) would be a lot faster when
> it uses threads instead of processes, as it could easily make uses of
> shared memory (though hidden from the user).
I don;t understand. You say "processes" , but i don't talk about it.
Task for me (in CILK approach) is thing, that only program itself care
about without OS help (as in threads).
Task is function, which can be invoke by worker any time (similar to
events) and stop on sync. Deal with memory is the same as normal MT
program. Workers run as normal threads.
--
Darek
More information about the Lazarus
mailing list