wadeb
20-Nov-2007, 20:31
Hello,
I am wondering if anyone else has found the need to implement exponential backoff in their low level atomics on Cell - atomic Add, Or, And, CompareAndSwap, etc.
We are seeing an issue in our job manager where all 6 SPUs and both PPUs are trying to lock the same mutex, and it *occasionally* takes several milliseconds of fighting before one of them gets it.
The locking mechanism is essentially:
while (!CompareAndSwap(&mutex->Lock, MyThreadID, 0));
The PPU threads are doing a yield in the while loop, the SPU threads are doing nothing.
CompareAndSwap is implemented using lwarx/stcwx on PPU and getllar/putllc on SPU.
So I'm wondering:
a) Has anyone else seen this behavior in their applications?
b) Is exponential backoff the right solution?
I'm thinking of something similar to what ethernet does: http://en.wikipedia.org/wiki/Truncated_binary_exponential_backoff
But I will need my random function to be fast and to not have degenerate cases that would still cause fighting.
Regards,
Wade
I am wondering if anyone else has found the need to implement exponential backoff in their low level atomics on Cell - atomic Add, Or, And, CompareAndSwap, etc.
We are seeing an issue in our job manager where all 6 SPUs and both PPUs are trying to lock the same mutex, and it *occasionally* takes several milliseconds of fighting before one of them gets it.
The locking mechanism is essentially:
while (!CompareAndSwap(&mutex->Lock, MyThreadID, 0));
The PPU threads are doing a yield in the while loop, the SPU threads are doing nothing.
CompareAndSwap is implemented using lwarx/stcwx on PPU and getllar/putllc on SPU.
So I'm wondering:
a) Has anyone else seen this behavior in their applications?
b) Is exponential backoff the right solution?
I'm thinking of something similar to what ethernet does: http://en.wikipedia.org/wiki/Truncated_binary_exponential_backoff
But I will need my random function to be fast and to not have degenerate cases that would still cause fighting.
Regards,
Wade