In both cases the selects use a shared lock and the updates an exclusive lock.
In READ COMMITTED mode, the shared lock is released immediately after the select finishes.
In REPEATABLE READS mode, the shared locks for the selects are held untill the end of the transaction, to ensure that no other sessions can change the data that was read. A new read within the same transaction is garantueed to yield the same results, unless the data was changed in the current session/transaction
SoOriginally I thought, that you executed "First" in both sessions. Then the REPEATABLE READ scenario,explanation would be trivial: both session 1 and 2sessions acquire and get a shared lock successfully and the selects do not block each other. Next, which then blocks the sessions want to acquire an exlusiveexclusive lock required for the updates, but can't because the other.
The situation with a second session doing only an update is holding a shared locklittle more complex. AAn update staement will first acquire an update lock (UPDLOCK) for selecting the rows that must be updated, which is probably similar to a shared lock does, but at least not block otherblocked by a shared lockslock. Next, but preventswhen the data is actually updated, it tries to convert the update lock to an exclusive locks. Thislock, which fails, because the first session is still holding the deadlock situation: both sessions hold a shared lock that blocks the. Now both sessions block each other session and neither session can unblock, because it can never finish its transaction.