发明申请
- 专利标题: Lightweight Single Reader Locks
- 专利标题(中): 轻便单读卡器锁
-
申请号: US11686498申请日: 2007-03-15
-
公开(公告)号: US20080040560A1公开(公告)日: 2008-02-14
- 发明人: Charles Brian Hall , Zhong Liang Wang
- 申请人: Charles Brian Hall , Zhong Liang Wang
- 优先权: CA2539908 20060316
- 主分类号: G06F12/14
- IPC分类号: G06F12/14
摘要:
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.
信息查询