Synchronizing access to a shared resource utilizing selective locking
Abstract
A method and system for providing access to a shared resource utilizing selective locking are disclosed. According to one embodiment, a method is provided comprising receiving a request to perform a resource access operation on a shared resource, invoking a first routine to perform the resource access operation, detecting a data processing system exception generated in response to invoking the first routine, and invoking a second routine to perform the resource access operation in response to such detecting. In the described embodiment, the first routine comprises a dereference instruction to dereference a pointer to memory associated with the shared resource, the second routine comprises a lock acquisition instruction to acquire a global lock associated with the shared resource prior to a performance of the resource access operation and a lock release instruction to release the global lock once resource access operation has been performed.
Claims
exact text as granted — not AI-modified1. A method for handling a shared list data structure within a multithreaded data processing system, said method comprising:
in response to a receipt of a first request to dereference said shared list data structure having a plurality of list elements, invoking a non-global locking element removal routine to dereference said shared list data structure, wherein said non-global locking removal routine includes a dereference instruction to dereference a head pointer for said shared list data structure;
in response to a receipt of a second request to dereference said shared list data structure, invoking said non-global locking element removal routine to dereference said shared list data structure and detecting a transition to a page fault handler due to said shared list data structure that has already been dereferenced by said first request; and
in response to said transition to said page fault handler during the execution of said non-global locking element removal routine, invoking a global locking element removal routine to handle said second request, wherein said global locking element removal routine assigns a pointer linked to said head pointer as a new head pointer for said shared list data structure, and dereferences said shared list data structure by dereferencing said new head pointer.
2. The method of claim 1 , wherein said shared list data structure is a double list data structure.
3. The method of claim 1 , wherein said global locking element removal routine includes a deference instruction to dereference said new head pointer.
4. The method of claim 1 , wherein said non-global locking element removal routine includes a load-and-reserve instruction and a store-conditional instruction utilized in combination to atomically access said head pointer for said shared list data structure.
5. The method of claim 1 , wherein said non-global locking element removal routine includes a get_from_list routine.
6. The method of claim 1 , wherein said global locking element removal routine includes a get_from_list_with_lock routine.
7. The method of claim 1 , wherein said detecting further includes detecting for an occurrence of a memory page fault.
8. A non-transitory machine-readable medium having a computer program product for providing access to a shared resource within a multithreading data processing system, said machine-readable medium comprising:
program code for, in response to a receipt of a first request to dereference said shared list data structure having a plurality of list elements, invoking a non-global locking element removal routine to dereference said shared list data structure, wherein said non-global locking removal routine includes a dereference instruction to dereference a head pointer for said shared list data structure;
program code for, in response to a receipt of a second request to dereference said shared list data structure, invoking said non-global locking element removal routine to dereference said shared list data structure and detecting a transition to a page fault handler due to said shared list data structure that has already been dereferenced by said first request; and
program code for, in response to said transition to said page fault handler during the execution of said non-global locking element removal routine, invoking a global locking element removal routine to handle said second request, wherein said global locking element removal routine assigns a pointer linked to said head pointer as a new head pointer for said shared list data structure, and dereferences said shared list data structure by dereferencing said new head pointer.
9. The non-transitory machine-readable medium of claim 8 , wherein said shared list data structure is a double list data structure.
10. The non-transitory machine-readable of claim 8 , wherein said global locking element removal routine includes a deference instruction to dereference said new head pointer.
11. The non-transitory machine-readable medium of claim 8 , wherein said non-global locking element removal routine includes a load-and-reserve instruction and a store-conditional instruction utilized in combination to atomically access said head pointer for said shared list data structure.
12. The non-transitory machine-readable medium of claim 8 , wherein said non-global locking element removal routine includes a get_from_list routine.
13. The non-transitory machine-readable medium of claim 8 , wherein said global locking element removal routine includes a get_from_list_with_lock routine.
14. The non-transitory machine-readable medium of claim 8 , wherein said program code for detecting further includes program code for detecting for an occurrence of a memory page fault.Cited by (0)
No later patents cite this yet.
References (0)
No backward citations on record.