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


Groups > comp.programming.threads > #2657

Benchmarks of my lightweight SemaMonitor and SemaCondvar

From Ramine <ramine@1.1>
Newsgroups comp.programming.threads
Subject Benchmarks of my lightweight SemaMonitor and SemaCondvar
Date 2014-11-02 08:57 -0800
Organization A noiseless patient Spider
Message-ID <m35d6i$s5t$2@dont-email.me> (permalink)

Show all headers | View raw


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



Thank you,
Amine Moulay Ramdane.

Back to comp.programming.threads | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Benchmarks of my lightweight  SemaMonitor and SemaCondvar Ramine <ramine@1.1> - 2014-11-02 08:57 -0800
  Re: Benchmarks of my lightweight  SemaMonitor and SemaCondvar Ramine <ramine@1.1> - 2014-11-02 09:10 -0800

csiph-web