Rating: No reviews yet
Downloads: 153
Change Set: 4847
Released: Dec 6, 2010
Updated: Dec 6, 2010 by TamusJRoyce
Dev status: Beta Help Icon

Recommended Download

application, 500K, uploaded Dec 6, 2010 - 153 downloads

Release Notes

New IdBasedReferenceCounter. It distributes ManagedThreadId across an array of buckets. Each bucket is contains a collection of <Key, Value> pairs, where key is a ManagedThreadId and Value is the number of times that particular thread has been used for locking (allowing recursive locking). Each bucket also manages its own thread locking so that adding and removing items to separate buckets occurs in parallel.

IdBasedReferenceCounter increases parallelism dramatically. It is used track read-lock to write-lock upgrading and to prevent deadlocks. Tracking read-locking allows you to read-lock and then immediately write-lock (in the same thread) without deadlocking.

It also no longer uses ReaderWriterLockAlt ( PulseAll. A big speedup was seen after abandoning SyncLock/PulseAll and instead using Sleep(1). This forces the thread-context to change and so other threads can check their respective loops. P.S. It doesn't really sleep for 1 ms.

This locker is now much faster than it previously was. But it is still 2-3x slower than ReaderWriterLockSlim. This is mainly due to allowing read and then write locking without deadlocking (and not needing UpgradeReadToWriteLock() functionality). In the future, I hope to have this fixed so it is at most 1.5-2x slower than ReaderWriterLockSlim.

Reviews for this release

No reviews yet for this release.