Bob Dorr migrates over a couple of posts on locking. The first one describes lock enumeration:
SQL Server has a lock iterator class which is used by Lock Monitor (deadlock detection), DMVs such as dm_tran_locks and other workers. The iterator is designed to remain lock free whenever possible to avoid contention with active queries. To accomplish this the iterator uses a marker (bookmark) approach and the lock type of NL. The NL lock does not block and provides a bookmark (reference count and location) supporting the iterator.
Shared access blocks exclusive acquire requests. The shared access needs only to acquire on the worker’s local partition. An attempt to acquire exclusive access is blocked by the shared access holders. Conversely to acquire exclusive access the worker must acquire the exclusive access of every partition. The exclusive acquisition path is longer than the shared path because N partitions must be acquired to achieve the exclusive access. Increasing the number of partitions increases the work required to acquire exclusive access. This means that only certain protection paths should use the partitioning approach.
Both get pretty deep into internals.