发明申请
US20080040560A1 Lightweight Single Reader Locks 审中-公开
轻便单读卡器锁

Lightweight Single Reader Locks
摘要:
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.
信息查询
0/0