[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.programming

Benchmarks of my lightweight SemaCondvar and SemaMonitor

Ramine

11/2/2014 4:58:00 PM



I correct...

Hello,


I have just benchmarked my SemaMonitor against the Windows Semaphore,
and the Windows Semaphore is only 37% faster than my SemaMonitor,
I compiled it for Win64 platform and my SemaMonitor is faster on
it, so i think my SemaMonitor and my SemaCondvar are useful and
powerful synchronization mechanisms.

SemaCondvar and SemaMonitor are new and portable synchronization objects
, SemaCondvar combines all the charateristics of a semaphore and a
condition variable and SemaMonitor combines all charateristics of a
semaphore and an eventcount , they only use an event object and and a
very fast and very efficient and portable FIFO fair Lock , so they are
fast and they are FIFO fair.

Now you can pass the SemaCondvar's initialcount and SemaCondvar's
MaximumCount to the construtor, it's like the Semaphore`s InitialCount
and the Semaphore's MaximumCount.

Like this:

t:=TSemaMonitor.create(true,0,4);

When you pass True in the first parameter of the constructor the
signal(s) will not be lost even if there is no waiting threads, if it's
False the signal(s) will be lost if there is no waiting thread.

Here is the methods that i have implemented :

TSemaCondvar = class
public

constructor
Create(m1:TCriticalSection;state1:boolean=false;InitialCount1:longword=0;MaximumCount1:longword=INFINITE);
destructor Destroy; override;
function wait(mstime:longword=INFINITE):boolean;
procedure signal();overload;
procedure signal_all();
procedure signal(nbr:integer);overload;
function WaitersBlocked:integer;
end;

TSemaMonitor = class
public
constructor
Create(state1:boolean=false;InitialCount1:longword=0;MaximumCount1:longword=INFINITE);
destructor Destroy; override;
function wait(mstime:longword=INFINITE):boolean;
procedure signal();overload;
procedure signal_all();
procedure signal(nbr:integer);overload;
function WaitersBlocked:integer;
end;




You can download my lightweight SemaCondvar and Semamonitor that are
faster from:

https://sites.google.com/site/aminer68/light-weight-semacondvar-s...



Thank you,
Amine Moulay Ramdane.
1 Answer

Ramine

11/2/2014 5:11:00 PM

0


I wrote:

"SemaMonitor combines all charateristics of a semaphore and an eventcount"


In fact my SemaMonitor is more powerful than that, cause when you pass
True in the first parameter of the constructor the signal(s) will not be
lost even if there is no waiting threads, if it's False the signal(s)
will be lost if there is no waiting threads.
That the same for my SemaCondvar.


Hope this is clear now.



Than you,
Amine Moulay Ramdane.