[concurrency-interest] ForkJoin updates

Alex Lam S.L. alexlamsl at gmail.com
Sun Mar 4 15:58:31 EST 2012


On Sun, Mar 4, 2012 at 7:55 PM, Doug Lea <dl at cs.oswego.edu> wrote:
> On 03/04/12 14:50, Alex Lam S.L. wrote:
>>>
>>> (No, we can't support the nicer-to-use "int" without hurting other
>>> FJ usages.)
>>
>>
>> Would you mind elaborate more on this? Is this something to do with
>> the 2-byte overhead being too significantly when the number of tasks
>> are large?
>
>
>
> No -- we have some spare bits in a control word that we must keep
> atomically updated anyway. So we can let users use 16 of them for tags.
> But we can't magically add any more bits and still maintain atomic
> updates that are both cheap and coordinated with state changes.

I see - thanks for the explanation.

As for the API - in OutputStream for example, they provide the write()
method using "int", but document them such that only the lowest byte
is used:

http://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html#write(int)

Would that be a good pattern to adopt here, for convenience?


Alex.


>
> -Doug
> _______________________________________________
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
> http://cs.oswego.edu/mailman/listinfo/concurrency-interest


More information about the Concurrency-interest mailing list