发明名称 Reentrant read-write lock algorithm
摘要 Access to a shareable resource between threads is controlled by a lock having shared, optimistic and exclusive modes and maintaining a list of threads requesting ownership of said lock. A shared optimistic mode is provided. A lock state descriptor is provided for each desired change of mode comprising a current mode in which a thread has already acquired the lock. When a thread acquires the lock in shared optimistic mode, other threads are allowed to acquire the lock in shared or optimistic mode. When a thread which acquired the lock in shared optimistic mode wants to acquire the lock in exclusive mode, other threads which have acquired the lock in shared or optimistic mode are prevented from acquiring the lock in exclusive mode until the thread which acquired the lock in shared optimistic mode and requested to acquire the lock in exclusive mode releases the lock.
申请公布号 US9471400(B1) 申请公布日期 2016.10.18
申请号 US201514810510 申请日期 2015.07.28
申请人 International Business Machines Corporation 发明人 Greco Marco
分类号 G06F9/46;G06F9/52;G06F9/50 主分类号 G06F9/46
代理机构 代理人 Zwick David
主权项 1. A computer program product for managing access to a shareable resource between a plurality of concurrently executing threads, access to said shareable resource being controlled by a lock, said lock being adapted to be acquired by one or more of said plurality of concurrently executing threads in at least a shared mode, an optimistic mode and an exclusive mode and said lock maintaining a list of threads requesting ownership of said lock, the computer program product comprising: a computer readable storage medium having program instructions embodied therewith, the program instructions executable by a computer to cause the computer to: provide a shared optimistic mode for said lock, said lock being acquirable in said shared optimistic mode by one or more of said plurality of concurrently executing threads; provide, for each change of mode requested by any thread of said plurality of concurrently executing threads, a lock state descriptor comprising an indication of a current mode, if any, in which said requesting thread has already acquired said lock; responsive to one or more of said plurality of concurrently executing threads acquiring said lock in said shared optimistic mode, allow others of said plurality of concurrently executing threads to acquire said lock in said shared mode or said optimistic mode; and responsive to one or more of said plurality of concurrently executing threads which has acquired said lock in said shared optimistic mode requesting to acquire said lock in said exclusive mode, prevent others of said plurality of concurrently executing threads which have acquired said lock in said shared mode or said optimistic mode from acquiring said lock in said exclusive mode until one or more of said plurality of concurrently executing threads which has acquired said lock in said shared optimistic mode requesting to acquire said lock in said exclusive mode releases the lock.
地址 Armonk NY US