Lightweight Single Reader Locks
First Claim
1. A computer-implementable method of generating a read-only lock implementation from a read-only lock portion of a program code, comprising:
- in response to determining that a lock portion of the program code is a read-only lock, generating a read-only lock implementation to protect at least one piece of shared data wherein the read-only lock implementation comprises a plurality of instructions with dependencies created between the instructions to ensure that a lock corresponding to the at least one piece of shared data is determined to be free before permitting access to the at least one piece of shared data,
1 Assignment
0 Petitions
Accused Products
Abstract
A method, system and computer program product for generating a read-only lock implementation from a read-only lock portion of program code. In response to determining that a lock portion of the program code is a read-only lock, a read-only lock implementation is generated to protect at least one piece of shared data. The read-only lock implementation comprises a plurality of instructions with dependencies created between the instructions to ensure that a lock corresponding to the data is determined to be free before permitting access to that data. In one embodiment, when executed, the read-only lock implementation loads a lock word from a memory address into a register and places a reserve on the memory address. The lock word is evaluated to determine if the lock is free, and, in response to determining that the lock is tree, at least one piece of shared data protected by the lock is accessed. A value is conditionally stored back to the memory address if the reserve is present. A dependency exists between the step of loading of the lock word and the step of accessing the at least one piece of shared data, thereby causing the step of loading of the lock word to be performed before the step of accessing of the at least one piece of shared data.
40 Citations
20 Claims
-
1. A computer-implementable method of generating a read-only lock implementation from a read-only lock portion of a program code, comprising:
in response to determining that a lock portion of the program code is a read-only lock, generating a read-only lock implementation to protect at least one piece of shared data wherein the read-only lock implementation comprises a plurality of instructions with dependencies created between the instructions to ensure that a lock corresponding to the at least one piece of shared data is determined to be free before permitting access to the at least one piece of shared data, - View Dependent Claims (2, 3, 4, 5, 6)
-
7. A computer-implementable method of performing a read-only lock on at least one piece of shared data, the method comprising:
-
loading a lock word from a memory address into a register and placing a reserve on the memory address; responsive to loading the lock word, evaluating the lock word to determine if the lock is free; responsive to determining that the lock is free, accessing at least one piece of shared data protected by the lock; and conditionally storing a value back to the memory address if the reserve is present, wherein dependencies created between the steps cause the step of evaluating the lock word to determine if the lock is free to be performed prior to accessing the at least one piece of shared data. - View Dependent Claims (8)
-
-
9. A multi-threaded data processing system for generating a read-only lock implementation from a read-only lock portion of a program code, comprising:
-
at least one processor; a memory operatively coupled to the at least one processor; and a program module stored in the memory operative for providing instructions to the at least one processor, the at least one processor responsive to the instructions from the program module to cause the data processing system to; in response to determining that a lock portion of a program code is a read-only lock, generate a read-only lock implementation to protect at least one piece of shared data wherein the read-only lock implementation comprises a plurality of instructions with dependencies created between the instructions to ensure that a lock corresponding to the at least one piece of shared data is determined to be free before permitting access to the at least one piece of shared data. - View Dependent Claims (10, 11, 12, 13, 14)
-
-
15. A computer program product comprising a computer useable medium including a computer-readable program for generating a read-only lock implementation from a read-only lock portion of a target program code, wherein the computer-readable program comprises.
computer-readable program code for generating, in response to determining that a lock portion of the target program code is a read-only lock, a read-only lock implementation to protect at least one piece of shared data wherein the read-only lock implementation comprises a plurality of instructions with dependencies created between the instructions to ensure that a lock corresponding to the at least one piece of shared data is free before permitting access to the at least one piece of shared data.
Specification