[Mono-list] Interlocked on a SMP machine

P. Oscar Boykin oscar.boykin at gmail.com
Fri Jun 22 02:07:47 EDT 2007


I have some code that is implemented two ways.  Once using a standard
lock, and once using System.Threading.Interlocked and no locks
whatsoever.

Both seem to function correctly, however, the Interlocked version
seems to only use one CPU (my max CPU is 100%).  When using the lock
based version, the CPU utilization goes to 200% (approximately).
Thus, the lock version is much faster.

Is this to be expected?  Have I misunderstood Interlocked?  Is it a
limitation in mono?

This was on mono 1.2.3 from Ubuntu 7.04.

Thanks.


More information about the Mono-list mailing list