AW: [fpc-devel] Lock Free Memory Management

Florian Klaempfl florian at freepascal.org
Sat Aug 19 19:45:15 CEST 2006


Helmut Hartl wrote:
>  > >> Does the Codegenerator already support this?
>  > >> Are they portable?
>  > >> How would you suggest to implement such operations platform
>  > independent?
>  > >
>  > > I don't think this is possible, as it depends on processor support
> ?
>  > 
>  > I think it can be implemented easily using
> InterlockedCompareExchange,
>  > no?
> 
> Yes it will be but to my knowledge there exists no platform independent
> version of InterlockedCompareExchange in Free Pascal...and even none for
> 64Bit.

That's true.

> 
> For a new memory manager there must be a lowlevel function supporting
> this.
> Also this operation must not be reordered/optimized by the compiler.
> 
> The operation should preferrably be a
> InterlockedCompareExchangePointer()
> wich always does the right thing :-) depending on architecture ... 

Well, at least on sparc it uses a hidden global lock, so there it's
pretty useless :)

> 
> For the interested ...
> 
> http://en.wikipedia.org/wiki/Compare-and-swap
> 
> http://groups.google.de/group/comp.programming.threads/browse_frm/thread
> /d062e1bfa460a375/3461ab7dd927a6ec?group=comp.programming.threads#3461ab
> 7dd927a6ec
> 
> 
> helmut
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list