[Lazarus] thread safe
Michael Schnell
mschnell at lumino.de
Tue Jun 28 11:36:05 CEST 2011
On 06/27/2011 08:01 PM, Andrew Brunner wrote:
>
> That all changed with the introduction of multi-core systems. But in
> those days everything was inline. Now a days everything is running
> in parallel.
>
Yep. But the user application code just sees threads.
Since ages, the user code needs to consider threads to work concurrently
and any instruction of each active thread can be executed at exactly the
same time, exactly as if each thread has it's own CPU. So any possible
concurrent access needs to be protected by the means that are offered by
the appropriate libraries (e.g. critical section).
Thus regarding the user code there is no difference at all. The dirty
details need to be handled by the infrastructure (compiler, libraries, OS).
If the user code needs more performance that this simple paradigm can
offer it might introduce low level stuff (such as interlocked
instructions). But I would not consider such programs "user code" any more.
-Michael
More information about the Lazarus
mailing list