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


Groups > comp.lang.pascal.misc > #1045

A very fast concurrent FIFO Queue and a very fast concurrent priority FIFO Queue version 1.2

From Ramine <ramine@1.1>
Newsgroups comp.lang.pascal.misc
Subject A very fast concurrent FIFO Queue and a very fast concurrent priority FIFO Queue version 1.2
Date 2014-11-21 12:52 -0800
Organization A noiseless patient Spider
Message-ID <m4nu26$m2f$4@dont-email.me> (permalink)

Show all headers | View raw


Hello...


A very fast concurrent FIFO Queue and a very fast concurrent priority 
FIFO Queue version 1.2


Author: Amine Moulay Ramdane


Description:

A very fast concurrent FIFO queue and a very fast concurrent priority 
FIFO queue that satisfy many requirements: they have more parallelism 
than the two locks algorithm, they are starvation-free and FIFO fair on 
the push() side and they are lockfree on the pop() side, and they 
minimizes efficiently the cache-coherence traffic and they are energy 
efficient on the pop() side when you set the wait parameter to true in 
the construtor: when there is no items in the queue they will not 
spin-wait , but they will block wait on my emaMonitor, and when the wait 
parameter of the constructor is set to false they uses only an atomic 
increment on the push() side and a CAS on the pop() side, so they are 
very fast. This concurrent FIFO queue and concurrent priority FIFO queue 
are limited to 1000 threads on the push() side, if you want to higher 
that, just modify the "margin" constant in the source code.

You have 3 options for setting the kind of locks, just look inside 
defines.inc , if you want to set it for my scalable lock called MLock 
just uncomment the option MLock 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 
MLock option scored 12.0 millions of transactions per second on my 2.4 
GHz Quadcore, the Spinlock scaled better even if the number of threads 
are greater than the number of cores, the TicketSpinlock and MLock don't 
scale well when the number of threads are greater than the number of 
cores, the Ticket Spinlock and scalable MLock are optimal when the 
number of threads are equal to the number of cores, and when the wait 
parameter of the constructor is false it scales even if the number of 
threads are greater than the number of cores.

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


You can download them from:

https://sites.google.com/site/aminer68/concurrent-fifo-queue-2



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

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

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

-Sd for delphi mode....

Required Delphi switches:  -$H+ -DDelphi

{$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.lang.pascal.misc | Previous | NextNext in thread | Find similar | Unroll thread


Thread

A very fast concurrent FIFO Queue and a very fast concurrent priority FIFO Queue version 1.2 Ramine <ramine@1.1> - 2014-11-21 12:52 -0800
  Re: A very fast concurrent FIFO Queue and a very fast concurrent priority FIFO Queue version 1.2 Ramine <ramine@1.1> - 2014-11-21 13:10 -0800

csiph-web