US2007136725A1PendingUtilityA1

System and method for optimized preemption and reservation of software locks

Assignee: IBMPriority: Dec 12, 2005Filed: Dec 12, 2005Published: Jun 14, 2007
Est. expiryDec 12, 2025(expired)· nominal 20-yr term from priority
G06F 9/526G06F 2209/522
47
PatentIndex Score
0
Cited by
0
References
0
Claims

Abstract

A system and method is provided that reserves a software lock for a waiting thread is presented. When a software lock is released by a first thread, a second thread that is waiting for the same resource controlled by the software lock is woken up. In addition, a reservation to the software lock is established for the second thread. After the reservation is established, if the lock is available and requested by a thread other than the second thread, the requesting thread is denied, added to the wait queue, and put to sleep. In addition, the reservation is cleared. After the reservation has been cleared, the lock will be granted to the next thread to request the lock.

Claims

exact text as granted — not AI-modified
1 . A computer-implemented method comprising: 
 releasing a software lock by a first thread;    identifying a second thread waiting on the software lock at the time of the releasing;    establishing a reservation to the software lock by the second thread in response to the identifying;    waking the second thread in response to the releasing;    after the establishment of the reservation and before the software lock has been taken by the second thread, receiving a first request for the software lock by a first requesting thread that is not the second thread; and    denying the request and putting the first requesting thread to sleep in response to the second thread having a priority equal to or better than the first requesting thread.    
   
   
       2 . The method of  claim 1  further comprising: 
 clearing the reservation in response to receiving the first request.    
   
   
       3 . The method of  claim 1  further comprising: 
 after the clearing and before the software lock has been requested by the second thread, receiving a second request for the software lock by a second requesting thread that is not the second thread; and    allowing the second requesting thread to acquire the software lock in response to the second request.    
   
   
       4 . The method of  claim 1  further comprising: 
 after the establishment of the reservation, receiving a request for the software lock by the second thread;    allowing the second thread to acquire the software lock in response to the request; and    clearing the reservation in response to receiving the request.    
   
   
       5 . The method of  claim 1  further comprising: 
 after the establishment of the reservation, receiving a request for the software lock by a requesting thread;    comparing a thread identifier of the requesting thread to a thread identifier of the second thread;    in response to the thread identifier of the requesting thread equaling the thread identifier of the second thread: 
 allowing the requesting thread to acquire the software lock; and  
 clearing the reservation; and  
   in response to the thread identifier of the requesting thread not equaling the thread identifier of the second thread: 
 denying the request;  
 putting the requesting thread to sleep; and  
 clearing the reservation.  
   
   
   
       6 . The method of  claim 1  further comprising: 
 selecting a thread identifier corresponding to the second thread from a wait queue, wherein the wait queue includes one or more thread identifiers corresponding to threads waiting for the software lock; and    removing the selected thread identifier from the wait queue.    
   
   
       7 . The method of  claim 1  further comprising: 
 releasing the software lock by the second thread;    receiving a request for the software lock by a requesting thread after the software lock has been released by the second thread;    in response to the software lock not being reserved: 
 allowing the requesting thread to acquire the software lock in response to the software lock being available; and  
 putting the requesting thread to sleep and adding the requesting thread's identifier to a wait queue in response to the software lock not being available; and  
   in response to the software lock being reserved: 
 clearing the reservation and allowing the requesting thread to acquire the software lock in response to the reservation being for the requesting thread; and  
 clearing the reservation, putting the requesting thread to sleep, and adding the requesting thread's identifier to the wait queue in response to the reservation not being for the requesting thread.  
   
   
   
       8 . An information handling system comprising: 
 one or more processors;    a memory accessible by the processors;    a plurality of threads, including a first thread and a second thread, stored in the memory and executed by the processors;    a software lock that controls access to a resource; and    a set of instructions executed by the processors to perform actions of: 
 releasing the software lock by the first thread;  
 identifying a second thread waiting on the software lock at the time of the releasing;  
 establishing a reservation to the software lock by the second thread in response to the identifying;  
 waking the software lock in response to the identifying;  
 after the establishment of the reservation and before the software lock has been taken by the second thread, receiving a first request for the software lock by a first requesting thread that is not the second thread; and  
 denying the request and putting the first requesting thread to sleep in response to the second thread having a priority equal to or better than the first requesting thread.  
   
   
   
       9 . The information handling system of  claim 8  further comprising: 
 clearing the reservation in response to receiving the first request.    
   
   
       10 . The information handling system of  claim 8  further comprising: 
 after the clearing and before the software lock has been requested by the second thread, receiving a second request for the software lock by a second requesting thread that is not the second thread; and    allowing the second requesting thread to acquire the software lock in response to the second request.    
   
   
       11 . The information handling system of  claim 8  further comprising: 
 after the establishment of the reservation, receiving a request for the software lock by the second thread;    allowing the second thread to acquire the software lock in response to the request; and    clearing the reservation in response to receiving the request.    
   
   
       12 . The information handling system of  claim 8  further comprising: 
 after the establishment of the reservation, receiving a request for the software lock by a requesting thread;    comparing a thread identifier of the requesting thread to a thread identifier of the second thread;    in response to the thread identifier of the requesting thread equaling the thread identifier of the second thread: 
 allowing the requesting thread to acquire the software lock; and  
 clearing the reservation; and  
   in response to the thread identifier of the requesting thread not equaling the thread identifier of the second thread: 
 denying the request;  
 putting the requesting thread to sleep; and  
 clearing the reservation.  
   
   
   
       13 . The information handling system of  claim 8  further comprising: 
 selecting a thread identifier corresponding to the second thread from a wait queue, wherein the wait queue includes one or more thread identifiers corresponding to threads waiting for the software lock; and    removing the selected thread identifier from the wait queue.    
   
   
       14 . A computer program product in a computer-readable medium comprising functional descriptive material that, when executed by a computer, directs the computer to perform actions of: 
 releasing a software lock by a first thread;    identifying a second thread waiting on the software lock at the time of the releasing;    establishing a reservation to the software lock by the second thread in response to the identifying;    waking the software lock in response to the identifying;    after the establishment of the reservation and before the software lock has been taken by the second thread, receiving a first request for the software lock by a first requesting thread that is not the second thread; and    denying the request and putting the first requesting thread to sleep in response to the second thread having a priority equal to or better than the first requesting thread.    
   
   
       15 . The computer program product of  claim 14  further comprising: 
 clearing the reservation in response to receiving the first request.    
   
   
       16 . The computer program product of  claim 14  further comprising: 
 after the clearing and before the software lock has been requested by the second thread, receiving a second request for the software lock by a second requesting thread that is not the second thread; and    allowing the second requesting thread to acquire the software lock in response to the second request.    
   
   
       17 . The computer program product of  claim 14  further comprising: 
 after the establishment of the reservation, receiving a request for the software lock by the second thread;    allowing the second thread to acquire the software lock in response to the request; and    clearing the reservation in response to receiving the request.    
   
   
       18 . The computer program product of  claim 14  further comprising: 
 after the establishment of the reservation, receiving a request for the software lock by a requesting thread;    comparing a thread identifier of the requesting thread to a thread identifier of the second thread;    in response to the thread identifier of the requesting thread equaling the thread identifier of the second thread: 
 allowing the requesting thread to acquire the software lock; and  
 clearing the reservation; and  
   in response to the thread identifier of the requesting thread not equaling the thread identifier of the second thread: 
 denying the request;  
 putting the requesting thread to sleep; and  
 clearing the reservation.  
   
   
   
       19 . The computer program product of  claim 14  further comprising: 
 selecting a thread identifier corresponding to the second thread from a wait queue, wherein the wait queue includes one or more thread identifiers corresponding to threads waiting for the software lock; and    removing the selected thread identifier from the wait queue.    
   
   
       20 . The computer program product of  claim 14  further comprising: 
 releasing the software lock by the second thread;    receiving a request for the software lock by a requesting thread after the software lock has been released by the second thread;    in response to the software lock not being reserved: 
 allowing the requesting thread to acquire the software lock in response to the software lock being available; and  
 putting the requesting thread to sleep and adding the requesting thread's identifier to a wait queue in response to the software lock not being available; and  
   in response to the software lock being reserved: 
 clearing the reservation and allowing the requesting thread to acquire the software lock in response to the reservation being for the requesting thread; and  
 clearing the reservation, putting the requesting thread to sleep, and adding the requesting thread's identifier to the wait queue in response to the reservation not being for the requesting thread.

Join the waitlist — get patent alerts

Track US2007136725A1 — get alerts on status changes and closely related new filings.

We store only your email — no account needed. See our privacy policy.