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


Groups > comp.programming.threads > #1148

Re: Threadpool engien and scalability [1]

From "aminer" <aminer@videotron.ca>
Newsgroups comp.programming.threads, comp.programming
Subject Re: Threadpool engien and scalability [1]
Date 2012-10-01 13:34 -0500
Organization A noiseless patient Spider
Message-ID <k4ck7t$mtl$1@dont-email.me> (permalink)
References <k4ci68$8ho$1@dont-email.me>

Cross-posted to 2 groups.

Show all headers | View raw


Hello,

As you will notice, inside the new exucuted1() i have used the same method
as with my implementation of the Distributed Reader-Writer Mutex 1.04
and i am using a variable number of mrews to lower the contention
more in my implementation of Distributed Reader-Writer Mutex 1.04
based on the Dmitry Vyukov C++ Distributed Reader-Writer Mutex,
and as i said i am using mutiple lockfree FIFO queues inside my threadpool 
engine,
so that there is less contention and using work-stealing also, so after 
adding the execute1()
method , this threadpool engine will become scalable and this threadpool 
engine can also
be used as a scalable queue(not a strict FIFO queue, but almost, and it will 
be also useful).

This threadpool engine is useful and that is what's important.

I will try to update my threadpol engine soon.

You can download Distributed Reader-Writer Mutex and my other paralle 
libraries
from:

http://pages.videotron.com/aminer/




Amine Moulay Ramdane.



"aminer" <aminer@videotron.ca> wrote in message 
news:k4ci68$8ho$1@dont-email.me...
> Hello,
>
> I have corrected my mistakes , please read again:
>
> If you take a look at my threadpool engine:
>
> http://pages.videotron.com/aminer/
>
> you will notice that it does not scale in the execute() method
> cause LockedIncLong(balance1) is expensive.
>
> here is the execute method:
>
> ==
>
> function TThreadPool.execute(func:TMyProc;const Context: Pointer): 
> Boolean;
>
> var
> local_balance,local_count:long;
>
> params: PParams;
> p:pointer;
>
> begin
> new(params);
> setlength(params^,1);
> params^[0].proc:=func;
> params^[0].data:=context;
>
> local_balance:=LockedIncLong(balance1) mod FThreadCount;
> while not Queues[local_balance].push(tobject(params)) do sleep(0);
> events[local_balance].setevent;
> end;
>
> ===
>
> Now to be able to scale the execute() method we have to add a new
> execute1() method that will be called from mutiple threads, i have to
> use LockedIncLong() but it will be called only once:
>
> ==
>
> function TThreadPool.execute1(func:TMyProc;const Context:
> Pointer;index:long): Boolean;
>
> params: PParams;
> p:pointer;
>
> begin
> new(params);
> setlength(params^,1);
> params^[0].proc:=func;
> params^[0].data:=context;
>
> if index = 0
> then
> begin
> index:=LockedIncLong(balance1) mod FThreadCount;
> end;
>
> while not Queues[index].push(tobject(params)) do sleep(0);
> events[index].setevent;
> end;
>
> =
>
>
> so we have to call the execute1() method from mutiple threads like this:
>
> and we have to initialize index to zero before:, like this:
>
> ThreadPool.execute1(myproc,data,index)
>
> I am using mutiple lockfree FIFO queues inside my threadpool engine,
> so that there is less contention and using work-stealing also, so after
> adding execute1() methods , this threadpool engine will become scalable.
> this threadpool engine can also be used as a scalable queue
> (not a strict FIFO queue, but it's also useful).
>
> This threadpool engine is useful and that is what's important.
>
>
>
> I will try to update my threadpol engine soon.
>
>
>
> Thank you,
> Amine Moulay Ramdane.
>
>
>
> 

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


Thread

Threadpool engien and scalability [1] "aminer" <aminer@videotron.ca> - 2012-10-01 12:59 -0500
  Re: Threadpool engien and scalability [1] "aminer" <aminer@videotron.ca> - 2012-10-01 13:34 -0500
  Re: Threadpool engien and scalability [1] "aminer" <aminer@videotron.ca> - 2012-10-01 13:48 -0500
  Re: Threadpool engien and scalability [1] "aminer" <aminer@videotron.ca> - 2012-10-01 14:02 -0500

csiph-web