AW: [fpc-devel] Lock Free Memory Management

Helmut Hartl helmut.hartl at firmos.at
Sat Aug 19 17:50:02 CEST 2006


> >>
 > >> 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.

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 ... 

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



More information about the fpc-devel mailing list