[concurrency-interest] padding in Exchanger

Ruslan Cheremin cheremin at gmail.com
Tue Jan 17 06:39:28 EST 2012


My question is about cache-line padding in j.u.c.Exchanger.Slot class:

private static final class Slot extends AtomicReference<Object> {
        // Improve likelihood of isolation on <= 64 byte cache lines
        long q0, q1, q2, q3, q4, q5, q6, q7, q8, q9, qa, qb, qc, qd, qe;
}

Comments telling about <=64 byte cache line padding, but it seems for
me what 15 longs*8 = 120 bytes (+8 bytes on object header, I suppose =
even 128). Why to have 128 bytes padding for 64 byte cache line? It
seems for me, what if I rely on one-side padding, I need only 7 longs
(+header).

----
Cheremin Ruslan


More information about the Concurrency-interest mailing list