Debugging Critical Section lockups

David D. Hagood wowbagger at sktc.net
Wed Nov 30 18:27:57 CST 2005


Robert Shearman wrote:
> David D. Hagood wrote:
> 

> 
> Unless the installer is using TryEnterCriticalSection, I would expect 
> CPU utilisation to be 0% when deadlocking.

Yes, *once the deadlock occurs* the CPU drops to 0%. The issue (I think) 
  is more along the lines of this:

On fast CPU:

thread 1 locks resource A, does something, locks B, unlocks B, unlocks A.

Thread 2 locks B, does something, locks A, does something, unlocks  C, A.

On slow machine:

Thread 1 locks resource A, does something.

Context switch.

Thread 2 locks B, does something.

Context switch

Thread 1 tries to lock B and blocks.

Context switch.

Thread 2 tries to lock A and blocks.

Deadlock.

In other words, on the fast CPU the deadlock does not happen because 
thread 1 gets everything done before thread 2 starts. On the slow 
machine, thread 2 starts while thread 1 is still doing stuff.




More information about the wine-devel mailing list