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


Groups > comp.programming.threads > #2244

A fast concurrent FIFO Queue that uses a two locks algorithm...

From aminer <aminer@toto.net>
Newsgroups comp.programming.threads, comp.programming
Subject A fast concurrent FIFO Queue that uses a two locks algorithm...
Date 2014-04-24 14:34 -0700
Organization albasani.net
Message-ID <ljblf8$ck2$1@news.albasani.net> (permalink)

Cross-posted to 2 groups.

Show all headers | View raw


Hello,

A fast concurrent FIFO Queue that uses a two locks algorithm...


Authors: Amine Moulay Ramdane


Description:

A concurrent FIFO queue that satisfies many requirements: it is FIFO 
fair, it minimizes efficiently the cache-coherence traffic and it is 
energy efficient on the pop() side: when there is no items in the queue 
it will not spin-wait , but it will block wait on my SemaMonitor.

You have 3 options for setting the kind of locks, just look inside 
defines.inc , if you want to set it for my array based lock called 
AMLock just uncomment the option AMLock inside defines.inc, if you want 
to set it for Ticket Spinlock just uncomment the option TicketSpinlock 
,If you want to set it for Spinlock just uncomment the option Spinlock, 
the Spinlock gives better performance under contention it scored 12.5 
millions of transactions per second on my 2.4 GHz Quadcore, the Ticket 
Spinlock option scored 3.2 millions of transactions per second on my 2.4 
GHz Quadcore, the Spinlock scaled even if the number of threads are 
greater than the number of cores, the TicketSpinlock and AMLock don't 
scale when the number of threads are greater than the number of cores, 
the Ticket Spinlock and scalable AMLock are optimal when the number of 
threads are equal to the number of cores.

The size of the queue must be passed to the constructor and it must be a 
power of 2.

Please take a look a the test.pas Object Pascal demo inside the zipfile, 
compile and run it...

Language: FPC Pascal v2.2.0+ / Delphi 7+: http://www.freepascal.org/

Operating Systems: Windows, Mac OSX , Linux , Unix...


Required FPC switches: -O3 -Sd -dFPC -dFreePascal

-Sd for delphi mode....

{$DEFINE CPU32} and {$DEFINE Windows32} for 32 bit systems

{$DEFINE CPU64} and {$DEFINE Windows64} for 64 bit systems




Thank you,
Amine Moulay Ramdane.

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


Thread

A fast concurrent FIFO Queue that uses a two locks algorithm... aminer <aminer@toto.net> - 2014-04-24 14:34 -0700
  Re: A fast concurrent FIFO Queue that uses a two locks algorithm... aminer <aminer@toto.net> - 2014-04-24 14:37 -0700

csiph-web