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


Groups > comp.programming.threads > #2136 > unrolled thread

Scalable and relaxed MPMC priority Queue was updated to version 1.06...

Started byaminer <aminer@toto.net>
First post2014-04-04 15:32 -0700
Last post2014-04-04 15:35 -0700
Articles 2 — 1 participant

Back to article view | Back to comp.programming.threads


Contents

  Scalable and relaxed MPMC priority Queue was updated to version 1.06... aminer <aminer@toto.net> - 2014-04-04 15:32 -0700
    Re: Scalable and relaxed MPMC priority Queue was updated to version 1.06... aminer <aminer@toto.net> - 2014-04-04 15:35 -0700

#2136 — Scalable and relaxed MPMC priority Queue was updated to version 1.06...

Fromaminer <aminer@toto.net>
Date2014-04-04 15:32 -0700
SubjectScalable and relaxed MPMC priority Queue was updated to version 1.06...
Message-ID<lhnbru$fb4$1@news.albasani.net>
Hello,

My scalable and relaxed MPMC priority Queue was updated to version 1.06
now when there is no items in the queue it stills from the other queues 
in a round robin manner.


Author: Amine Moulay Ramdane


Description:

A scalable and relaxed MPMC priority Queue.

Relaxed means not a strict FIFO, but it's almost a strict FIFO, it 
processes the jobs in a FIFO order in each queue, and when there is no 
items in the queue the thread stills from the other queues in a round 
robin manner, that's good.

Where can my scalable and relaxed MPMC priority Queue be useful ?

When for example you want to do something like a threadpool that do 
parallel tasks, and you can find that in many applications that do 
parallel mathematical calculations or parallel mechanical or graphic 
calculations and  many parallel tasks... so you will reduce on those 
applications the S part in the Amdahl equation using my scalable and 
relaxed MPMC priority Queue.

The number of  consumer threads and the number of producers must be 
equal to the number of queues that you  pass to the constructor so that 
it become scalable, and you have to initialize first the Push() method 
with high(pqueue.long), look at how to do it inside the test1.pas 
example inside the zip file.

The following have been added:

- You can give the following priorities to jobs:

LOW_PRIORITY
NORMAL_PRIORITY
HIGH_PRIORITY

- A queue for each worker thread and it uses work-stealing - for more 
efficiency -

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

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

Look into defines.inc there is many options:

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

Look test.pas and  at test1.pas examples inside the zip file that shows 
you that my PQueue is scaling.

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

-Sd for delphi mode....

Required Delphi switches: -DMSWINDOWS -$H+

For Delphi 5,6,7 use -DDelphi



Thank you,
Amine Moulay Ramdane.

[toc] | [next] | [standalone]


#2137

Fromaminer <aminer@toto.net>
Date2014-04-04 15:35 -0700
Message-ID<lhnc0r$fb4$4@news.albasani.net>
In reply to#2136
On 4/4/2014 3:32 PM, aminer wrote:
>
> Hello,
>
> My scalable and relaxed MPMC priority Queue was updated to version 1.06
> now when there is no items in the queue it stills from the other queues


Sorry , i mean it steals , not still.

> in a round robin manner.
>
>
> Author: Amine Moulay Ramdane
>
>
> Description:
>
> A scalable and relaxed MPMC priority Queue.
>
> Relaxed means not a strict FIFO, but it's almost a strict FIFO, it
> processes the jobs in a FIFO order in each queue, and when there is no
> items in the queue the thread stills from the other queues in a round
> robin manner, that's good.
>
> Where can my scalable and relaxed MPMC priority Queue be useful ?
>
> When for example you want to do something like a threadpool that do
> parallel tasks, and you can find that in many applications that do
> parallel mathematical calculations or parallel mechanical or graphic
> calculations and  many parallel tasks... so you will reduce on those
> applications the S part in the Amdahl equation using my scalable and
> relaxed MPMC priority Queue.
>
> The number of  consumer threads and the number of producers must be
> equal to the number of queues that you  pass to the constructor so that
> it become scalable, and you have to initialize first the Push() method
> with high(pqueue.long), look at how to do it inside the test1.pas
> example inside the zip file.
>
> The following have been added:
>
> - You can give the following priorities to jobs:
>
> LOW_PRIORITY
> NORMAL_PRIORITY
> HIGH_PRIORITY
>
> - A queue for each worker thread and it uses work-stealing - for more
> efficiency -
>
> - Enters in a wait state when there is no job in the queue - for more
> efficiency -
>
> - Uses O(1) complexity on enqueue and O(3) worst case complexity on
> dequeue.
>
> Look into defines.inc there is many options:
>
> CPU32: for 32 bits architecture
> CPU64: for 64 bits architecture
>
> Look test.pas and  at test1.pas examples inside the zip file that shows
> you that my PQueue is scaling.
>
> Required FPC switches: -O3 -Sd -dFPC -dWin32 -dFreePascal
>
> -Sd for delphi mode....
>
> Required Delphi switches: -DMSWINDOWS -$H+
>
> For Delphi 5,6,7 use -DDelphi
>
>
>
> Thank you,
> Amine Moulay Ramdane.
>
>

[toc] | [prev] | [standalone]


Back to top | Article view | comp.programming.threads


csiph-web