Author Topic: Threadpool with priorities 1.54 (stable version)  (Read 2095 times)


  • Hero Member
  • *****
  • Posts: 956
Threadpool with priorities 1.54 (stable version)
« on: December 21, 2013, 06:15:43 pm »


Threadpool with priorities was updated to version 1.54 (stable version), and threadpool was updated to version 1.55, i have changed something inside the scalable Anderson lock so that the exemples works correcly, now Threadpool with priorities is very stable.

Author: Amine Moulay Ramdane

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

Operating Systems: Win , Linux and Mac (x86).


Thread Pool Engine.

The following have been added:

- You can give the following priorities to jobs:


- Uses a 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(): when there is no items in the queue it will not spin-wait , but it will wait on a portable manual event object..

- Enters in a wait state when there is no job in the queue - for more efficiency -

- You can distribute your jobs to the workers threads and call any method with the threadpool's execute() method.

- Uses O(1) complexity on enqueue and O(3) worst case complexity  on dequeue.

Look into there is many options:

CPU32: for 32 bits architecture
CPU64: for 64 bits architecture

Please read an article that i wrote about my Threadpool engine: article.

Look at test1.pas demo inside the zip file...

You can dowload Threadpool with priorities 1.54 from:

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

-Sd for delphi mode....

Required Delphi switches: -DMSWINDOWS -$H+

For Delphi 5,6,7 use -DDelphi

For Delphi 2005,2006,2007,2009,2010+ use the switch -DDELPHI2005+

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

{$DEFINE CPU64} and {$DEFINE Win64} for 64 bit systems
Note: testpool.pas is a parallel program of a Matrix multiply by a vector that uses SSE+ and it requires Delphi 5+. test.pas and test_thread.pas works with both FreePascal and Delphi.

Thank you,
Amine Moulay Ramdane.


TinyPortal © 2005-2018