Author Topic: ParallelQueueh ...  (Read 3929 times)


  • Hero Member
  • *****
  • Posts: 956
ParallelQueueh ...
« on: March 11, 2010, 09:39:24 pm »



Parallel algorithm to handle unbounded queue FIFO that
use a parallel hash table (look at inthashlist inside the zip) with
O(1) (best case) and O(n)(worst case) access.

It's for educational purpose.

Language: FPC Pascal v2.2.0+ / Delphi 5+:

Operating Systems: Win , Linux and Mac (x86).
For ParallelQueue benchmarks on an Intel Core 2 Quad Q6600 look

You can download ParallelQueueh at:


I have modified the Hashlist (by Barry Kelly, search for it in
goolge) , now the Add(), Has(), Find() etc.does use integer
as a key instead of string argument. And also i have modified
the FindNode() method(look inside inthashlist.pas) to support
integer argument, now hashlist's FindNode() look like this :
if s < ppn^^.Str then r:=-1
else if s > ppn^^.Str then r:=1
else r:=0;
{ left, then right, then match }
if r < 0 then
ppn := @ppn^^.Left
else if r > 0 then
ppn := @ppn^^.Right
And i have added the parallel part in inthashlist...


ParallelQueueh is an unbounded FIFO (for educational purpose),

But ParallelQueue and lockfree_mpmc look in:
are very fast and very good lockfree bounded queue algorithms.

Note also that the Freepascal memory manager does scale linearly
when using threads..

But the Delphi memory manager does not scale linearly, so,. i have
used the TBB memory manager in delphi (look into cmem.pas inside the

Amine Moulay Ramdane.


  • Hero Member
  • *****
  • Posts: 956
Re: ParallelQueueh ...
« Reply #1 on: March 11, 2010, 09:40:55 pm »

Hello again,

And don't forget to compile with -Sd (delphi mode) when
using FPC or Lazarus...

Amine Moulay Ramdane.


TinyPortal © 2005-2018