Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #4084 > unrolled thread

Scalable reference counting with efficient support for weak references version 1.0

Started bycomputer45 <computer45@cyber.com>
First post2018-03-19 18:52 -0400
Last post2018-03-19 18:52 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.programming.threads


Contents

  Scalable reference counting with efficient support for weak references version 1.0 computer45 <computer45@cyber.com> - 2018-03-19 18:52 -0400

#4084 — Scalable reference counting with efficient support for weak references version 1.0

Fromcomputer45 <computer45@cyber.com>
Date2018-03-19 18:52 -0400
SubjectScalable reference counting with efficient support for weak references version 1.0
Message-ID<p8p0tv$nru$2@dont-email.me>
Hello..

Scalable reference counting with efficient support for weak references 
version 1.0

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 Max 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 2^4=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.

[toc] | [standalone]


Back to top | Article view | comp.programming.threads


csiph-web