CN101256509B - Locking method, unlocking method and implementing method for lock mechanism - Google Patents

Locking method, unlocking method and implementing method for lock mechanism Download PDF

Info

Publication number
CN101256509B
CN101256509B CN2008100664740A CN200810066474A CN101256509B CN 101256509 B CN101256509 B CN 101256509B CN 2008100664740 A CN2008100664740 A CN 2008100664740A CN 200810066474 A CN200810066474 A CN 200810066474A CN 101256509 B CN101256509 B CN 101256509B
Authority
CN
China
Prior art keywords
resource
lock
approximate number
node
resources
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN2008100664740A
Other languages
Chinese (zh)
Other versions
CN101256509A (en
Inventor
万鹏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Pang Jichao
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CN2008100664740A priority Critical patent/CN101256509B/en
Publication of CN101256509A publication Critical patent/CN101256509A/en
Application granted granted Critical
Publication of CN101256509B publication Critical patent/CN101256509B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a locking method, an unlocking method and an implementation for a lock mechanism. The locking method comprises the following steps: A1, initializing the reserve number of each resource to be a preset value; A2, performing an Increase operation on the reserve number of each applied resource, adding the related lock nodes of current process to a lock waiting queue, and judging whether the resources are applied successfully or not, if not, executing step A3; A3, for each resource failing to be applied, searching the lock waiting queue inversely, judging whether needed resources exist in the queue, if yes, adding the process label of current process to the scheduling queue label item of the related lock nodes of the searching result, and adding the searched resources to the applying resource item of the related lock nodes of current process; and A4, judging whether the resource failing to be applied are searched completely, if not, going on executing step A3. The invention effectively realizes fast lock mechanism in a priority preemptive secondary scheduling system, and provides highly effective support for the merge of transitions.

Description

A kind of locking method of lock mechanism, unlock method and implementation method
Technical field
The present invention relates to the lock realization technology of no signal amount, in particular, in the embedded memory Database Systems, a kind of locking method of lock mechanism, unlock method and implementation method.
Background technology
Embedded main memory database receives increasing concern owing to having extremely strong real-time, and the embedded database hard real-time comes from the internal memory transaction concurrency, and concurrent realization is mainly by introducing lock mechanism.
The mode of semaphore has all been adopted in the realization that present various main memory database is locked system, the shortcoming of semaphore mode be obtain relative with the time of release semaphore longer, particularly in embedded system, the wait of semaphore means the switching of task, and this is very time-consuming.
The Implementation of Embedded System lock mechanism mainly adopts following method at present:
1, adopt Semaphore Mechanism, a least unit is provided with a semaphore, and locking of such lock may need obtaining of a lot of semaphores, needs a large amount of time but obtain these semaphores.
2, adopt non-semaphore process to postpone mechanism, but in the preemptive priority system, this method can't true(-)running.
3, employing task is waited for Semaphore Mechanism, and this method has realized that a lock only needs a semaphore.
Embedded real-time operating system vxworks, on the basis of task scheduling, increased the system of process scheduling, custom is called the two times scheduling system, wherein, can block whole task in the time of a process wait-semaphore, cause other processes under the same task can't finish affairs, cause deadlock, therefore above-mentioned existing method all can't realize in the two times scheduling system of preemptive priority scheduling.
Therefore, there is defective in prior art, needs to improve.
Summary of the invention
Technical matters to be solved by this invention is in the two times scheduling system of preemptive priority scheduling, how to realize lock mechanism.
Technical scheme of the present invention is as follows:
A kind of locking method of lock mechanism, it may further comprise the steps: the pre-approximate number of A1, each resource of initialization is respectively preset value, is used for each state of resources of mark and is not reservation; A2, when applying for each resource, the pre-approximate number of each resource of apply for is added an operation, the lock node that current process is relevant joins the lock waiting list, and judges whether all apply for successfully, if do not apply for successfully then carry out A3 less than whole; Wherein, described lock waiting list is provided with following respectively for each lock node: process identification (PID), resource to be applied for, the successful resource of application and treat the scheduling queue sign; A3, for each resource of application failure, the described lock waiting list of reverse search, judge whether to search for therein and obtain required resource, be then to treat the scheduling queue identification item what Search Results shut node mutually, add the process identification (PID) of current process, and the resource that search obtains is added to the resource items to be applied for of the relevant lock node of current process; Whether all each resource of A4, judgement application failure search is finished, otherwise continues execution A3.
Described locking method, wherein, the steps A 1 concrete following steps of carrying out: the Resources list is set, is used to manage the pre-approximate number of each resource; The pre-approximate number of each resource of the described the Resources list of initialization is respectively preset value; And, in the steps A 2, when applying for each resource, be in described the Resources list, the pre-approximate number of each resource of apply for is added an operation.
A kind of unlock method of lock mechanism, it may further comprise the steps: B1, resources allocation is given lock node in the lock waiting list in order; Wherein, described lock waiting list is provided with following respectively for each lock node: process identification (PID), resource to be applied for, the successful resource of application and treat the scheduling queue sign; B2, for each resource that a certain lock node is applied for, judge whether it all applies for successfully, be its corresponding process that then unblocks, the pre-approximate number of corresponding resource is subtracted one.
Described unlock method wherein, is also carried out following steps: B0 before the step B1, is judged that the head node of described lock waiting list is invalid, judges that perhaps affairs have carried out to the end, then execution in step B1.
A kind of implementation method of lock mechanism, it comprises that the following step reconciliation lock-step that locks is rapid;
The described step that locks may further comprise the steps: the pre-approximate number of C1, each resource of initialization is respectively preset value, is used for each state of resources of mark and is not reservation; C2, when applying for each resource, the pre-approximate number of each resource of apply for is added an operation, the lock node that current process is relevant joins the lock waiting list, and judges whether all apply for successfully, if do not apply for successfully then carry out C3 less than whole; Wherein, described lock waiting list is provided with following respectively for each lock node: process identification (PID), resource to be applied for, the successful resource of application and treat the scheduling queue sign; C3, for each resource of application failure, the described lock waiting list of reverse search, judge whether to search for therein and obtain required resource, be then to treat the scheduling queue identification item what Search Results shut node mutually, add the process identification (PID) of current process, and the resource that search obtains is added to the resource items to be applied for of the relevant lock node of current process; Whether all each resource of C4, judgement application failure search is finished, otherwise continues execution C3;
Described release step may further comprise the steps: C5, resources allocation is given lock node in the lock waiting list in order; Wherein, described lock waiting list is provided with following respectively for each lock node: process identification (PID), resource to be applied for, the successful resource of application and treat the scheduling queue sign; C6, for each resource that a certain lock node is applied for, judge whether it all applies for successfully, be its corresponding process that then unblocks, the pre-approximate number of corresponding resource is subtracted one.
Described implementation method, wherein, step C1 specifically carries out following steps: the Resources list is set, is used to manage the pre-approximate number of each resource; The pre-approximate number of each resource of the described the Resources list of initialization is respectively preset value; And, among the step C2, when applying for each resource, be in described the Resources list, the pre-approximate number of each resource of apply for is added an operation; And, among the step C6, the pre-approximate number of corresponding resource is subtracted for the moment, be in described the Resources list, the pre-approximate number of corresponding resource is subtracted an operation.
Described implementation method wherein, is also carried out following steps: C50 before the step C5, is judged that the head node of described lock waiting list is invalid, judges that perhaps affairs have carried out to the end, then execution in step C5.
Described implementation method, wherein, also carry out following steps before the step C50: adopting periodic monitor mechanism, judge whether overtime not response, is then to carry out C50.
Described implementation method wherein, among the step C6, before the process of the current lock node correspondence that unblocks, is also carried out following steps: judge whether this process is effective, otherwise do not make subsequent treatment.
Described implementation method, wherein, step C2 is to the operation of step C4, and step C5 adopts respectively and monopolizes the realization of task form to the operation of step C6.
Adopt such scheme, the present invention proposes the lock mechanism of not waiting for, in preemptive priority two times scheduling system, realized quick lock mechanism effectively, for concurrent the providing efficiently of affairs supported based on semaphore.
Description of drawings
Fig. 1 is the blockade process flow diagram of a kind of embodiment of the inventive method;
Fig. 2 is the release process flow diagram of a kind of embodiment of the inventive method.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is described in detail.
Purport of the present invention is to propose a kind of non-semaphore lock realization mechanism based on the process two times scheduling, and this mechanism is not waited for based on semaphore; The present invention is by being pre-approximate number of each conservation of resources that can lock, and safeguards a lock waiting list, realizes above-mentioned mechanism.
As shown in Figure 1, the invention provides a kind of locking method of lock mechanism, it may further comprise the steps:
The pre-approximate number of A1, each resource of initialization is respectively preset value, is used for each state of resources of mark and is not reservation; For example, the preset value of a certain resource is 0 o'clock, represents this state of resources to be not reservation; Perhaps, also can be defined as, the preset value of a certain resource is 1 o'clock, represents this state of resources to be not reservation; The present invention does not impose any restrictions preset value.
A2, when applying for each resource, the pre-approximate number of each resource of apply for is added an operation, the lock node that current process is relevant joins the lock waiting list, and judges whether all to apply for successfully, otherwise execution A3.For example, preset value is 0 o'clock, represents this state of resources to be not reservation; When a certain resource of a certain process application, then the pre-approximate number to this resource adds an operation, and its pre-approximate number is made as 1; When another process was also applied for this resource, then the pre-approximate number to this resource added an operation again, and its pre-approximate number is made as 2.
Wherein, described lock waiting list, be also referred to as the release collection, an example is as shown in the table, it is provided with following respectively for each lock node: process identification (PID) (PID, process identity, the i.e. sign of Suo Ding process), resource to be applied for (WAIT_RES), apply for successful resource (HAVE_RES) and treat scheduling queue sign (PEND_QUE).
Wherein, the process identification (PID) item is used for the storage process sign, should lock the process of node correspondence with mark; Apply for successful resource items be used for this process of mark the successful resource that obtains of application; Resource items to be applied for is used for the not success of resource that this process of mark is applied for, needs to wait for scheduling; Treat that the scheduling queue identification item is used for the process identification (PID) of other process of mark, expression: the resource when other process is applied for, taken by the process of this lock node correspondence, treat this process carry out discharge after, resource of its needs is allotted to described other process.
Suppose to have 9 resources to be respectively 1,2,3,4,5,6,7,8,9, suppose process 1 is at first blocked, and needing resource is 1,2,4,6,9.
LOCK WAIT_RES HAVE_RES PEND_QUE
PID1 1,2,4,6,9
A3, for each resource of application failure, the described lock waiting list of reverse search, judge whether to search for therein and obtain required resource, be then to treat the scheduling queue identification item what Search Results shut node mutually, add the process identification (PID) of current process, and the resource that search obtains is added to the resource items to be applied for of the relevant lock node of current process.
Whether all each resource of A4, judgement application failure search is finished, otherwise continues execution A3.
In concrete the application, can adopt the Resources list, manage the pre-approximate number of each resource, perhaps manage each resource and pre-approximate number thereof; An embodiment is the steps A 1 concrete following steps of carrying out: the Resources list is set, is used to manage the pre-approximate number of each resource; The pre-approximate number of each resource of the described the Resources list of initialization is respectively preset value; Like this, in steps A 2,, then in described the Resources list, the pre-approximate number of each resource of apply for is added an operation when application during each resource.
Each above-mentioned embodiment can adopt respectively and monopolize the realization of task form.
Accordingly, as shown in Figure 2, the invention provides a kind of unlock method of lock mechanism, it may further comprise the steps: B1, resources allocation is given lock node in the lock waiting list in order; Wherein, described lock waiting list is provided with following respectively for each lock node: process identification (PID), resource to be applied for, the successful resource of application and treat the scheduling queue sign; B2, for each resource that a certain lock node is applied for, judge whether it all applies for successfully, be its corresponding process that then unblocks, the pre-approximate number of corresponding resource is subtracted one.
An embodiment is, also carries out following steps: B0 before the step B1, judges that the head node of described lock waiting list is invalid, judges that perhaps affairs have carried out to the end, then execution in step B1.And for example, on the basis of this embodiment, can also carry out following steps before B0: adopting periodic monitor mechanism, judge whether overtime not response, is then to carry out B0.
Another embodiment is among the step B2, before the process of the current lock node correspondence that unblocks, also to carry out following steps: judge whether this process is effective, otherwise do not make subsequent treatment, the process and the subsequent operation thereof of the current lock node correspondence that promptly need not to unblock.In general, can judge whether this process also exists according to PID, otherwise think that it lost efficacy.
Be more preferably, same as above, can adopt the Resources list, manage the pre-approximate number of each resource, perhaps manage each resource and pre-approximate number thereof; An embodiment is, at first, pre-sets the Resources list, is used to manage the pre-approximate number of each resource; The pre-approximate number of each resource of the described the Resources list of initialization is respectively preset value; Like this, in step B2, after the corresponding process that unblocks, then in described the Resources list, the pre-approximate number of corresponding resource is subtracted an operation.
Same, each above-mentioned embodiment can adopt respectively and monopolize the realization of task form.
Comprehensive above-mentioned locking method and unlock method, the present invention also provides a kind of implementation method of lock mechanism, and it comprises that the following step reconciliation lock-step that locks is rapid.
The described step that locks may further comprise the steps:
The pre-approximate number of C1, each resource of initialization is respectively preset value, is used for each state of resources of mark and is not reservation; Same, for example, the preset value of a certain resource is 0 o'clock, represents this state of resources to be not reservation; Perhaps, also can be defined as, the preset value of a certain resource is 100 o'clock, represents this state of resources to be not reservation; The present invention does not impose any restrictions preset value.
C2, when applying for each resource, the pre-approximate number of each resource of apply for is added an operation, the lock node that current process is relevant joins the lock waiting list, and judges whether all to apply for successfully, otherwise execution C3; Wherein, described lock waiting list is provided with following respectively for each lock node: process identification (PID), resource to be applied for, the successful resource of application and treat the scheduling queue sign; Every implication is identical with the description of above-mentioned locking method, does not repeat them here.
C3, for each resource of application failure, the described lock waiting list of reverse search, judge whether to search for therein and obtain required resource, be then to treat the scheduling queue identification item what Search Results shut node mutually, add the process identification (PID) of current process, and the resource that search obtains is added to the resource items to be applied for of the relevant lock node of current process.
Whether all each resource of C4, judgement application failure search is finished, otherwise continues execution C3.
Wherein, step C2 can adopt and monopolize the realization of task form to the operation of step C4.
Described release step may further comprise the steps:
C5, resources allocation is given lock node in the lock waiting list in order; Wherein, described lock waiting list is provided with following respectively for each lock node: process identification (PID), resource to be applied for, the successful resource of application and treat the scheduling queue sign.
For example, can also carry out following steps: C50 before the step C5, judge that the head node of described lock waiting list is invalid, judge that perhaps affairs have carried out to the end, then execution in step C5.And for example, on this basis, also carry out following steps before the step C50: adopting periodic monitor mechanism, judge whether overtime not response, is then to carry out C50.
C6, for each resource that a certain lock node is applied for, judge whether it all applies for successfully, be its corresponding process that then unblocks, the pre-approximate number of corresponding resource is subtracted one.For example, before the process of current lock node correspondence that unblocks, also carry out following steps: judge whether this process is effective, otherwise do not make subsequent treatment.
When adopting the Resources list, an embodiment is that step C1 specifically carries out following steps: the Resources list is set, is used to manage the pre-approximate number of each resource; The pre-approximate number of each resource of the described the Resources list of initialization is respectively preset value; And, among the step C2, when applying for each resource, be in described the Resources list, the pre-approximate number of each resource of apply for is added an operation; And, among the step C6, the pre-approximate number of corresponding resource is subtracted for the moment, be in described the Resources list, the pre-approximate number of corresponding resource is subtracted an operation.
Wherein, step C5 can adopt and monopolize the realization of task form to the operation of step C6.
It below is a complete example of implementation method of the present invention.
1, the flow process that locks, as shown in Figure 1, its parameter comprises PID, the Resources list.
1)TaskLock;
2) apply for all not reserve resources;
3) add one for the pre-approximate number of all resources in the Resources list;
4) if resource has applied for fully that then TaskUnlock continues transaction operation;
5) if resource does not meet the demands, the resource in the reverse search waiting list is then added oneself at this release collection afterbody if a certain item contains the resource of needs, up to all resources notify object has been arranged all;
7)TaskUnlock;
8) hang up oneself.
2. release flow process, as shown in Figure 2, its parameter is in the transaction queues; Release opportunity, be generally the invalid or affairs of group head node and carry out to the end.
1)TaskLock;
2) the lock node of successively resources allocation in the Resources list being concentrated to release, if certain lock node has been applied for all resources, this process that then unblocks can judge whether earlier before unblocking effectively, invalidly then do not deal with, the pre-approximate number of corresponding resource is subtracted one;
3)TaskUnlock。
A special case of implementation method or unlock method is to carry out Deadlock Detection.
If some process instances have been visited database, and its affairs come the transaction queues head, then after this example is killed by other process, its effectively release discharge resource, can cause the deadlock of database like this.
Therefore the present invention has introduced periodic monitor mechanism, if team's head node is invalid, and unlocking force head node then.
If some process instances are in the centre of formation, if after then it was killed unusually, affairs were not deleted, need wait until that all affairs of its front just carry out release after finishing, can be detected by Deadlock Detection mechanism, such situation is very rare, just a kind of preventive means that adopts.
Provide a concrete example below again, each method of the present invention is elaborated.
Suppose to have 9 resources to be respectively 1,2,3,4,5,6,7,8,9; It is 0 that each resource has an initial pre-approximate number.
Suppose process 1 is at first blocked, and it needs resource is 1,2,4,6,9.
Process 1 is blocked as shown in the table:
LOCK WAIT_RES HAVE_RES PEND_QUE
PID1 1,2,4,6,9
Process 1 needs resource 1,2,4,6,9; At this time pre-approximate number all is 0, so all resource all can be met, process 1 adds 1 with the pre-approximate number of resource 1,2,4,6,9, and blockade is finished, and affairs are carried out.
Suppose that process 2 is seized operation, needs resource 1,2,5,8 when process 1 is uncompleted.
It is as shown in the table that process 2 is blocked the back:
LOCK WAIT_RES HAVE_RES PEND_QUE
PID1 1,2,4,6,9 PID2
PID2 1,2, 5,8
Process 2 is not come when the affairs of process 1 are finished, this time, resource 5,8 pre-approximate number was 0, process 2 can be applied for resource 5,8, but the pre-approximate number of resource 1,2 is 1, so need to wait for resource 1,2, at this moment, therefore reverse the Resources list of searching in the formation has been found resource 1,2 at the lock node PID1 place of process 1, treats the scheduling queue identification item at its this lock node end, add PID2, the pre-approximate number of resource 1,2,5,8 is added 1.
Suppose process 3 needs three resources 3,4,8.
It is as shown in the table that process 3 is blocked the back:
LOCK WAIT_RES HAVE_RES PEND_QUE
PID1 1,2,4,6,9 PID2,PID3
PID2 1,2, 5,8, PID3
PID3 4,8 3
Process 3 finds that the pre-approximate number of resource 3 is 0, resource 4 and 8 pre-approximate number are not 0, therefore need to wait for resource 4,8, reverse search resource queue, for the first time found resource 8 at the PID2 place, therefore in the obstruction formation that joins PID2 of the PID of oneself, find resource 4 at the PID1 place for the first time, therefore the PID of oneself has been joined the obstruction rear of queue of PID1.
Process 1 release is as shown in the table: TASKLOCK;
LOCK WAIT_RES HAVE_RES PEND_QUE
PID1 1,2,4,6,9 PID3
PID2 1,2,5,8, PID3
PID3 4,8 3
Process 1 complete release at first finds release to concentrate first element PID2, gives him with its resource that needs 1,2, finds that PID2 can call in operation, calls in.
LOCK NEED_RES HAVE_RES PEND_QUE
PID1 1,2,4,6,9
PID2 1,2,5,8 PID3
PID3 8 4,3
[0093]Next take off release element PID3 one time, the resource 4 that it needs, PID1 can provide, but detecting its resource does not obtain fully, does not do any action.
LOCK NEED_RES HAVE_RES PEND_QUE
PID2 1,2,5,8, PID3
PID3 8 4,3
PID1 is deleted from formation, and the pre-approximate number of its used resource 1,2,4,6,9 subtracts one.
TASKUNLOCK。
Adopt said method, in preemptive priority two times scheduling system, realize quick lock mechanism effectively, for concurrent the providing efficiently of affairs supported.
Should be understood that, for those of ordinary skills, can be improved according to the above description or conversion, and all these improvement and conversion all should belong to the protection domain of claims of the present invention.

Claims (10)

1. the locking method of a lock mechanism, it may further comprise the steps:
The pre-approximate number of A1, each resource of initialization is respectively preset value, is used for each state of resources of mark and is not reservation; Wherein, the steps A 1 concrete following steps of carrying out: the Resources list is set, is used to manage the pre-approximate number of each resource; The pre-approximate number of each resource of the described the Resources list of initialization is respectively preset value;
A2, when applying for each resource, the pre-approximate number of each resource of apply for is added an operation, the lock node that current process is relevant joins the lock waiting list, and judges whether all apply for successfully, if do not apply for successfully then carry out A3 less than whole; Wherein, described lock waiting list is provided with following respectively for each lock node: process identification (PID), resource to be applied for, the successful resource of application and treat the scheduling queue sign;
A3, for each resource of application failure, the described lock waiting list of reverse search, judge whether to search for therein and obtain required resource, be then to treat the scheduling queue identification item what Search Results shut node mutually, add the process identification (PID) of current process, and the resource that search obtains is added to the resource items to be applied for of the relevant lock node of current process;
Whether all each resource of A4, judgement application failure search is finished, otherwise continues execution A3.
2. locking method according to claim 1 is characterized in that, in the steps A 2, when applying for each resource, is in described the Resources list, and the pre-approximate number of each resource of apply for is added an operation.
3. the unlock method of a lock mechanism, it may further comprise the steps:
B1, resources allocation is given lock node in the lock waiting list in order; Wherein, described lock waiting list is provided with following respectively for each lock node: process identification (PID), resource to be applied for, the successful resource of application and treat the scheduling queue sign;
B2, for each resource that a certain lock node is applied for, judge whether it all applies for successfully, be its corresponding process that then unblocks, the pre-approximate number of corresponding resource is subtracted one.
4. unlock method according to claim 3 is characterized in that, also carries out following steps before the step B1:
B0, judge that the head node of described lock waiting list is invalid, judge that perhaps affairs have carried out to the end, then execution in step B1.
5. the implementation method of a lock mechanism, it is rapid that it comprises that the following step that locks is conciliate lock-step;
The described step that locks may further comprise the steps:
The pre-approximate number of C1, each resource of initialization is respectively preset value, is used for each state of resources of mark and is not reservation; Wherein, step C1 specifically carries out following steps: the Resources list is set, is used to manage the pre-approximate number of each resource; The pre-approximate number of each resource of the described the Resources list of initialization is respectively preset value;
C2, when applying for each resource, the pre-approximate number of each resource of apply for is added an operation, the lock node that current process is relevant joins the lock waiting list, and judges whether all apply for successfully, if do not apply for successfully then carry out C3 less than whole; Wherein, described lock waiting list is provided with following respectively for each lock node: process identification (PID), resource to be applied for, the successful resource of application and treat the scheduling queue sign;
C3, for each resource of application failure, the described lock waiting list of reverse search, judge whether to search for therein and obtain required resource, be then to treat the scheduling queue identification item what Search Results shut node mutually, add the process identification (PID) of current process, and the resource that search obtains is added to the resource items to be applied for of the relevant lock node of current process;
Whether all each resource of C4, judgement application failure search is finished, otherwise continues execution C3; Described release step may further comprise the steps:
C5, resources allocation is given lock node in the lock waiting list in order; Wherein, described lock waiting list is provided with following respectively for each lock node: process identification (PID), resource to be applied for, the successful resource of application and treat the scheduling queue sign;
C6, for each resource that a certain lock node is applied for, judge whether it all applies for successfully, be its corresponding process that then unblocks, the pre-approximate number of corresponding resource is subtracted one.
6. implementation method according to claim 5 is characterized in that, among the step C2, when applying for each resource, is in described the Resources list, and the pre-approximate number of each resource of apply for is added an operation;
And, among the step C6, the pre-approximate number of corresponding resource is subtracted for the moment, be in described the Resources list, the pre-approximate number of corresponding resource is subtracted an operation.
7. implementation method according to claim 5 is characterized in that, also carries out following steps before the step C5:
C50, judge that the head node of described lock waiting list is invalid, judge that perhaps affairs have carried out to the end, then execution in step C5.
8. implementation method according to claim 5 is characterized in that, also carries out following steps before the step C50: adopting periodic monitor mechanism, judge whether overtime not response, is then to carry out C50.
9. implementation method according to claim 5 is characterized in that, among the step C6, before the process of the current lock node correspondence that unblocks, also carries out following steps: judge whether this process is effective, otherwise do not make subsequent treatment.
10. implementation method according to claim 5 is characterized in that, step C2 is to the operation of step C4, and step C5 adopts respectively and monopolizes the realization of task form to the operation of step C6.
CN2008100664740A 2008-04-07 2008-04-07 Locking method, unlocking method and implementing method for lock mechanism Expired - Fee Related CN101256509B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008100664740A CN101256509B (en) 2008-04-07 2008-04-07 Locking method, unlocking method and implementing method for lock mechanism

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008100664740A CN101256509B (en) 2008-04-07 2008-04-07 Locking method, unlocking method and implementing method for lock mechanism

Publications (2)

Publication Number Publication Date
CN101256509A CN101256509A (en) 2008-09-03
CN101256509B true CN101256509B (en) 2010-09-01

Family

ID=39891353

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008100664740A Expired - Fee Related CN101256509B (en) 2008-04-07 2008-04-07 Locking method, unlocking method and implementing method for lock mechanism

Country Status (1)

Country Link
CN (1) CN101256509B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108990422A (en) * 2017-03-31 2018-12-11 华为技术有限公司 A kind of method, apparatus and calculating equipment of lock distribution

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102355473B (en) * 2011-06-28 2013-12-25 用友软件股份有限公司 Locking control system in distributed computing environment and method
WO2015165073A1 (en) 2014-04-30 2015-11-05 Oracle International Corporation System and method for supporting adaptive self-tuning locking mechanism in transactional middleware machine environment
CN103064729A (en) * 2012-12-19 2013-04-24 上海西本网络科技有限公司 Locking and controlling method and device for sharing resources
CN104123193A (en) * 2014-08-07 2014-10-29 肖龙旭 Computer resource monitor method
CN104461707B (en) * 2014-11-28 2018-09-28 华为技术有限公司 a kind of lock request processing method and device
CN105335237B (en) * 2015-11-09 2018-09-21 浪潮电子信息产业股份有限公司 A kind of deadlock prevention technique of operating system
CN105700939B (en) * 2016-04-21 2019-07-02 北京京东尚科信息技术有限公司 The method and system of Multi-thread synchronization in a kind of distributed system
CN107357648B (en) * 2017-05-25 2020-05-15 吕锦柏 Method for realizing spin lock when multi-core CPU accesses resources
US11347712B2 (en) * 2017-11-07 2022-05-31 International Business Machines Corporation Preventing long running transactions from holding record locks
CN110334823B (en) * 2019-06-17 2022-04-05 北京大米科技有限公司 Reservation method, reservation device, electronic equipment and medium
CN112148695A (en) * 2019-06-26 2020-12-29 华为技术有限公司 Resource lock management method and device
CN110990161A (en) * 2019-11-15 2020-04-10 北京浪潮数据技术有限公司 Shared resource access method, device, equipment and computer readable storage medium
CN115392895B (en) * 2022-10-28 2023-03-24 深圳市小赢信息技术有限责任公司 Account data processing method, device, terminal and medium based on hotspot account

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108990422A (en) * 2017-03-31 2018-12-11 华为技术有限公司 A kind of method, apparatus and calculating equipment of lock distribution
CN108990422B (en) * 2017-03-31 2021-07-20 华为技术有限公司 Lock distribution method and device and computing equipment

Also Published As

Publication number Publication date
CN101256509A (en) 2008-09-03

Similar Documents

Publication Publication Date Title
CN101256509B (en) Locking method, unlocking method and implementing method for lock mechanism
US5918248A (en) Shared memory control algorithm for mutual exclusion and rollback
AU2016244128B2 (en) Processing database transactions in a distributed computing system
US5269017A (en) Type 1, 2 and 3 retry and checkpointing
US9418135B2 (en) Primary database system, replication database system and method for replicating data of a primary database system
JP2005502941A (en) Sacrificial selection for deadlock detection
Aldarmi Real-time database systems: concepts and design
Alrifai et al. Distributed management of concurrent web service transactions
Hung et al. Locking protocols for concurrency control in real-time database systems
CN102193987A (en) Method and system for increasing node data relationship based on OLTP (online transaction processing)
CN113656214A (en) Method and system for realizing out-of-order CPU refreshing without stopping running water
Holler Chapter 13. Multiple copy update
US8327383B2 (en) Cancellation of concurrent worker objects
Grover et al. Analysis of deadlock detection and resolution techniques in distributed database environment
WO2017135978A1 (en) Two-phase commit protocol mixing for distributed transactions
Hwang et al. Transaction recovery in federated autonomous databases
Siek et al. Atomic RMI 2: Highly parallel pessimistic distributed transactional memory
Said et al. A protocol to control replication in distributed real-time database systems
Abdul-Mehdi et al. A model for transaction management in mobile databases
Li et al. Algebraic semantics for compensable transactions
Yu et al. Recovery of data integrity under multi-tier architectures
Chakma et al. An analysis and improvement of probe-based algorithm for distributed deadlock detection
Bhalla et al. Parallelizing serializable transactions within distributed real-time database systems
Gottschlich et al. An efficient lock-aware transactional memory implementation
Tomar et al. A review on deadlock detection in distributed database

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20170913

Address after: Shangqiu City, Henan province 476600 Ma Qiao Zhen Ma Zhuang Cun Pang Zhuang Yongcheng City No. 039 group

Patentee after: Pang Jichao

Address before: 518057 Nanshan District Guangdong high tech Industrial Park, South Road, science and technology, ZTE building, Ministry of Justice

Patentee before: ZTE Corporation

TR01 Transfer of patent right
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Pang Jichao

Inventor before: Wan Peng

CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: 541006 the Guangxi Zhuang Autonomous Region Qifeng Yanshan District of Guilin City Park

Patentee after: Pang Jichao

Address before: Shangqiu City, Henan province 476600 Ma Qiao Zhen Ma Zhuang Cun Pang Zhuang Yongcheng City No. 039 group

Patentee before: Pang Jichao

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20100901

Termination date: 20180407