onstat -g spi Spin Locks with Long Spins

The onstat -g spi command displays a list of the resources in the system where a wait was required to obtain a latch on a resource. During the wait, the thread will spin (or loop) trying to acquire the resource. The number of times a wait was required for the resource and the number of total loops performed are given.

Spin locks with waits:                                                    
                                                                          
Num Waits   Num Loops   Avg Loop/Wait    Name                             
11          14          1.27             vproc vp_lock, id = 1            
1           1           1.00             vproc vp_lock, id = 7            
1           1           1.00             tcb lock, tid = 5                

Output Description

Heading Description Format See Also
Num Waits The number of times the resource had to be waited on due to another thread holding a latch on that resource. Dec  
Num Loops The number of times a loop was performed to test for the release of the latch on the resource. Dec onstat -g spi
Avg Loop/Wait The average number of loops that were performed for each wait. Flt  
Name The name of the resource upon which a spin locking condition has existed.
  lockfr     The lock free list. The number 
             after lockfr is the index into the 
             lock free list array.
  lockhash[] The lock hash bucket. The field 
             inside the brackets is the index 
             into the lock hash bucket array.
  :bhash []  The buffer hash bucket. The field 
             before the colon is the buffer pool 
             index; the field inside the brackets 
             after bhash is the index into the 
             buffer hash bucket array.
  :lru-      The LRU latch. The field before 
             the colon is the buffer pool index; 
             the field after lru- identifies the 
             buffer chain pairs that are being used.
  :bf[]      The buffer latch. The field before 
             the colon is the buffer pool index; 
             the field inside the brackets after bf 
             is the position of buffer in the buffer 
             array. The next two fields are the 
             partition number and the page header 
             address in memory for the buffer in 
             hex form.
Str onstat -g wmx

Notes

    A long spin is one where the number of loops for a single wait has exceeded 10,000.

    Only resources that have had at least one wait are listed.

Monitoring and Tuning

    Spin locks occur as part of the mechanism for acquiring control of a resource. When a thread needs access to a resource in shared memory, it must first acquire a latch on the resource. If the latch is currently held by another thread, the current thread will spin waiting for the latch to be released.

    When the number of loops is zero, it indicates that the lock was acquired immediately. This can occur when the latch is released between the time when the request is first made by the thread and the request is remade in the spin lock function call.