Hello,
I have to prove my scalable reference counting algorithm, like with
mathematical proof, so i will use logic to prove like in PhD papers:
You will find the code of my scalable reference counting inside
AMInterfacedObject.pas inside the zip file here:
https://sites.google.com/site/aminer68/scalable-reference-counting-with-efficient-support-for-weak-references
If you look inside the code there is two methods, _AddRef() and
_Release() methods, i am using two scalable counting networks,
think about them like counters, so in the _AddRef() method i am
executing the following:
v1 := counting_network_next_value(cn1);
cn1 is the scalable counting network, and counting_network_next_value()
is a function that increment the scalable counting network by 1.
In the _Release() method i am executing the following:
v2 := counting_network_next_value(cn1);
v1 := counting_network_next_value(cn2);
v1 := counting_network_next_value(cn2);
So my scalable algorithm is "smart", because the logical proof is
that i am calling counting_network_next_value(cn1) first in the
above, so this allows my scalable algorithm to work correctly,
because we are advancing cn1 by 1 to obtain the value of cn1,
so the other threads are advancing also cn1 by one inside
_Release() , it is the last thread that is advancing cn1
by 1 that will make the reference counter equal to 0 , so
this scalable algorithm is working. Please look more carefully
at my algorithm and you will notice that it is working as
i have just logically proved it.
Thank you,
Amine Moulay Ramdane.