Patent ID: 8201178

Claim:
A computer system for preventing a delay in execution time of one or more instructions in one or more threads executed by exclusively using an external resource, the computer system comprising: a lock unit adapted to execute an instruction, wherein the instruction is at least one selected from a set comprising an instruction to acquire exclusive-use of the external resource and an instruction to release the exclusive-use of the external resource; a counter unit adapted to performing at least one of increasing or decreasing, in accordance with the execution of at least one instruction of the lock unit, a value of a counter associated with the at least one thread; and a controller adapted to control, in accordance with at least one selected from the value of the counter and a change in the value of the counter, an execution order of the one or more instructions and instructions that cause a delay in the execution time, wherein a computer program execution environment includes the external resource; wherein the controller is adapted to execute the instructions that cause a delay where, a memory size usable for memory allocation to be performed during execution of a program is smaller than a value obtained on the basis of a sum of values of counters; wherein the value obtained on the basis of the sum of the values of the counters is calculated in accordance with a formula: T/(1+k×N), where T is a threshold of a memory size that is used when the external resource is not exclusively used, and is the threshold of a memory size that starts the instructions that cause a delay; k is a parameter for adjusting the value to be obtained on the basis of the sum of the values of the counters; and N is the sum of the values of the counters.