Patent ID: 9223637
Filing Date: 2015-12-29
Classification: G06F

Abstract:
1. A method, comprising: executing a first thread, the first thread using a resource; executing a second thread, the second thread requiring use of the resource which is locked due to first thread execution; creating a busy code to indicate progress of the execution of the first thread in relation to use of the resource by the first thread, including assigning a value to a variable according to a measure of completeness of the execution of the first thread in relation to use of the resource, wherein, when the resource is locked, the variable includes a yield value or a spin value, the yield value indicating to the second thread to execute a yield routine to cause the second thread to be notified when the resource is available, the spin value specifying, based on the measure of completeness, a number of spin-loop cycles of a spin routine to be executed by the second thread to wait for the resource to be available before attempting to read the busy code again, the spin value providing information from the first thread regarding when the resource is likely to be available; reading the busy code to determine whether the variable advises to execute the spin routine or the yield routine; and in response to determining that the variable includes the spin value, executing one of the spin routine or the yield routine by the second thread based on the value of the variable and a maximum spin cycle count defined for the second thread, the maximum spin cycle count specifying a count of spin-loop cycles of the spin routine, such that when the spin value exceeds the maximum spin cycle count, the second thread executes the yield routine despite the value of the variable advising to execute the spin routine.