Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scalable reference counting with efficient support for weak references version 1.01

0 views
Skip to first unread message

computer45

unread,
Mar 19, 2018, 4:29:37 PM3/19/18
to
Hello...

Scalable reference counting with efficient support for weak references
version 1.01

I have modified a little bit my scalable algorithm, now as you will
notice i am not using decrement with support for antitokens in the
balancers of the scalable counting networks, i am only using an
"increment", please look at my new scalable algorithm inside the zip
file, i think it is working correctly. Also notice that the returned
value of _AddRef() method will be valid if it is equal to 0, please read
also the following to understand better:

Author: Amine Moulay Ramdane

Description:

This is my scalable reference counting with support for efficient weak
references, and since problems that cannot be solved without weak
references are rare, so this library does scalable very well, this
scalable reference counting is implemented using scalable counting
networks that eliminate completely false sharing , so it is fully
scalable on multicore processors and manycore processors and this
scalable algorithm is optimized, and this library does work on both
Windows and Linux (x86), and it is easy to port to Mac OS X.

Here is the parameters of the constructor:

First parameter is: The width of the scalable counting networks that
permits my scalable refererence counting algorithm to be scalable, this
parameter must be 1 to 31, it is now at 4 , this is the power, so it is
equal to 2 power 4 , that means 24=16, and you have to pass this
counting networks width to the n of following formula:

(n*log(n)*(1+log(n)))/4

The log of the formula is in base 2

This formula gives the number of gates of the scalable counting
networks, and if we replace n by 16, this will equal 80 gates, that
means you can scale the scalable counting networks to 80 cores, and
beyond 80 cores you will start to have contention.

Second parameter is: a boolean that tells if reference counting is used
or not, it is by default to true, that means that reference counting is
used.

About the weak references support: the Weak<T> type supports assignment
from and to T and makes it usable as if you had a variable of T. It has
the IsAlive property to check if the reference is still valid and not a
dangling pointer. The Target property can be used if you want access to
members of the reference.

Note: the use of the IsAlive property on our weak reference, this tells
us whether the referenced object is still available, and provides a safe
way to get a concrete reference to the parent.

I have ported efficient weak references support to Linux by implementing
efficient code hooking, look at my DSharp.Core.Detour.pas file for Linux
that i have written to see how i have implemented it in the Linux
library. Please look at the example.dpr and test.pas demos to see how
weak references work etc.

Call _AddRef() and _Release() methods to manually increment or decrement
the number of references to the object.

You can download my library for Windows and Linux from:

https://sites.google.com/site/aminer68/scalable-reference-counting-with-efficient-support-for-weak-references


- Platform: Windows and Linux(x86)

Language: FPC Pascal v3.1.x+ / Delphi 2007+:

http://www.freepascal.org/

Required FPC switches: -O3 -Sd

-Sd for delphi mode....

Required Delphi switches: -$H+ -DDelphi

For Delphi XE versions and Delphi Tokyo use the -DXE switch

The defines options inside defines.inc are:

{$DEFINE CPU32} for 32 bit systems

{$DEFINE CPU64} for 64 bit systems


Thank you,
Amine Moulay Ramdane.

computer45

unread,
Mar 19, 2018, 4:51:34 PM3/19/18
to
On 3/19/2018 8:29 PM, computer45 wrote:
> Hello...
>
> Scalable reference counting with efficient support for weak references
> version 1.01
>
> I have modified a little bit my scalable algorithm, now as you will
> notice i am not using decrement with support for antitokens in the
> balancers of the scalable counting networks, i am only using an
> "increment", please look at my new scalable algorithm inside the zip
> file, i think it is working correctly. Also notice that the returned


I mean _Release(), not _AddRef().
0 new messages