CN103716383B - A kind of method and device for accessing shared resource - Google Patents

A kind of method and device for accessing shared resource Download PDF

Info

Publication number
CN103716383B
CN103716383B CN201310689369.3A CN201310689369A CN103716383B CN 103716383 B CN103716383 B CN 103716383B CN 201310689369 A CN201310689369 A CN 201310689369A CN 103716383 B CN103716383 B CN 103716383B
Authority
CN
China
Prior art keywords
lock
mark
node
shared resource
client
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.)
Active
Application number
CN201310689369.3A
Other languages
Chinese (zh)
Other versions
CN103716383A (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201310689369.3A priority Critical patent/CN103716383B/en
Publication of CN103716383A publication Critical patent/CN103716383A/en
Priority to PCT/CN2014/088928 priority patent/WO2015085826A1/en
Application granted granted Critical
Publication of CN103716383B publication Critical patent/CN103716383B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms

Abstract

The present invention relates to data communication technology field, disclose a kind of method and device for accessing shared resource, in the scheme of description of the embodiment of the present invention, first node is after the lock authority request that the client for receiving first node is sent, just forwarded during the lock mark for not finding the mark including the shared resource in first node, that is, the lock mark for including the mark of the shared resource is first searched whether in first node, only in the absence of when, just forwarded, in the presence of and, directly distribute just, and client obtains lock mark than going the time that other nodes acquisition lock mark expends few from first node, therefore, solve the problems, such as time-consuming longer existing for the method for current access shared resource.

Description

A kind of method and device for accessing shared resource
Technical field
The present invention relates to data communication technology field, more particularly to a kind of method and device for accessing shared resource.
Background technology
With the development of memory technology, various data messages are in explosive growth, and people are look for a kind of powerful Data center architecture.Dual-active data center is exactly the important solution of one of which, by dual-active technology, can it is multiple across The data center of region(Storage device)Between realize business disaster tolerance and load balancing, and then integrate the storage money of storage device Source, as shown in Figure 1A.
Storage array is the memory carrier of storage device, in the solution of dual-active data center, based on storage array Machine application provides the shared resource of virtualization.In system operation, data can be simultaneously written into the storage of two storage devices In array, when one of storage device breaks down, another storage device still can externally provide service, and then realize Data disaster tolerance.In order to realize the virtualization integration of storage resource and data disaster tolerance, need to provide one kind between two storage devices mutually Reprimand mechanism, prevent the concurrently access of shared resource(Each storage device includes multiple nodes, and each node includes multiple clients End, as shown in Figure 1B, wherein, client refers to the process of node visit shared resource), because if multiple client is visited simultaneously Ask and operation data, it is possible to the mutually situation of covering shared resource occurs between each client, causes accessed shared Resource is in inconsistent state.
In group system, lock manager is mutual exclusion protection mechanism between a kind of conventional node, and it causes a certain shared money Source can only be accessed by a client each time, realize that the process that shared resource accesses is as follows by lock manager(Such as Fig. 1 C institutes Show):
Assuming that there are three nodes in storage device 1:Node 1, node 2, node 3
Step a:A lock manager is distributed for shared resource A;
Step b:When node 2 needs to access shared resource A, authority is locked to lock manager application is corresponding with shared resource A;
Step c:Node 2 accesses shared resource A after lock authority corresponding with shared resource A is obtained;
Step d:Node 3 locks authority to lock manager application is corresponding with shared resource A, because lock has been authorized to, locks Manager can postpone the mandate of the lock request of other rights conflicts, after the lock holder release lock authority for only waiting conflict, new Lock request can just be authorized to.
By said process as can be seen that when synchronization has multiple client access a certain shared resource, pass through lock tube Reason device reaches the purpose that ordering of the multiple client to same shared resource accesses, and ensures the uniformity of data accessed.But It is that current lock manager has following defect:When some nodes and lock manager node are not same nodes, pin is being obtained During to locking mark corresponding to the lock authority of any one shared resource, going other nodes to go to obtain lock authority, the consuming time being present The problem of longer.
In summary, there is the problem of time-consuming longer in the method for current access shared resource.
The content of the invention
The embodiment of the present invention provides a kind of method and device for accessing shared resource, can solve the shared money of current access The problem of longer is taken existing for the method in source.
First aspect, there is provided a kind of method for accessing shared resource, including:
Receive the lock authority request of the mark of the carrying shared resource of first node forwarding;
Wherein, the lock authority request be the first node the client for receiving first node send and Forwarded during the lock mark for not finding the mark including the shared resource in first node;
The lock mark for including the mark of the shared resource is determined from the lock mark of storage;
The lock of determination is identified and distributed by the first node to the client, gives the client to institute Lock authority corresponding to the lock mark of shared resource is stated, for access of the client to the shared resource.
With reference in a first aspect, in the first possible implementation, the first node is used to cache the first segment Lock mark corresponding to the lock authority of each client occupancy in point, or used, free time is accounted for less than deletion threshold value Lock authority corresponding to lock mark.
With reference in a first aspect, or first aspect the first possible implementation, second of possible realization side In formula, the lock authority request of the mark of the carrying shared resource for receiving first node forwarding, specifically include:
Receive the lock authority request of the mark for the carrying shared resource that the first node is forwarded by section point;
Wherein, to be the section point send and first receiving the first node lock authority request Forwarded during the lock mark for not finding the mark including the shared resource in node.
With reference to second of possible implementation of first aspect, in the third possible implementation, described second Node is used to cache in the lock authority specified lock mark corresponding to occupied lock authority, or, taken in the lock authority specified Cross, free time is less than lock mark corresponding to the lock authority for deleting threshold value.
With reference in a first aspect, or first aspect second to the third possible implementation, it is possible at the 4th kind In implementation, the lock by determination is identified and distributed by the first node to the client, is specifically included:
The lock of determination is identified and sent by the section point to the first node, to cause the first segment Point distributes the lock mark to the client.
With reference in a first aspect, or first aspect first to fourth kind of possible implementation, it is possible at the 5th kind In implementation, the lock by determination is identified and distributed by the first node to the client, is specifically included:
If it is determined that lock mark corresponding to lock authority when being taken by other clients, to taking the visitor for locking authority Family end sends lock authority and recalls instruction, order take the lock authority client complete to access and discharge after the shared resource described in Lock authority;
Second aspect, there is provided a kind of device for accessing shared resource, including:
Receiving unit, the lock authority request of the mark of the carrying shared resource for receiving first node forwarding;Wherein, institute It is that the first node is receiving the client transmission of first node and do not searched in first node to state lock authority request To mark including the shared resource lock mark when forward;
Determining unit, for the lock mark for determining to include the mark of the shared resource from the lock mark of storage;
Allocation unit, distributed to the client, given by the first node for the lock of determination to be identified The client is to lock authority corresponding to the lock mark of the shared resource, for the client to the shared resource Access.
With reference to second aspect, in the first possible implementation, the lock power that receives of the receiving unit Limit request is that the first node is sent, and each client that the first node is used to cache in the first node accounts for Mark is locked corresponding to lock authority, or accounts for used, free time less than the corresponding lock mark of lock authority for deleting threshold value.
With reference to the first possible implementation of second aspect, or second aspect, second of possible realization side In formula, the receiving unit is specifically used for:
Receive the lock authority request of the mark for the carrying shared resource that the first node is forwarded by section point;
Wherein, to be the section point send and first receiving the first node lock authority request Forwarded during the lock mark for not finding the mark including the shared resource in node.
With reference to second of possible implementation of second aspect, in the third possible implementation, the reception The lock authority request that unit receives is that the section point is sent, and the section point is used to cache the lock power specified Occupied lock locks mark in limit corresponding to authority, or, used, free time is accounted in the lock authority specified less than deletion threshold Lock mark corresponding to the lock authority of value.
With reference to second aspect, or second aspect second to the third possible implementation, it is possible at the 4th kind In implementation, the allocation unit is specifically used for:
The lock of determination is identified and sent by the section point to the first node, to cause the first segment Point distributes the lock mark to the client.
It is possible at the 5th kind with reference to first to fourth kind of possible implementation of second aspect, or second aspect In implementation, the allocation unit is specifically used for:
If it is determined that lock mark corresponding to lock authority when being taken by other clients, to taking the visitor for locking authority Family end sends lock authority and recalls instruction, order take the lock authority client complete to access and discharge after the shared resource described in Lock authority;
Lock mark corresponding to the lock authority for the client release for taking the lock authority is distributed by the first node To the client.
The present invention has the beneficial effect that:
In existing technology, when some nodes and lock manager node are not same nodes, obtaining for any one Corresponding to the lock authority of shared resource during lock mark, to go other nodes to go to obtain lock authority, exist and expend the time and longer ask Topic, and the embodiment of the present invention is, first receives the lock authority request of the mark of the carrying shared resource of first node forwarding, wherein, The lock authority request is that the first node is receiving the client transmission of first node and do not looked into first node Forwarded during the lock mark for finding the mark including the shared resource, then, determine to include institute from the lock mark of storage The lock mark of the mark of shared resource is stated, finally, the lock of determination is identified and distributed by the first node to the visitor Family end, the client is given to lock authority corresponding to the lock mark of the shared resource, for the client to institute The access of shared resource is stated, in this scenario, the lock authority that first node is sent in the client for receiving first node After request, do not found in first node the mark including the shared resource lock mark when just forwarded, that is, Say, first to search whether to include the lock mark of the mark of the shared resource in first node, only in the absence of when, just enter Row forwarding, and in the presence of, directly distribute just, and client obtains lock mark than going other nodes to obtain from first node The time that lock mark expends is few, therefore, solves the problems, such as time-consuming longer existing for the method for current access shared resource.
Brief description of the drawings
Accompanying drawing is used for providing a further understanding of the present invention, and a part for constitution instruction, implements with the present invention Example is used to explain the present invention together, is not construed as limiting the invention.In the accompanying drawings:
Figure 1A is the structural representation of dual-active data center in the prior art;
Figure 1B is prior art interior joint and the structural representation of client;
Fig. 1 C are the schematic diagram that dual-active data center accesses shared resource in the prior art;
Fig. 2 is the schematic diagram that shared resource is accessed in the embodiment of the present invention;
Fig. 3 is the first embodiment that shared resource is accessed in the embodiment of the present invention;
Fig. 4 is the second embodiment that shared resource is accessed in the embodiment of the present invention;
Fig. 5 is the illustrative view of functional configuration for the device that shared resource is accessed in the embodiment of the present invention.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention In accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is Part of the embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art The every other embodiment obtained under the premise of creative work is not made, belongs to the scope of protection of the invention.
In addition, the terms " system " and " network " are often used interchangeably herein.The terms " and/ Or ", only a kind of incidence relation for describing affiliated partner, represents there may be three kinds of relations, for example, A and/or B, can be with table Show:Individualism A, while A and B be present, these three situations of individualism B.In addition, alphabetical "/" herein, is typicallyed represent front and rear Affiliated partner is a kind of relation of "or".
It is longer in order to solve the problems, such as to take present in prior art, in the embodiment of the present invention, first to receive first segment The lock authority request of the mark of the carrying shared resource of point forwarding, wherein, lock authority request is that first node is receiving first Forwarded during lock mark that is that the client of node is sent and not finding the mark including shared resource in first node, Then, the lock mark of mark for including shared resource is determined from the lock mark of storage, finally, the lock mark of determination is passed through First node is distributed to client, client is given to lock authority corresponding to the lock mark of shared resource, for client to altogether Enjoy the access of resource, in this scenario, first node receive first node client send lock authority request after, Forwarded during the lock mark for not finding the mark including shared resource in first node, that is to say, that be first first Search whether to include the lock mark of the mark of shared resource in node, in the presence of, be directly allocated, only in the absence of when, Just forwarded, and client obtains lock mark than going other nodes to obtain the time that lock mark expends from first node It is few, therefore, solve the problems, such as time-consuming longer existing for the method for current access shared resource.
The preferred embodiment of the present invention is described in detail with reference to Figure of description, it will be appreciated that this place The preferred embodiment of description is merely to illustrate and explain the present invention, and is not intended to limit the present invention, and in situation about not conflicting Under, the feature in embodiment and embodiment in the application can be mutually combined.
The preferred embodiment of the present invention is described in detail below in conjunction with the accompanying drawings.
As shown in fig.2, in the embodiment of the present invention, the detailed process for accessing shared resource is as follows:
Step 200:The lock authority request of the mark of the carrying shared resource of first node forwarding is received, wherein, lock authority Request is that first node is receiving the client transmission of first node and do not found including shared money in first node Forwarded during the lock mark of the mark in source;
Step 210:The lock mark of mark for including shared resource is determined from the lock mark of storage;
Step 220:The lock of determination is identified and distributed by first node to client, gives client to shared resource Lock authority corresponding to lock mark, for access of the client to shared resource.
In the embodiment of the present invention, lock mark includes following information, the mark of the shared resource of protection, accesses shared resource Mode, in actual applications, other information in addition to above two information can also be included, be no longer described in detail herein.
In the embodiment of the present invention, accessing the mode of shared resource has a variety of, e.g., reads the mode of shared resource, now, client The authority for the reading shared resource that end obtains, and for example, writes the mode of shared resource, and now, this is common for the write-in that client obtains The authority of resource is enjoyed, wherein, if the authority of the reading shared resource obtained, client can only be read out to the shared resource Operation, it is impossible to carry out write operation;If the authority of the write-in shared resource obtained, client can not only be entered to the shared resource Row read operation, moreover it is possible to carry out write operation, certainly, in actual applications, also have other modes for accessing shared resource, herein No longer it is described in detail one by one.
In the embodiment of the present invention, the form of first node have it is a variety of, for example, can be used for caching each in first node Lock mark corresponding to the lock authority that individual client takes, or used, free time is accounted for less than the lock authority pair for deleting threshold value The lock mark answered, certainly, in actual applications, first node can be also used for caching other information, no longer carry out herein one by one It is described in detail.
Step 200-220 executive agent has a variety of, is illustrated below by taking lock manager as an example, it is necessary to illustrate, Lock manager is one embodiment of executive agent, and in actual applications, executive agent can also be other, no longer enter herein Row is described in detail one by one.
In actual applications, if client sends the lock authority request for accessing shared resource to other nodes, due to being not With the interaction between node, accordingly, there exist the problem of longer is taken, in the embodiment of the present invention, access is sent in order to shorten client The lock authority request of shared resource, or the time consumed of lock mark is received, client is sending access shared resource Lock authority request when, can to residing for client first node send access shared resource lock authority request, if first The lock mark of the currently stored mark for including shared resource to be visited in node, then the first node corresponding lock is identified Distribution is to client, should if the current lock mark for not storing the mark including shared resource to be visited in the first node First node sends the lock authority request for accessing shared resource to the lock authority for the access shared resource for managing different nodes Lock manager, then the lock mark that the lock manager received is returned are distributed to client, and store lock mark, then first , will if lock mark is unassigned when node receives the lock authority request of the access shared resource of client transmission again The distribution of lock mark obtains the problem of existing time-consuming longer during lock identifies to client so as to avoid.
For example, the node where client 1 is in the first storage device, lock manager is located at the second storage device, wherein, Lock manager manages the lock authority of the first storage device and the second storage device access shared resource, then client 1 will obtain visit The lock mark of the first shared resource is asked, that is, when locking authority, can directly send and visit to the lock manager positioned at the second storage device The lock authority request of the first shared resource is asked, now, due to being the communication interaction between two storage devices, accordingly, there exist consumption When it is longer the problem of, send to shorten client 1 and access the lock authority request of the first shared resource, or, obtain and access the The time of the lock mark of one shared resource, client 1 can be sent to the first node where client 1 accesses the first shared money The lock authority request in source, if the lock mark for accessing the first shared resource has been cached in first node, and lock mark is unassigned, Then first node sends lock mark to client 1, that is to say, that the lock for accessing the first shared resource is distributed to client 1 Authority;If the uncached lock mark for accessing the first shared resource, first node will access the first shared resource in first node Lock authority request send to lock manager, the lock mark that the lock manager received is returned is sent to client, and is cached The lock identifies, to receive the lock authority request for the shared resource of access first that client 1 or other clients are sent again When, if lock mark is unassigned, lock mark is sent to client.
In the embodiment of the present invention, receive first node forwarding carrying shared resource mark lock authority request have it is a variety of Mode, for example, the lock authority request of the mark for the carrying shared resource that first node is forwarded by section point can be received, its In, lock authority request is that section point is receiving first node transmission and do not found including shared in first node Forwarded during the lock mark of the mark of resource, the lock power of the mark of the above-mentioned carrying shared resource for simply receiving first node forwarding A kind of implementation of request is limited, in actual applications, also has other implementations, is no longer described in detail herein.
Receive the embodiment of the lock authority request of the mark for the carrying shared resource that first node is forwarded by section point It is as follows:
For example, the first storage device and the second storage device share 10 shared resources:Shared resource 1, shared resource 2 ..., then the corresponding lock mark of each shared resource, the section point positioned at the first storage device can store 10 Individual shared resource corresponding lock mark, that is, access the lock authority of 10 shared resources respectively, if being located at the second storage device Client 1 to access shared resource 1, then client 1 can directly to positioned at the first storage device section point send visit The lock authority request of shared resource 1 is asked, lock mark corresponding with shared resource 1 is obtained from section point;In order to improve efficiency, Client 1 can also first send the lock authority request for accessing shared resource 1 to residing first node, if first node is cached with Lock mark corresponding with shared resource 1, then first node, which identifies the lock, sends to client 1, will lock authority distribution to client End 1, if uncached in first node have lock mark corresponding with shared resource 1, first node is forwarded to section point and accessed The lock authority request of shared resource 1, and the lock mark corresponding with shared resource 1 that the section point received is sent is sent extremely Client 1, by lock authority distribution to client 1.
In the embodiment of the present invention, section point has diversified forms, optionally, occupied in the lock authority specified for caching Lock authority corresponding to lock mark, or, accounted in the lock authority specified used, free time be less than deletion threshold value lock authority Corresponding lock mark.
In the embodiment of the present invention, there can also be multiple section points in a storage device, section point refers to for caching Lock mark corresponding to occupied lock authority in fixed lock authority, or, account for that used, free time is small in the lock authority specified Mark is locked corresponding to the lock authority of threshold value in deleting, now, different section points can be managed corresponding to different shared resources Lock mark.
For example, the first storage device and the second storage device share 10 shared resources:Shared resource 1, shared resource 2 ..., then money is shared in the corresponding lock mark of each shared resource, the management of section point 1 positioned at the first storage device The corresponding lock mark of source 1-5 difference, the corresponding lock of the managing shared resource 6-10 of section point 2 difference positioned at the first storage device Mark, 10 shared resources corresponding lock mark, that is, access 10 respectively is managed positioned at the lock manager of the second storage device The lock authority of individual shared resource, if the client 1 positioned at the first storage device will access shared resource 1, client 1 can be straight The lock authority request for being sent to the lock manager positioned at the second storage device and accessing shared resource 1 is connect, is obtained from lock manager Lock mark corresponding with shared resource 1;In order to improve efficiency, client 1 can first send to residing first node and access altogether The lock authority request of resource 1 is enjoyed, if first node is cached with lock mark corresponding with shared resource 1, first node locks this Mark is sent to client 1, will lock authority distribution to client 1, if in first node it is uncached have it is corresponding with shared resource 1 Lock identifies, then first node forwards the lock authority request for accessing shared resource 1 to section point 1, if not searched in section point 1 To the mark including shared resource lock mark when, be forwarded to lock manager, and the lock manager received is sent together Enjoy lock mark corresponding to resource 1 to send to client 1 by first node, by lock authority distribution to client 1.
Similarly, if the client 2 positioned at the first storage device will access shared resource 10, client 2 can directly to The lock authority request for accessing shared resource 10 is sent positioned at the lock manager of the second storage device, is obtained together from lock manager Enjoy lock mark corresponding to resource 10;In order to improve access efficiency, client 2 can also first send to the 3rd residing node and access The lock authority request of shared resource 10, if being cached with lock mark corresponding with shared resource 10, the 3rd node in the 3rd node Lock mark is sent to client 2, will lock authority distribution to client 2, if uncached in the 3rd node have and shared resource Lock identifies corresponding to 10, then the 3rd node forwards the lock authority request for accessing shared resource 10 to section point 2, if section point Uncached in 2 to have lock mark corresponding with shared resource 10, then section point 2 forwards to lock manager and accesses shared resource 10 Authority request is locked, and the lock mark corresponding with shared resource 10 that the lock manager received is sent is sent by the 3rd node To client 2, by lock authority distribution to client 2.
Above-described embodiment simply lists the situation that a storage device only exists two section points, in practical application In, it is also possible to the presence of the situation of the multiple section points of storage device.If multiple section points be present in a storage device, Then client first sends the lock authority request for accessing shared resource to visitor when sending the lock authority request for accessing shared resource First node where the end of family, if being cached with lock mark corresponding with shared resource to be visited in first node where client Know, then the first node where client sends lock mark corresponding with shared resource to be visited to client, if client The uncached lock for having lock mark corresponding with shared resource to be visited, then accessing shared resource in first node where holding Authority request is forwarded to corresponding section point, if being cached with lock mark corresponding with shared resource to be visited in section point Know, then section point sends lock mark corresponding with shared resource to be visited to client, if uncached in section point There is lock mark corresponding with shared resource to be visited, then the lock authority request for accessing shared resource is forwarded to lock manager.
In the embodiment of the present invention, the mode of the lock authority request of the mark of the carrying shared resource of first node forwarding is received Have it is a variety of, for example, can directly by first node receive first node forward carrying shared resource mark lock authority Request;The lock authority that can also be the mark that the carrying shared resource that first node forwards is received by section point please Ask.
So, similarly, the lock mark of determination is also had by way of first node is distributed to client it is a variety of, for example, Can be directly to distribute the lock mark of determination to client by first node;Or, or, by the lock mark of determination Knowledge is sent to first node by section point, to cause first node to lock mark distribution to client.
In the embodiment of the present invention, client either please to the lock authority that access shared resource is directly sent to lock manager Ask, or the lock authority request for accessing shared resource is sent to first node, or section point, receive the lock tube of the request Lock mark corresponding with the shared resource accessed may be stored with reason device or node, but lock mark is sent to client End, that is, the lock mark corresponding to lock authority it is occupied, now, it is determined that lock mark corresponding to lock authority by other clients During occupancy, the client transmission lock authority that authority is locked to occupancy recalls instruction, and the client completion of order occupancy lock authority accesses altogether Authority is locked in release after enjoying resource;Lock mark corresponding to the lock authority for the client release for taking lock authority is passed through into first node point It is assigned to client.
That is, the lock mark of determination is had by way of first node is distributed to client it is a variety of, such as:If really When lock authority corresponding to fixed lock mark is taken by other clients, send lock authority to the client for taking lock authority and recall finger Show, the client completion that order takes lock authority accesses release lock authority after shared resource, and the client for taking lock authority is discharged Lock authority corresponding to lock mark distributed by first node to client.
For example, client 1 sends the lock authority request for accessing shared resource 1 to section point, if being cached in section point It is corresponding with shared resource 1 lock mark be allocated to other nodes, that is to say, that the lock mark corresponding to lock authority be allocated To client 2, then the transmission lock authority of client 2 that authority is locked to occupancy recalls instruction, and the client 2 of order occupancy lock authority is completed Release lock authority when accessing shared resource, then, the lock authority that section point again discharges the client 2 for taking lock authority is corresponding Lock mark distribution to client 1.
Above-described embodiment, simply it is allocated with the lock mark corresponding with shared resource to be visited cached in section point To other clients, in actual applications, it is also possible in the first node where client, or, in lock manager The lock mark corresponding with shared resource to be visited of caching is allocated to other clients, now, then first node or lock Manager sends lock authority to the client for taking lock authority and recalls instruction, and process is same as the previously described embodiments, no longer enters herein Row is described in detail.
Embodiment for a better understanding of the present invention, concrete application scene given below, the mistake for accessing shared resource Journey, make and being described in further detail:
Lock delegation node by one-level and obtain and lock the embodiment identified.
Embodiment one(As shown in Figure 3):
Step 300:Client 1 sends the lock authority request for accessing shared resource 1 to the first node at place;
Step 310:First node judges whether to be stored with lock mark corresponding with shared resource 1 in first node and is somebody's turn to do Lock mark is unassigned, if so, performing step 350, otherwise, performs step 320;
Step 320:First node sends the lock authority request for accessing shared resource 1 to lock manager;
Wherein, lock manager is located at the second storage device.
Step 330:Lock manager judges whether to be stored with lock mark corresponding with shared resource 1 in first node and is somebody's turn to do Lock mark is unassigned;If so, performing step 340, otherwise, step 360 is performed;
Step 340:Lock manager sends lock mark corresponding with shared resource 1 to first node;
Step 350:First node sends lock mark corresponding with shared resource 1 to client 1;
Step 360:Lock manager sends lock authority to the client 2 for taking lock authority and recalls instruction, and will take lock and weigh Lock mark is sent to client 1 by first node corresponding to the lock authority that the client 2 of limit discharges.
Embodiment two(As shown in Figure 4):
Step 400:Client 1 sends the lock authority request for accessing shared resource 1 to the first node at place;
Step 410:First node judges whether to be stored with lock mark corresponding with shared resource 1 in first node and is somebody's turn to do Lock mark is unassigned, if so, performing step 480, otherwise, performs step 420;
Step 420:First node sends the lock authority request for accessing shared resource 1 to section point;
In this step, client 1 is located at the first storage device with section point.
Step 430:Section point judges whether to be stored with lock mark corresponding with shared resource 1 in first node and is somebody's turn to do Lock mark is unassigned, if so, performing step 470, otherwise, performs step 440;
Step 440:Section point sends the lock authority request for accessing shared resource 1 to lock manager;
Wherein, lock manager is located at the second storage device.
Step 450:Lock manager judges whether to be stored with lock mark corresponding with shared resource 1 in first node and is somebody's turn to do Lock mark is unassigned;If so, performing step 460, otherwise, step 490 is performed;
Step 460:Lock manager sends lock mark corresponding with shared resource 1 to section point;
Step 470:Section point sends lock mark corresponding with shared resource 1 to first node;
Step 480:First node sends lock mark corresponding with shared resource 1 to client 1;
Step 490:Lock manager sends lock authority to the client 2 for taking lock authority and recalls instruction, and will take lock and weigh Lock mark is forwarded to first node by section point corresponding to the lock authority that the client 2 of limit discharges so that first node is sent out Deliver to client 1.
As shown in fig.5, the embodiment of the present invention also provides a kind of device for accessing shared resource, the device includes receiving list Member 500, determining unit 510, allocation unit 520, wherein:
Receiving unit 500, the lock authority request of the mark of the carrying shared resource for receiving first node forwarding;Its In, lock authority request is that first node is receiving the client transmission of first node and do not found in first node Forwarded during the lock mark of the mark including shared resource;
Determining unit 510, for the lock mark for the mark for determining to include shared resource from the lock mark of storage;
Allocation unit 520, distributed for the lock of determination to be identified by first node to client, give client to altogether Lock authority corresponding to the lock mark of resource is enjoyed, for access of the client to shared resource.
In the embodiment of the present invention, optionally, the lock authority request that receiving unit 500 receives is that first node is sent, First node is used to cache lock mark corresponding to the lock authority that each client in first node takes, or takes , free time be less than delete threshold value lock authority corresponding to lock mark.
In the embodiment of the present invention, optionally, receiving unit 500 is specifically used for:
Receive the lock authority request of the mark for the carrying shared resource that first node is forwarded by section point;
Wherein, lock authority request is that section point is receiving first node transmission and do not searched in first node To mark including shared resource lock mark when forward.
In the embodiment of the present invention, optionally, the lock authority request that receiving unit 500 receives is that section point is sent, Section point is used to cache in the lock authority specified lock mark corresponding to occupied lock authority, or, in the lock authority specified Used, free time is accounted for less than the corresponding lock mark of lock authority for deleting threshold value.
In the embodiment of the present invention, optionally, allocation unit 520 is specifically used for:
The lock of determination is identified and sent by section point to first node, to cause first node to lock mark distribution extremely Client.
In the embodiment of the present invention, optionally, allocation unit 520 is specifically used for:
If it is determined that lock mark corresponding to lock authority when being taken by other clients, to taking the client transmission of locking authority Lock authority recalls instruction, and the client completion that order takes lock authority accesses release lock authority after shared resource;
Lock mark corresponding to the lock authority for the client release for taking lock authority is distributed to client by first node.
In summary, in the embodiment of the present invention, the lock power of the mark of the carrying shared resource of first node forwarding is first received Limit request, wherein, lock authority request be first node the client for receiving first node send and in first node Forwarded during the lock mark for not finding the mark including shared resource, then, determine to include altogether from the lock mark of storage The lock mark of the mark of resource is enjoyed, finally, the lock of determination is identified and distributed by first node to client, gives client pair Lock authority corresponding to the lock mark of shared resource, for access of the client to shared resource, in this scenario, first node exists After the lock authority request of client transmission for receiving first node, the mark including shared resource is not found in first node Just forwarded during the lock mark of knowledge, that is to say, that the mark that first search whether to include shared resource in first node Lock mark, only in the absence of when, just forwarded, and in the presence of, directly distribute just, and client obtains from first node Lock mark is taken therefore, to solve current access shared resource than going the time that other nodes acquisition lock mark expends few The problem of longer is taken existing for method.
The present invention is with reference to method according to embodiments of the present invention, equipment(System)And the flow of computer program product Figure and/or block diagram describe.It should be understood that can be by every first-class in computer program instructions implementation process figure and/or block diagram Journey and/or the flow in square frame and flow chart and/or block diagram and/or the combination of square frame.These computer programs can be provided The processors of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce A raw machine so that produced by the instruction of computer or the computing device of other programmable data processing devices for real Present one flow of flow chart or one square frame of multiple flows and/or block diagram or the device of the function in multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to Make the manufacture of device, the command device realize in one flow of flow chart or multiple flows and/or one square frame of block diagram or Function in multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, so as in computer or The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one The step of function in individual square frame or multiple square frames.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know basic creation Property concept, then can make other change and modification to these embodiments.So appended claims be intended to be construed to include it is excellent Select embodiment and fall into having altered and changing for the scope of the invention.
Obviously, those skilled in the art can carry out various changes and modification without departing from this hair to the embodiment of the present invention The spirit and scope of bright embodiment.So, if these modifications and variations of the embodiment of the present invention belong to the claims in the present invention And its within the scope of equivalent technologies, then the present invention is also intended to comprising including these changes and modification.

Claims (10)

  1. A kind of 1. method for accessing shared resource, it is characterised in that including:
    Receive the lock authority request of the mark of the carrying shared resource of first node forwarding;
    Wherein, the lock authority request be the first node the client for receiving first node send and first Forwarded during the lock mark for not finding the mark including the shared resource in node, the first node is described for caching Lock mark corresponding to the lock authority that each client in first node takes, or account for used, free time and be less than and delete Identified except being locked corresponding to the lock authority of threshold value;
    The lock mark for including the mark of the shared resource is determined from the lock mark of storage;
    The lock of determination is identified and distributed by the first node to the client, gives the client to described common Lock authority corresponding to the lock mark of resource is enjoyed, for access of the client to the shared resource.
  2. 2. the method as described in claim 1, it is characterised in that the mark of the carrying shared resource for receiving first node forwarding The lock authority request of knowledge, is specifically included:
    Receive the lock authority request of the mark for the carrying shared resource that the first node is forwarded by section point;
    Wherein, to be the section point send and in first node receiving the first node lock authority request In forward when not finding the lock mark of mark including the shared resource.
  3. 3. method as claimed in claim 2, it is characterised in that the section point is used for occupied in the lock authority that caching is specified Mark is locked corresponding to lock authority, or, used, free time is accounted in the lock authority specified less than the lock power for deleting threshold value Lock mark corresponding to limit.
  4. 4. method as claimed in claim 2 or claim 3, it is characterised in that described that the lock mark of determination is passed through described first Node distribution specifically includes to the client:
    The lock of determination is identified and sent by the section point to the first node, to cause the first node will The lock mark is distributed to the client.
  5. 5. the method as described in claim 1, it is characterised in that described that the lock mark of determination is passed through into the first node Distribution specifically includes to the client:
    If it is determined that lock mark corresponding to lock authority when being taken by other clients, to taking the client for locking authority Send lock authority and recall instruction, the client that order takes the lock authority is completed to discharge the lock power after accessing the shared resource Limit;
    Lock mark corresponding to the lock authority for the client release for taking the lock authority is distributed to institute by the first node State client.
  6. A kind of 6. device for accessing shared resource, it is characterised in that including:
    Receiving unit, the lock authority request of the mark of the carrying shared resource for receiving first node forwarding;Wherein, the lock Authority request is that the first node is receiving the client transmission of first node and do not finding bag in first node Forwarded during the lock mark for including the mark of the shared resource, the lock authority request that the receiving unit receives is described What first node was sent, the first node is used to cache the lock authority pair that each client in the first node takes The lock mark answered, or used, free time is accounted for less than the corresponding lock mark of lock authority for deleting threshold value;
    Determining unit, for the lock mark for determining to include the mark of the shared resource from the lock mark of storage;
    Allocation unit, distributed to the client, given described by the first node for the lock of determination to be identified Client is to lock authority corresponding to the lock mark of the shared resource, for visit of the client to the shared resource Ask.
  7. 7. device as claimed in claim 6, it is characterised in that the receiving unit is specifically used for:
    Receive the lock authority request of the mark for the carrying shared resource that the first node is forwarded by section point;
    Wherein, to be the section point send and in first node receiving the first node lock authority request In forward when not finding the lock mark of mark including the shared resource.
  8. 8. device as claimed in claim 7, it is characterised in that the lock authority request that the receiving unit receives is institute Section point transmission is stated, the section point is used to cache in the lock authority specified lock mark corresponding to occupied lock authority Know, or, used, free time is accounted in the lock authority specified less than the corresponding lock mark of lock authority for deleting threshold value.
  9. 9. device as claimed in claim 7 or 8, it is characterised in that the allocation unit is specifically used for:
    The lock of determination is identified and sent by the section point to the first node, to cause the first node will The lock mark is distributed to the client.
  10. 10. device as claimed in claim 6, it is characterised in that the allocation unit is specifically used for:
    If it is determined that lock mark corresponding to lock authority when being taken by other clients, to taking the client for locking authority Send lock authority and recall instruction, the client that order takes the lock authority is completed to discharge the lock power after accessing the shared resource Limit;
    Lock mark corresponding to the lock authority for the client release for taking the lock authority is distributed to institute by the first node State client.
CN201310689369.3A 2013-12-13 2013-12-13 A kind of method and device for accessing shared resource Active CN103716383B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201310689369.3A CN103716383B (en) 2013-12-13 2013-12-13 A kind of method and device for accessing shared resource
PCT/CN2014/088928 WO2015085826A1 (en) 2013-12-13 2014-10-20 Method and apparatus for accessing shared resource

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310689369.3A CN103716383B (en) 2013-12-13 2013-12-13 A kind of method and device for accessing shared resource

Publications (2)

Publication Number Publication Date
CN103716383A CN103716383A (en) 2014-04-09
CN103716383B true CN103716383B (en) 2017-12-15

Family

ID=50408953

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310689369.3A Active CN103716383B (en) 2013-12-13 2013-12-13 A kind of method and device for accessing shared resource

Country Status (2)

Country Link
CN (1) CN103716383B (en)
WO (1) WO2015085826A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109947575A (en) * 2019-03-21 2019-06-28 恒生电子股份有限公司 Locking, method for releasing and the related system of Read-Write Locks

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103716383B (en) * 2013-12-13 2017-12-15 华为技术有限公司 A kind of method and device for accessing shared resource
CN106202074B (en) * 2015-04-29 2021-02-23 中兴通讯股份有限公司 Method and device for processing shared file
CN107402821B (en) * 2017-07-03 2020-06-30 阿里巴巴集团控股有限公司 Access control method, device and equipment for shared resources
CN109697127B (en) * 2017-10-24 2020-12-01 华为技术有限公司 Method and device for locking access operation of shared resource
CN108038005A (en) * 2017-12-28 2018-05-15 广东蜂助手网络技术股份有限公司 Shared resource access method, client, server-side, system based on zookeeper
CN109063132B (en) * 2018-08-02 2020-08-25 上海达梦数据库有限公司 Latch request method, latch authorization method, device and terminal equipment
CN110879743B (en) * 2019-11-20 2023-07-18 深圳市网心科技有限公司 Task eliminating method, device, system and medium based on edge computing environment
CN114500390B (en) * 2021-12-29 2024-01-19 中国航空工业集团公司西安航空计算技术研究所 rapidIO network flow control method

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100576848C (en) * 2005-12-09 2009-12-30 英业达股份有限公司 Distribution-type data dynamic program agent method
US8078622B2 (en) * 2008-10-30 2011-12-13 Network Appliance, Inc. Remote volume access and migration via a clustered server namespace
CN102375955A (en) * 2010-08-17 2012-03-14 伊姆西公司 System and method for locking files in combined naming space in network file system
CN103248667B (en) * 2012-02-14 2016-03-30 阿里巴巴集团控股有限公司 A kind of resource access method of distributed system and system
CN103297268B (en) * 2013-05-13 2016-04-06 北京邮电大学 Based on the distributed data consistency maintenance system and method for P2P technology
CN103716383B (en) * 2013-12-13 2017-12-15 华为技术有限公司 A kind of method and device for accessing shared resource

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109947575A (en) * 2019-03-21 2019-06-28 恒生电子股份有限公司 Locking, method for releasing and the related system of Read-Write Locks

Also Published As

Publication number Publication date
WO2015085826A1 (en) 2015-06-18
CN103716383A (en) 2014-04-09

Similar Documents

Publication Publication Date Title
CN103716383B (en) A kind of method and device for accessing shared resource
CN110032571B (en) Business process processing method and device, storage medium and computing equipment
US6971098B2 (en) Method and apparatus for managing transaction requests in a multi-node architecture
US7249152B2 (en) Dynamic disk space management by multiple database server instances in a cluster configuration
CN104935654B (en) Caching method, write-in point client in a kind of server cluster system and read client
US9830264B2 (en) Cache memory system and operating method for the same
US9223717B2 (en) Computer cache system providing multi-line invalidation messages
CN105512279B (en) A kind of metadata access method, relevant device and system
CN105426321B (en) Using RDMA close friend's caching method of remote location information
CN109491928A (en) Buffer control method, device, terminal and storage medium
CN108845877B (en) Method, device and system for managing memory
CN105138678A (en) Reading and distributing method and system for map tile data
CN104980416A (en) Data access method, device and system in content distribution network
US9679084B2 (en) Memory sharing across distributed nodes
CN110196860A (en) Unique identification distribution method and device, electronic equipment, storage medium
CN108363641A (en) A kind of standby machine data transferring method, control node and Database Systems
CN110012346A (en) User applies method and apparatus, the equipment of the frame data in quick obtaining frame buffer
CN108234422B (en) Resource scheduling method and device
US20070233965A1 (en) Way hint line replacement algorithm for a snoop filter
CN111406251B (en) Data prefetching method and device
CN109697127A (en) The method and apparatus that the access operation of a kind of pair of shared resource locks
US20130111150A1 (en) Method for preventing deadlock of node controller, and node controller
US20170364442A1 (en) Method for accessing data visitor directory in multi-core system and device
CN106326143B (en) A kind of caching distribution, data access, data transmission method for uplink, processor and system
CN115114311A (en) Transaction execution method and related device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant