Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.
1696 Discussions

Cache Coherency problem on i5-520 and Xeon multi core


We have some lock free code which use atomic CAS. That translates to "lock+cmpxchgl" instruction for x86 architecture. The code operates on multiple cores. We see that at times cache on different cores has stale entries, i.e., Core 0 has X but Core 1 has a previous value X'. At other times a transaction was lost as if the lock+cmpxchgl never happened. Has anyone faced such issues?

The ASM primitives used are:

[cpp]#define LOCK_PREFIX "lock;" #define atomic_cmpxchgl(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ __asm __volatile (LOCK_PREFIX "cmpxchgl %2, %1" \ : "=a" (ret), "=m" (*mem) \ : "r" ((uint32_t) (newval)), "m" (*mem), \ "0" ((uint32_t) (oldval))); \ ret; }) [/cpp]

Usage in C code ...

[cpp] do { } while (atomic_cmpxchgl(&elem->hdr, CONSUMER_FREE, PRODUCER_BUSY) != PRODUCER_BUSY); [/cpp]
Any comments or pointers shall be appreciated.

Somnath Mitra.
0 Kudos
1 Reply

Microsoft Office 2010 is actually the newest software from microsoft office 2010 keys Microsoft Corporation introduced in the last year. Its leading aims tend to be to catch the present business requirements and to be on top of every competition with regard to the international market criteria. This can be a very good idea to obtain Microsoft Office 2010 Key immediately to maintain norton antivirus keys yourself up-to-date and to present you with the vast qualified progress opportunities for success. Microsoft Office 2010 is available in both 32-bit and 64-bit editions, but attention please the two are not able to co-exist on the very same personal computer. All of the Office 2010 editions are kaspersky antivirus keys suitable for Windows XP SP3, Windows Vista and Windows 7.

0 Kudos