[concurrency-interest] Class striped/ordered Thread Pool

Aleksey Shipilev aleksey.shipilev at gmail.com
Sat May 12 08:47:01 EDT 2012


You seem to have pretty generic approach for making arbitrary executor
look like striped one. I would be naturally to assume the number of
stripes is arbitrary as well. ;) The race-free purges in these
MultiMap-like cases is rather hard for inexperienced concurrency guys;
much harder than writing the baseline map-queue-based implementation.
That's why I think suggesting the baseline map-queue-based
implementation and asking to fit purges there is like selling someone
the house with a minefield in the yard.

-Aleksey.

On Sat, May 12, 2012 at 4:35 PM, √iktor Ҡlang <viktor.klang at gmail.com> wrote:
> It'll only be an issue if you have arbitrary stripes. Fixing that is a great
> exercise to the reader!
>
> Cheers,
> V
>
> On May 12, 2012 1:55 PM, "Aleksey Shipilev" <aleksey.shipilev at gmail.com>
> wrote:
>>
>> On Sat, May 12, 2012 at 2:09 PM, √iktor Ҡlang <viktor.klang at gmail.com>
>> wrote:
>> > Here's an implementation I threw together (haven't been tested yet so
>> > YMMV)
>> > that should make any Executor into a striped one, for every runnable
>> > that is
>> > put in there which is Striped.
>> >
>> > https://gist.github.com/2665603
>>
>> Neat trick, but it is prone to memory leaks. You will have to protect
>> yourself from multiple stripe classes come and go, that is, there is a
>> garbage buildup in $stripes map, if some stripes are not being used
>> (from some point, forever). Getting that right in race-free manner is
>> tough.
>>
>> -Aleksey.



More information about the Concurrency-interest mailing list