SYSTEM AND METHOD FOR DYNAMICALLY ADAPTIVE MUTUAL EXCLUSION IN MULTI-THREADED COMPUTING ENVIRONMENT
First Claim
1. A method for mutually exclusively executing a critical section by a process in a computer system, the method comprising:
- measuring a detection time representing when a locking function detects that a lock is held by another process, and a current time representing a present time, wherein the lock permits an access to the critical section;
subsequent to said measuring, repeating at least one iteration comprising steps of determining a waiting mode of the process, and subsequently attempting to acquire the lock, wherein the waiting mode is determined such that the process in the waiting mode wastes the least amount of time while waiting for the lock pursuant to at least one delay stored in a lock delay history data structure and a suspension overhead time of the computer system;
subsequent to said repeating, acquiring the lock;
subsequent to said acquiring, calculating a delay representing a difference between a release time representing when the lock is released and the detection time; and
subsequent to said calculating, storing the calculated delay in the lock delay history data structure,wherein said measuring, said repeating, said acquiring, said calculating, and said storing are performed by the locking function.
1 Assignment
0 Petitions
Accused Products
Abstract
A system and associated method for mutually exclusively executing a critical section by a process in a computer system. The critical section accessing a shared resource is controlled by a lock. The method measures a detection time when a lock contention is detected, a wait time representing a duration of wait for the lock at each failed attempt to acquire the lock, and a delay representing a total lapse of time from the detection time till the lock is acquired. The delay is logged and used to calculate an average delay, which is compared with a suspension overhead time of the computer system on which the method is executed to determine whether to spin or to suspend the process while waiting for the lock to be released.
25 Citations
20 Claims
-
1. A method for mutually exclusively executing a critical section by a process in a computer system, the method comprising:
-
measuring a detection time representing when a locking function detects that a lock is held by another process, and a current time representing a present time, wherein the lock permits an access to the critical section; subsequent to said measuring, repeating at least one iteration comprising steps of determining a waiting mode of the process, and subsequently attempting to acquire the lock, wherein the waiting mode is determined such that the process in the waiting mode wastes the least amount of time while waiting for the lock pursuant to at least one delay stored in a lock delay history data structure and a suspension overhead time of the computer system; subsequent to said repeating, acquiring the lock; subsequent to said acquiring, calculating a delay representing a difference between a release time representing when the lock is released and the detection time; and subsequent to said calculating, storing the calculated delay in the lock delay history data structure, wherein said measuring, said repeating, said acquiring, said calculating, and said storing are performed by the locking function. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
-
8. A computer program product, comprising a computer usable storage medium having a computer readable program code embodied therein, said computer readable program code containing instructions that when executed by a processor of a computer system implement a method for mutually exclusively executing a critical section by a process in a computer system, the method comprising:
-
measuring a detection time representing when a locking function detects that a lock is held by another process, and a current time representing a present time, wherein the lock permits an access to the critical section; subsequent to said measuring, repeating at least one iteration comprising steps of determining a waiting mode of the process, and subsequently attempting to acquire the lock, wherein the waiting mode is determined such that the process in the waiting mode wastes the least amount of time while waiting for the lock pursuant to at least one delay stored in a lock delay history data structure and a suspension overhead time of the computer system; subsequent to said repeating, acquiring the lock; subsequent to said acquiring, calculating a delay representing a difference between a release time representing when the lock is released and the detection time; and subsequent to said calculating, storing the calculated delay in the lock delay history data structure, wherein said measuring, said repeating, said acquiring, said calculating, and said storing are performed by the locking function. - View Dependent Claims (9, 10, 11, 12, 13, 14)
-
-
15. A computer system comprising a processor and a computer readable memory unit coupled to the processor, said memory unit containing instructions that when executed by the processor implement a method for mutually exclusively executing a critical section by a process in a computer system, the method comprising:
-
measuring a detection time representing when a locking function detects that a lock is held by another process, and a current time representing a present time, wherein the lock permits an access to the critical section; subsequent to said measuring, repeating at least one iteration comprising steps of determining a waiting mode of the process, and subsequently attempting to acquire the lock, wherein the waiting mode is determined such that the process in the waiting mode wastes the least amount of time while waiting for the lock pursuant to at least one delay stored in a lock delay history data structure and a suspension overhead time of the computer system; subsequent to said repeating, acquiring the lock; subsequent to said acquiring, calculating a delay representing a difference between a release time representing when the lock is released and the detection time; and subsequent to said calculating, storing the calculated delay in the lock delay history data structure, wherein said measuring, said repeating, said acquiring, said calculating, and said storing are performed by the locking function. - View Dependent Claims (16, 17, 18, 19, 20)
-
Specification