[fpc-pascal] Multi-threaded project with few locks (no Thread.waitfor). Memory consumption keeps increasing on Ubuntu 10.10 x64
Jonas Maebe
jonas.maebe at elis.ugent.be
Wed Oct 13 15:36:02 CEST 2010
On 13 Oct 2010, at 15:27, Jonas Maebe wrote:
> 1) on entry of the "critical section" protected by this variable,
> you can have problems, because this sequence:
>
> locked:=true;
> local:=shared_global_var;
Of course, you normally need an atomic operation here to set "locked"
to true (otherwise multiple threads can set it true at the same time),
which is presumably why the x86 performs this kind of reordering (it
will not reorder past atomic loads/stores). And you don't need an
atomic operation to unlock, which is why it presumably does not
perform any reordering in that situation.
Jonas
More information about the fpc-pascal
mailing list