CN111858074A - Resource access method, device and equipment - Google Patents

Resource access method, device and equipment Download PDF

Info

Publication number
CN111858074A
CN111858074A CN202010590818.9A CN202010590818A CN111858074A CN 111858074 A CN111858074 A CN 111858074A CN 202010590818 A CN202010590818 A CN 202010590818A CN 111858074 A CN111858074 A CN 111858074A
Authority
CN
China
Prior art keywords
resource
state variable
variable information
access request
value
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.)
Pending
Application number
CN202010590818.9A
Other languages
Chinese (zh)
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.)
Shenzhen Infineon Information Co ltd
Original Assignee
Shenzhen Infinova Intelligent Technology 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 Shenzhen Infinova Intelligent Technology Co Ltd filed Critical Shenzhen Infinova Intelligent Technology Co Ltd
Priority to CN202010590818.9A priority Critical patent/CN111858074A/en
Publication of CN111858074A publication Critical patent/CN111858074A/en
Pending legal-status Critical Current

Links

Images

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/524Deadlock detection or avoidance

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application is applicable to the technical field of computers, and provides a resource access method, which comprises the following steps: acquiring a resource access request, wherein the resource access request comprises an identifier of a target resource; acquiring the value of the state variable information of the target resource according to the identifier of the target resource; and if the value of the state variable information of the target resource meets a preset access condition, executing data operation corresponding to the resource access request on the target resource. According to the scheme, all locks used in the prior art are replaced by the state variable information, and the state variable information identifies the current state of the resource. And judging whether the resource can execute the operation corresponding to the resource access request currently according to the state variable information, and determining how to execute the operation corresponding to the resource access request. Therefore, the operation of each state variable information can be only related to the operation, different operation corresponding to different resource obtaining modes is guaranteed, the competition of a certain amount of resources is realized, and the deadlock is avoided.

Description

Resource access method, device and equipment
Technical Field
The present application belongs to the field of computer technologies, and in particular, to a method, an apparatus, and a device for resource access.
Background
In the case of multiple threads, multiple threads may appear to compete for a certain amount of resources. If a thread applies for a resource and the resource is unavailable at that time, the thread will enter a wait state. If the requested resource is occupied by another waiting thread, the waiting thread may be in a waiting state forever and cannot change the state, resulting in a deadlock.
The existing method for solving the multithreading deadlock mainly judges whether the deadlock occurs or not when the resources are allocated, and allocates the resources only under the condition that the deadlock does not occur, however, the method can influence the allocation of the resources, and the waste of the resources is easily caused. That is to say, the existing method for solving the multithreading deadlock can not avoid the multithreading deadlock under the condition of ensuring reasonable resource allocation.
Disclosure of Invention
The embodiment of the application provides a method, a device and equipment for resource access, which can solve the problem that the existing method for solving the multithreading deadlock can not avoid the multithreading deadlock under the condition of ensuring reasonable resource distribution.
In a first aspect, an embodiment of the present application provides a method for resource access, including:
acquiring a resource access request, wherein the resource access request comprises an identifier of a target resource;
Acquiring the value of the state variable information of the target resource according to the identifier of the target resource;
and if the value of the state variable information of the target resource meets a preset access condition, executing data operation corresponding to the resource access request on the target resource.
Further, if the value of the state variable information of the target resource satisfies a preset access condition, performing data operation corresponding to the resource access request on the target resource, including:
and if the state variable information is detected not to be assigned, assigning the state variable information according to the resource access request, and executing data operation corresponding to the resource access request on the target resource.
Further, if the value of the state variable information of the target resource satisfies a preset access condition, performing data operation corresponding to the resource access request on the target resource, including:
and if the value of the state variable information is detected to be a first numerical value, executing data operation corresponding to the resource access request on the target resource.
Further, if the value of the state variable information of the target resource satisfies a preset access condition, performing data operation corresponding to the resource access request on the target resource, including:
And if the value of the state variable information is detected to be a second value and the cycle number is less than or equal to a preset cycle threshold value, adding 1 to the cycle number, and after waiting for a preset time length, returning to execute the value for acquiring the state variable information of the target resource, and executing data operation corresponding to the resource access request on the target resource.
Further, still include:
and if the value of the state variable information is detected to be a second value and the cycle number is greater than a preset cycle threshold value, stopping executing the data operation corresponding to the resource access request.
Further, after executing the resource access request if the preset access condition is satisfied, the method further includes:
and when the execution of the data operation corresponding to the resource access request is completed, recovering the value of the state variable information of the target resource.
In a second aspect, an embodiment of the present application provides an apparatus for resource access, including:
a first obtaining unit, configured to obtain a resource access request, where the resource access request includes an identifier of a target resource;
a second obtaining unit, configured to obtain a value of state variable information of the target resource according to the identifier of the target resource;
And the processing unit is used for executing data operation corresponding to the resource access request on the target resource if the value of the state variable information of the target resource meets a preset access condition.
Further, the processing unit is specifically configured to:
and if the state variable information is detected not to be assigned, assigning the state variable information according to the resource access request, and executing data operation corresponding to the resource access request on the target resource.
Further, the processing unit is specifically configured to:
and if the value of the state variable information is detected to be a first numerical value, executing data operation corresponding to the resource access request on the target resource.
Further, the processing unit is specifically configured to:
and if the value of the state variable information is detected to be a second value and the cycle number is less than or equal to a preset cycle threshold value, adding 1 to the cycle number, and after waiting for a preset time length, returning to execute the value for acquiring the state variable information of the target resource, and executing data operation corresponding to the resource access request on the target resource.
Further, the processing unit is specifically further configured to:
And if the value of the state variable information is detected to be a second value and the cycle number is greater than a preset cycle threshold value, stopping executing the data operation corresponding to the resource access request.
Further, the apparatus for resource access further includes:
and the recovery unit is used for recovering the value of the state variable information of the target resource when the execution of the data operation corresponding to the resource access request is completed.
In a third aspect, an embodiment of the present application provides a device for resource access, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor, when executing the computer program, implements the method according to the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the method according to the first aspect.
In the embodiment of the application, a resource access request is obtained, wherein the resource access request comprises an identifier of a target resource; acquiring the value of the state variable information of the target resource according to the identifier of the target resource; and if the value of the state variable information of the target resource meets a preset access condition, executing data operation corresponding to the resource access request on the target resource. In the scheme, all locks used in the prior art are replaced by state variable information, and the state variable information identifies the current state of the resource. And judging whether the resource can execute the operation corresponding to the resource access request currently according to the state variable information, and determining how to execute the operation corresponding to the resource access request. Therefore, the operation of each state variable information can be only related to the operation, different operations are guaranteed to correspond to different resource obtaining modes, and due to different conditions, not only is the competition of a certain amount of resources realized, but also deadlock is avoided.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
FIG. 1 is a schematic flow chart diagram illustrating a method for requesting resource access according to a first embodiment of the present application;
fig. 2 is a schematic diagram of an apparatus for resource access according to a second embodiment of the present application. (ii) a
Fig. 3 is a schematic diagram of a device for resource access according to a third embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
Referring to fig. 1, fig. 1 is a schematic flow chart of a method for requesting resource access according to a first embodiment of the present application. The main execution body of the method for requesting resource access in this embodiment is a device having a resource access request, such as a personal computer, a server, and the like. The method for requesting resource access as shown in FIG. 1 may include:
s101: acquiring a resource access request, wherein the resource access request comprises an identifier of a target resource.
When the system is in a multi-threaded situation, multiple threads may compete for a certain amount of resources. If a thread applies for accessing a resource, but the resource is occupied and is in an unavailable state, the thread enters a waiting state. If the resource is occupied by another waiting thread, the waiting thread may be in a waiting state forever and cannot change the state, which is a deadlock.
Deadlock can cause a thread to fail to get the correct result because the thread in the deadlock cannot get the needed resources and cannot advance forward. Meanwhile, the thread in the deadlock state does not release occupied resources, so that the resources cannot be utilized by other threads, and the utilization rate of system resources is reduced. Other threads cannot advance because they do not request the resources that the deadlock thread has occupied, and deadlock can also result in new deadlocks.
In order to avoid the situation that deadlock may occur, the present embodiment provides a method for accessing resources, which can effectively avoid deadlock. The device obtains a resource access request, wherein the resource access request may be generated by a user operating a trigger on the device. The resource access request comprises an identification of a target resource for which the data operation is to be performed and an operation type for which the data operation is to be performed. The device determines that the resource access request includes the identifier of the target resource according to the resource access request. The operation type may include multiple operation types, for example, query the target resource, delete the target resource, modify the target resource, delete the target resource and add a new resource.
S102: and acquiring the value of the state variable information of the target resource according to the identifier of the target resource.
And the equipment acquires the value of the state variable information of the target resource according to the identifier of the target resource. In this embodiment, each resource is correspondingly provided with state variable information, and the device may determine the state variable information corresponding to the identifier according to the relationship between the identifier of the resource and the state variable information. The value of the state variable information may identify the current state of the resource, for example, when the value of the state variable information is 0, 1, 2, or 4, the state of the resource may be resource initialization, resource query, resource deletion, and new resource addition after resource deletion. Binary bits with values of 0, 1, 2, 4 of the state variable information are respectively expressed as: 0000, 0001, 0010, 0100.
S103: and if the value of the state variable information of the target resource meets a preset access condition, executing data operation corresponding to the resource access request on the target resource.
The device is preset with a preset access condition, wherein the preset access condition is used for judging whether the operation corresponding to the resource access request can be executed on the target resource currently according to the state variable information and determining how to execute the operation corresponding to the resource access request. And if the value of the state variable information of the target resource meets the preset access condition, executing data operation corresponding to the resource access request on the target resource. For example, if it is detected that the state variable information is not assigned, assigning the state variable information according to the resource access request, and executing data operation corresponding to the resource access request on the target resource; if it is detected that the value of the state variable information is the first value, performing a data operation corresponding to the resource access request on the target resource, and the like.
Further, S103 may include: and if the state variable information is detected not to be assigned, assigning the state variable information according to the resource access request, and executing data operation corresponding to the resource access request on the target resource.
In this embodiment, the device acquires the state variable information, and if the state variable information is not acquired, it is detected that the state variable information is not assigned, and it can be understood that when the state variable information is not assigned, it indicates that the state of the current target resource is idle or the target resource has not been accessed before. If the state variable information is detected to be unassigned, the device can assign the state variable information according to the resource access request, and assign the value of the state variable information to the value of the data operation corresponding to the resource access request. For example, when the data operation corresponding to the resource access request is a query target resource, it is detected that the state variable information is not assigned, and the value of the state variable information corresponding to the query resource is 1, the value of the state variable information of the target resource is assigned to 1. And after the assignment of the state variable information of the target resource is completed, executing data operation corresponding to the resource access request on the target resource.
Further, S103 may include: and if the value of the state variable information is detected to be a first numerical value, executing data operation corresponding to the resource access request on the target resource.
In this embodiment, the device acquires the state variable information, and if the value of the state variable information is acquired, it is detected that the state variable information is assigned. And the equipment continues to judge the value of the state variable information, and if the value of the state variable information is detected to be a first numerical value, the data operation corresponding to the resource access request is executed on the target resource. The first value identifies that the target resource is in a reentrant state currently without waiting, and the reentrant state is that the current data operation executed on the target resource and the data operation corresponding to the resource access request do not conflict and can be performed simultaneously.
And when the equipment detects that the value of the state variable information is the first numerical value, executing data operation corresponding to the resource access request on the target resource. The device may preset a first numerical value, where the first numerical value may include a plurality of numerical values, and if the device detects that the value of the state variable information is the first numerical value, the device executes a data operation corresponding to the resource access request on the target resource. For example, the target resource is in a checking state, and if the target resource is in the checking state and has no influence on the data operation corresponding to the current resource access request, and the target resource and the data operation do not conflict with each other, it may be determined that the current target resource is in a reentrant state, and the data operation corresponding to the resource access request is executed on the target resource.
Further, S103 may include: and if the value of the state variable information is detected to be a second value and the cycle number is less than or equal to a preset cycle threshold value, adding 1 to the cycle number, and after waiting for a preset time length, returning to execute the value for acquiring the state variable information of the target resource, and executing data operation corresponding to the resource access request on the target resource.
In this embodiment, the device acquires the state variable information, and if the value of the state variable information is acquired, it is detected that the state variable information is assigned. And the equipment continues to judge the value of the state variable information, detects that the value of the state variable information is a second numerical value, identifies that the target resource is in a waiting state at present, and the waiting state is that the current data operation executed on the target resource and the data operation corresponding to the resource access request conflict and cannot be carried out simultaneously.
And if the equipment detects that the value of the state variable information is the second value, entering a circulating state, and detecting the value of the state variable information once every preset time length. And setting a preset cycle threshold value in the equipment, and if the cycle times are greater than the preset cycle threshold value, exiting the current process and not continuing to wait. And if the equipment judges that the cycle number is less than or equal to the preset cycle threshold, continuing to cycle, adding 1 to the cycle number, and after waiting for a preset time length, returning to execute the value for acquiring the state variable information of the target resource, and executing the data operation corresponding to the resource access request on the target resource.
If the value of the state variable information is detected to be a second value and the cycle number is greater than a preset cycle threshold value, stopping executing the data operation corresponding to the resource access request. And setting a preset cycle threshold value in the equipment, if the cycle times are greater than the preset cycle threshold value, in order to prevent deadlock, exiting the current flow, not continuing to wait, and stopping executing data operation corresponding to the resource access request.
Further, after S103, may include: and when the execution of the data operation corresponding to the resource access request is completed, recovering the value of the state variable information of the target resource.
When the device detects that the data operation corresponding to the resource access request is completed, the device recovers the value of the state variable information of the target resource, namely releases the 'lock' of the target resource.
In the embodiment of the application, a resource access request is obtained, wherein the resource access request comprises an identifier of a target resource; acquiring the value of the state variable information of the target resource according to the identifier of the target resource; and if the value of the state variable information of the target resource meets a preset access condition, executing data operation corresponding to the resource access request on the target resource. In the scheme, all locks used in the prior art are replaced by state variable information, and the state variable information identifies the current state of the resource. And judging whether the resource can execute the operation corresponding to the resource access request currently according to the state variable information, and determining how to execute the operation corresponding to the resource access request. Therefore, the operation of each state variable information can be only related to the operation, different operations are guaranteed to correspond to different resource obtaining modes, and due to different conditions, not only is the competition of a certain amount of resources realized, but also deadlock is avoided.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Referring to fig. 2, fig. 2 is a schematic diagram of an apparatus for resource access according to a second embodiment of the present application. The included units are used for executing the steps in the embodiment corresponding to fig. 1, and refer to the related description in the embodiment corresponding to fig. 1. For convenience of explanation, only the portions related to the present embodiment are shown. Referring to fig. 2, the apparatus 2 for resource access includes:
a first obtaining unit 210, configured to obtain a resource access request, where the resource access request includes an identifier of a target resource;
a second obtaining unit 220, configured to obtain a value of state variable information of the target resource according to the identifier of the target resource;
the processing unit 230 is configured to, if the value of the state variable information of the target resource meets a preset access condition, perform a data operation corresponding to the resource access request on the target resource.
Further, the processing unit 230 is specifically configured to:
and if the state variable information is detected not to be assigned, assigning the state variable information according to the resource access request, and executing data operation corresponding to the resource access request on the target resource.
Further, the processing unit 230 is specifically configured to:
and if the value of the state variable information is detected to be a first numerical value, executing data operation corresponding to the resource access request on the target resource.
Further, the processing unit 230 is specifically configured to:
and if the value of the state variable information is detected to be a second value and the cycle number is less than or equal to a preset cycle threshold value, adding 1 to the cycle number, and after waiting for a preset time length, returning to execute the value for acquiring the state variable information of the target resource, and executing data operation corresponding to the resource access request on the target resource.
Further, the processing unit 230 is specifically further configured to:
and if the value of the state variable information is detected to be a second value and the cycle number is greater than a preset cycle threshold value, stopping executing the data operation corresponding to the resource access request.
Further, the apparatus 2 for resource access further includes:
and the recovery unit is used for recovering the value of the state variable information of the target resource when the execution of the data operation corresponding to the resource access request is completed.
Fig. 3 is a schematic diagram of a device for resource access according to a third embodiment of the present application. As shown in fig. 3, the device 3 for resource access of this embodiment includes: a processor 30, a memory 31 and a computer program 32, such as a program for resource access, stored in said memory 31 and executable on said processor 30. The processor 30, when executing the computer program 32, implements the steps in the various resource access method embodiments described above, such as the steps 101 to 103 shown in fig. 1. Alternatively, the processor 30, when executing the computer program 32, implements the functions of the modules/units in the above-mentioned device embodiments, such as the functions of the modules 210 to 230 shown in fig. 2.
Illustratively, the computer program 32 may be partitioned into one or more modules/units that are stored in the memory 31 and executed by the processor 30 to accomplish the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 32 in the device 3 for resource access. For example, the computer program 32 may be divided into a first acquisition unit, a second acquisition unit, and a processing unit, and each unit specifically functions as follows:
a first obtaining unit, configured to obtain a resource access request, where the resource access request includes an identifier of a target resource;
a second obtaining unit, configured to obtain a value of state variable information of the target resource according to the identifier of the target resource;
and the processing unit is used for executing data operation corresponding to the resource access request on the target resource if the value of the state variable information of the target resource meets a preset access condition.
The device for resource access may include, but is not limited to, a processor 30 and a memory 31. It will be appreciated by those skilled in the art that fig. 3 is merely an example of a resource accessing device 3 and does not constitute a limitation of the resource accessing device 3 and may comprise more or less components than shown or some components in combination or different components, e.g. the resource accessing device may also comprise an input output device, a network access device, a bus, etc.
The Processor 30 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 31 may be an internal storage unit of the resource accessing device 3, such as a hard disk or a memory of the resource accessing device 3. The memory 31 may also be an external storage device of the resource accessing device 3, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are equipped on the resource accessing device 3. Further, the memory 31 may also include both an internal storage unit of the device 3 for resource access and an external storage device. The memory 31 is used for storing the computer programs and other programs and data required by the device for the resource access. The memory 31 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. . Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A method of resource access, comprising:
acquiring a resource access request, wherein the resource access request comprises an identifier of a target resource;
acquiring the value of the state variable information of the target resource according to the identifier of the target resource;
and if the value of the state variable information of the target resource meets a preset access condition, executing data operation corresponding to the resource access request on the target resource.
2. The method according to claim 1, wherein if the value of the state variable information of the target resource satisfies a preset access condition, performing a data operation corresponding to the resource access request on the target resource includes:
And if the state variable information is detected not to be assigned, assigning the state variable information according to the resource access request, and executing data operation corresponding to the resource access request on the target resource.
3. The method according to claim 1, wherein if the value of the state variable information of the target resource satisfies a preset access condition, performing a data operation corresponding to the resource access request on the target resource includes:
and if the value of the state variable information is detected to be a first numerical value, executing data operation corresponding to the resource access request on the target resource.
4. The method according to claim 1, wherein if the value of the state variable information of the target resource satisfies a preset access condition, performing a data operation corresponding to the resource access request on the target resource includes:
and if the value of the state variable information is detected to be a second value and the cycle number is less than or equal to a preset cycle threshold value, adding 1 to the cycle number, and after waiting for a preset time length, returning to execute the value for acquiring the state variable information of the target resource, and executing data operation corresponding to the resource access request on the target resource.
5. The method of resource access of claim 4, further comprising:
and if the value of the state variable information is detected to be a second value and the cycle number is greater than a preset cycle threshold value, stopping executing the data operation corresponding to the resource access request.
6. The method for resource access according to any one of claims 1-5, wherein after executing the resource access request if a preset access condition is satisfied, further comprising:
and when the execution of the data operation corresponding to the resource access request is completed, recovering the value of the state variable information of the target resource.
7. An apparatus for resource access, comprising:
a first obtaining unit, configured to obtain a resource access request, where the resource access request includes an identifier of a target resource;
a second obtaining unit, configured to obtain a value of state variable information of the target resource according to the identifier of the target resource;
and the processing unit is used for executing data operation corresponding to the resource access request on the target resource if the value of the state variable information of the target resource meets a preset access condition.
8. The device for resource access according to claim 7, wherein the processing unit is specifically configured to:
And if the state variable information is detected not to be assigned, assigning the state variable information according to the resource access request, and executing data operation corresponding to the resource access request on the target resource.
9. An apparatus for resource access, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 6.
CN202010590818.9A 2020-06-24 2020-06-24 Resource access method, device and equipment Pending CN111858074A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010590818.9A CN111858074A (en) 2020-06-24 2020-06-24 Resource access method, device and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010590818.9A CN111858074A (en) 2020-06-24 2020-06-24 Resource access method, device and equipment

Publications (1)

Publication Number Publication Date
CN111858074A true CN111858074A (en) 2020-10-30

Family

ID=72988214

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010590818.9A Pending CN111858074A (en) 2020-06-24 2020-06-24 Resource access method, device and equipment

Country Status (1)

Country Link
CN (1) CN111858074A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6549961B1 (en) * 1999-10-27 2003-04-15 Infineon Technologies North America Corporation Semaphore access in a multiprocessor system
US20040243751A1 (en) * 2001-09-28 2004-12-02 Giovanni Rabaioli Method for resource access co-ordination in a data processing system, data processing system and computer program
US20080307139A1 (en) * 2007-06-05 2008-12-11 Thomas Charles D Resource access manager for controlling access to a limited-access resource
CN105760216A (en) * 2016-02-29 2016-07-13 惠州市德赛西威汽车电子股份有限公司 Multi-process synchronization control method
CN106980544A (en) * 2017-03-31 2017-07-25 北京奇艺世纪科技有限公司 A kind of thread synchronization method and thread synchronization system
CN108132848A (en) * 2017-12-25 2018-06-08 传神语联网网络科技股份有限公司 The method, apparatus and computer readable storage medium of data communication

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6549961B1 (en) * 1999-10-27 2003-04-15 Infineon Technologies North America Corporation Semaphore access in a multiprocessor system
US20040243751A1 (en) * 2001-09-28 2004-12-02 Giovanni Rabaioli Method for resource access co-ordination in a data processing system, data processing system and computer program
US20080307139A1 (en) * 2007-06-05 2008-12-11 Thomas Charles D Resource access manager for controlling access to a limited-access resource
CN105760216A (en) * 2016-02-29 2016-07-13 惠州市德赛西威汽车电子股份有限公司 Multi-process synchronization control method
CN106980544A (en) * 2017-03-31 2017-07-25 北京奇艺世纪科技有限公司 A kind of thread synchronization method and thread synchronization system
CN108132848A (en) * 2017-12-25 2018-06-08 传神语联网网络科技股份有限公司 The method, apparatus and computer readable storage medium of data communication

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吉林乌拉: "自旋锁", pages 1, Retrieved from the Internet <URL:https://cloud.tencent.com/developer/article/1487113> *

Similar Documents

Publication Publication Date Title
CN111597040B (en) Resource allocation method, device, storage medium and electronic equipment
US20060090168A1 (en) Method and system for speeding up mutual exclusion
CN110188110B (en) Method and device for constructing distributed lock
CN108572876B (en) Method and device for realizing read-write lock
CN113407414A (en) Program operation monitoring method, device, terminal and storage medium
CN112214313A (en) Memory allocation method and related equipment
CN107357640B (en) Request processing method and device for multi-thread database and electronic equipment
CN111813710A (en) Method and device for avoiding Linux kernel memory fragmentation and computer storage medium
CN111752715A (en) System optimization method, device, equipment and storage medium under large quantity of requests
CN111858074A (en) Resource access method, device and equipment
EP1020801A2 (en) Dynamic slot allocation and tracking of multiple memory requests
CN113961364A (en) Large-scale lock system implementation method and device, storage medium and server
US20130014123A1 (en) Determination of running status of logical processor
CN111090520B (en) User allocation method and device for exclusive resources, electronic equipment and storage medium
CN116450328A (en) Memory allocation method, memory allocation device, computer equipment and storage medium
CN114490010A (en) Resource operation control method, electronic device, chip and readable storage medium
CN114391138A (en) Flow control for multithreaded access to contended resource(s)
CN114077493A (en) Resource allocation method and related equipment
CN113568733A (en) Resource allocation method, device, electronic equipment and storage medium
CN104267929A (en) Computing system and method of operating lock in same
CN117472593B (en) Method and system for distributing resources among multiple threads
CN111352710A (en) Process management method and device, computing equipment and storage medium
CN111679909B (en) Data processing method and device and terminal equipment
CN117112246B (en) Control device of spin lock
CN111625358B (en) Resource allocation method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20230105

Address after: 518000 Yingfei Haocheng Science Park, Guansheng 5th Road, Luhu Community, Guanhu Street, Longhua District, Shenzhen, Guangdong 1515

Applicant after: Shenzhen Infineon Information Co.,Ltd.

Address before: 518000 Room 301, Infineon Technology Co., Ltd., No. 12, Guanbao Road, Luhu community, Guanhu street, Longhua District, Shenzhen City, Guangdong Province

Applicant before: SHENZHEN INFINOVA INTELLIGENT TECHNOLOGY Co.,Ltd.

TA01 Transfer of patent application right