Enhancement to the MCS lock for increased functionality and improved programmability
First Claim
1. In a computer system using a lock to gain access to data, wherein said lock is held by a holding entity and there are no other entities waiting for said lock, a method of acquiring said lock by a first entity, said method comprising:
- modifying a tail pointer of said lock to point to a data structure representing said first entity; and
modifying a head pointer of said lock to point to said data structure representing said first entity, wherein said lock is acquired by said first entity when said holding entity changes a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until it acquires said lock before said first entity gains access to said data.
1 Assignment
0 Petitions
Accused Products
Abstract
A method for allowing a system programmer using a computing system to efficiently use a queuing lock without the requirement of pre-allocating qnode structures for each possible thread of computation expecting to use the lock. More specifically, the lock structure of this invention uses two pointers: a head pointer that points to the next qnode structure representing the next thread or process interested in acquiring the lock, and a tail pointer pointing to the qnode structure representing the last thread or process in a queue of threads or processes awaiting to acquire the lock. When the lock is released, a flag is changed in the qnode structure of the next thread in line (pointed to by the head of the lock) indicating that thread now has the lock and may proceed. A thread or process obtains the lock by spinning on a flag in a qnode structure representing such thread or process. That is, when the flag of a qnode structure is observed to be in a certain state, the thread represented by that qnode structure acquires that lock. The lock now points to the next qnode structure representing the next thread or process that has acquired the lock and to the last qnode structure representing the last thread or process interested in acquiring the lock. A joining thread joins the queue of threads waiting to acquire the lock by changing the tail pointer of the lock to point to a qnode structure representing the joining thread and the head pointer of the previous last thread'"'"'s qnode structure in the queue to point to the joining thread.
-
Citations
29 Claims
-
1. In a computer system using a lock to gain access to data, wherein said lock is held by a holding entity and there are no other entities waiting for said lock, a method of acquiring said lock by a first entity, said method comprising:
-
modifying a tail pointer of said lock to point to a data structure representing said first entity; and
modifying a head pointer of said lock to point to said data structure representing said first entity, wherein said lock is acquired by said first entity when said holding entity changes a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until it acquires said lock before said first entity gains access to said data. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
-
8. In a computer system using locks to gain access to data, a method of acquiring a lock by a first entity, said method comprising:
-
if no entity is currently holding said lock, then modifying a tail pointer of said lock to point to said lock, where said modification indicates that said lock was acquired by said first entity;
if said lock is held and there are no waiting entities, modifying a head pointer and said tail pointer of said lock to point to a data structure representing said first entity, wherein said lock said lock is acquired by said first entity when a holding entity changes a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until said holding entity grants said lock to said first entity before said first entity gains access to said data; and
if said lock is held and there are entities waiting to acquire access to said lock, granting said lock by a holding entity to said first entity by changing a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until latter said holding entity grants said lock to said first entity before said first entity gains access to said data. - View Dependent Claims (9, 10, 11, 12, 13, 14, 15)
-
-
16. In a computer system, a method of releasing a lock, said method comprising:
-
modifying a head pointer of said lock to point to one of a plurality of waiting entities if there are at least two waiting entities, wherein said lock is released to another of said entities by changing a waiting identifier in a data structure which was pointed to by said head pointer before it was modified;
modifying said head pointer and a tail pointer of said lock to a designated value if there are no waiting entities, wherein said designated value in said head pointer and in said tail pointer indicates that there are no longer any entities holding or waiting to acquire said lock; and
modifying said head pointer of said lock to a designated value if there is one waiting entity, wherein said lock is released to said one waiting entity by changing a waiting identifier in a data structure representing said one entity, and wherein a tail pointer of said lock is modified to point to said data structure indicating said lock is now held by said one entity, and wherein said designated value indicates that there are no longer any entities waiting to acquire said lock.
-
-
17. In a computer system using locks to gain access to data, a method of acquiring and releasing a lock by a first entity, wherein said first entity can gain access to said data when it acquires said lock, and wherein when a lock is released, an entity acquires or can acquire said lock, said method comprising:
-
acquiring said lock by said first entity by;
if no entity is currently holding said lock, then modifying a tail pointer of said lock to point to said lock, where said modification indicates that said lock was acquired by said first entity;
if said lock is held and there are no waiting entities, modifying a head pointer and said tail pointer of said lock to point to a data structure representing said first entity, wherein said lock said lock is acquired by said first entity when a holding entity changes a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until said holding entity grants said lock to said first entity before said first entity gains access to said data; and
if said lock is held and there are entities waiting to acquire access to said lock, granting said lock by a holding entity to said first entity by changing a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until latter said holding entity grants said lock to said first entity before said first entity gains access to said data. releasing said lock by;
modifying a head pointer of said lock to point to one of a plurality of waiting entities if there are at least two waiting entities, wherein said lock is released to another of said entities by changing a waiting identifier in a data structure which was pointed to by said head pointer before it was modified;
modifying said head pointer and a tail pointer of said lock to a designated value if there are no waiting entities, wherein said designated value in said head pointer and in said tail pointer indicates that there are no longer any entities holding or waiting to acquire said lock; and
modifying said head pointer of said lock to a designated value if there is one waiting entity, wherein said lock is released to said one waiting entity by changing a waiting identifier in a data structure representing said one entity, and wherein a tail pointer of said lock is modified to point to said data structure indicating said lock is now held by said one entity, and wherein said designated value indicates that there are no longer any entities waiting to acquire said lock. - View Dependent Claims (18)
-
-
19. A computer system for using a lock to gain access to data, wherein said lock is held by a holding entity and there are no other entities waiting for said lock, said system for acquiring said lock by a first entity, said system comprising:
-
means for modifying a tail pointer of said lock to point a data structure representing said first entity; and
means for modifying a head pointer of said lock to point to said data structure representing said first entity, wherein said lock is acquired by said first entity when said holding entity changes a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until it acquires said lock before said first entity gains access to said data. - View Dependent Claims (20)
-
-
21. A computer system for using locks to gain access to data, said system for acquiring a lock by a first entity, said system comprising:
-
means for, if no entity is currently holding said lock, then modifying a tail pointer of said lock to point to said lock, where said modification indicates that said lock was acquired by said first entity;
means for, if said lock is held and there are no waiting entities, modifying a head pointer and said tail pointer of said lock to point to a data structure representing said first entity, wherein said lock said lock is acquired by said first entity when a holding entity changes a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until said holding entity grants said lock to said first entity before said first entity gains access to said data; and
means for, if said lock is held and there are entities waiting to acquire access to said lock, granting said lock by a holding entity to said first entity by changing a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until latter said holding entity grants said lock to said first entity before said first entity gains access to said data. - View Dependent Claims (22, 23)
-
-
24. A computer system for releasing a lock, said system comprising:
-
means for modifying a head pointer of said lock to point to one of a plurality of waiting entities if there are at least two waiting entities, wherein said lock is released to another of said entities by changing a waiting identifier in a data structure which was pointed to by said head pointer before it was modified;
means for modifying said head pointer and a tail pointer of said lock to a designated value if there are no waiting entities, wherein said designated value in said head pointer and in said tail pointer indicates that there are no longer any entities holding or waiting to acquire said lock; and
means for modifying said head pointer of said lock to a designated value if there is one waiting entity, wherein said lock is released to said one waiting entity by changing a waiting identifier in a data structure representing said one entity, and wherein a tail pointer of said lock is modified to point to said data structure indicating said lock is now held by said one entity, and wherein said designated value indicates that there are no longer any entities waiting to acquire said lock.
-
-
25. A computer system using locks to gain access to data, said system acquiring and releasing a lock by a first entity, said system comprising:
-
means for acquiring said lock comprising;
means for, if no entity is currently holding said lock, then modifying a tail pointer of said lock to point to said lock, where said modification indicates that said lock was acquired by said first entity;
means for, if said lock is held and there are no waiting entities, modifying a head pointer and said tail pointer of said lock to point to a data structure representing said first entity, wherein said lock said lock is acquired by said first entity when a holding entity changes a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until said holding entity grants said lock to said first entity before said first entity gains access to said data; and
means for, if said lock is held and there are entities waiting to acquire access to said lock, granting said lock by a holding entity to said first entity by changing a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until latter said holding entity grants said lock to said first entity before said first entity gains access to said data;
means for releasing said lock comprising;
means for modifying a head pointer of said lock to point to one of a plurality of waiting entities if there are at least two waiting entities, wherein said lock is released to another of said entities by changing a waiting identifier in a data structure which was pointed to by said head pointer before it was modified;
means for modifying said head pointer and a tail pointer of said lock to a designated value if there are no waiting entities, wherein said designated value in said head pointer and in said tail pointer indicates that there are no longer any entities holding or waiting to acquire said lock; and
means for modifying said head pointer of said lock to a designated value if there is one waiting entity, wherein said lock is released to said one waiting entity by changing a waiting identifier in a data structure representing said one entity, and wherein a tail pointer of said lock is modified to point to said data structure indicating said lock is now held by said one entity, and wherein said designated value indicates that there are no longer any entities waiting to acquire said lock.
-
-
26. A program storage device readable by a computer, tangibly embodying a program of instructions executable by said computer to perform method steps for using a lock to gain access to data, wherein said lock is held by a holding entity and there are no other entities waiting for said lock, a to perform method steps for acquiring said lock by a first entity, said steps comprising:
-
modifying a tail pointer of said lock to point to a data structure representing said first entity; and
modifying a head pointer of said lock to point to said data structure representing said first entity, wherein said lock is acquired by said first entity when said holding entity changes a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until it acquires said lock before said first entity gains access to said data.
-
-
27. A program storage device readable by a computer, tangibly embodying a program of instructions executable by said computer to perform method steps for using locks to gain access to data, said method for acquiring a lock by a first entity, said method comprising:
-
if no entity is currently holding said lock, then modifying a tail pointer of said lock to point to said lock, where said modification indicates that said lock was acquired by said first entity;
if said lock is held and there are no waiting entities, modifying a head pointer and said tail pointer of said lock to point to a data structure representing said first entity, wherein said lock said lock is acquired by said first entity when a holding entity changes a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until said holding entity grants said lock to said first entity before said first entity gains access to said data; and
if said lock is held and there are entities waiting to acquire access to said lock, granting said lock by a holding entity to said first entity by changing a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until latter said holding entity grants said lock to said first entity before said first entity gains access to said data.
-
-
28. A program storage device readable by a computer, tangibly embodying a program of instructions executable by said computer to perform method steps for releasing a lock, said method comprising:
-
modifying a head pointer of said lock to point to one of a plurality of waiting entities if there are at least two waiting entities, wherein said lock is released to another of said entities by changing a waiting identifier in a data structure which was pointed to by said head pointer before it was modified;
modifying said head pointer and a tail pointer of said lock to a designated value if there are no waiting entities, wherein said designated value in said head pointer and in said tail pointer indicates that there are no longer any entities holding or waiting to acquire said lock; and
modifying said head pointer of said lock to a designated value if there is one waiting entity, wherein said lock is released to said one waiting entity by changing a waiting identifier in a data structure representing said one entity, and wherein a tail pointer of said lock is modified to point to said data structure indicating said lock is now held by said one entity, and wherein said designated value indicates that there are no longer any entities waiting to acquire said lock.
-
-
29. A program storage device readable by a computer, tangibly embodying a program of instructions executable by said computer to perform method steps for using locks to gain access to data, said method steps for acquiring and releasing a lock by a first entity, said method steps comprising:
-
acquiring said lock by said first entity by;
if no entity is currently holding said lock, then modifying a tail pointer of said lock to point to said lock, where said modification indicates that said lock was acquired by said first entity;
if said lock is held and there are no waiting entities, modifying a head pointer and said tail pointer of said lock to point to a data structure representing said first entity, wherein said lock said lock is acquired by said first entity when a holding entity changes a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until said holding entity grants said lock to said first entity before said first entity gains access to said data; and
if said lock is held and there are entities waiting to acquire access to said lock, granting said lock by a holding entity to said first entity by changing a waiting identifier in said data structure, which is pointed to by said modified head pointer, wherein said first entity waits until latter said holding entity grants said lock to said first entity before said first entity gains access to said data. releasing said lock by;
modifying a head pointer of said lock to point to one of a plurality of waiting entities if there are at least two waiting entities, wherein said lock is released to another of said entities by changing a waiting identifier in a data structure which was pointed to by said head pointer before it was modified;
modifying said head pointer and a tail pointer of said lock to a designated value if there are no waiting entities, wherein said designated value in said head pointer and in said tail pointer indicates that there are no longer any entities holding or waiting to acquire said lock; and
modifying said head pointer of said lock to a designated value if there is one waiting entity, wherein said lock is released to said one waiting entity by changing a waiting identifier in a data structure representing said one entity, and wherein a tail pointer of said lock is modified to point to said data structure indicating said lock is now held by said one entity, and wherein said designated value indicates that there are no longer any entities waiting to acquire said lock.
-
Specification