CN113742061A - Resource management method, system, storage medium and equipment - Google Patents

Resource management method, system, storage medium and equipment Download PDF

Info

Publication number
CN113742061A
CN113742061A CN202110875936.9A CN202110875936A CN113742061A CN 113742061 A CN113742061 A CN 113742061A CN 202110875936 A CN202110875936 A CN 202110875936A CN 113742061 A CN113742061 A CN 113742061A
Authority
CN
China
Prior art keywords
resource
linked list
objects
numbered
preset
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.)
Granted
Application number
CN202110875936.9A
Other languages
Chinese (zh)
Other versions
CN113742061B (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202110875936.9A priority Critical patent/CN113742061B/en
Publication of CN113742061A publication Critical patent/CN113742061A/en
Application granted granted Critical
Publication of CN113742061B publication Critical patent/CN113742061B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • 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/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02WCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO WASTEWATER TREATMENT OR WASTE MANAGEMENT
    • Y02W90/00Enabling technologies or technologies with a potential or indirect contribution to greenhouse gas [GHG] emissions mitigation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a resource management method, a system, a storage medium and a device, wherein the method comprises the following steps: dividing the resource objects under the preset scene into a first numbered resource object and a second numbered resource object according to a preset numbering rule, and putting all the first numbered resource object and the second numbered resource object into a global pool; establishing a local pool for storing resource objects to be used for each preset thread, and establishing an available resource linked list, a first numbered resource linked list corresponding to the first numbered resource object and a second numbered resource linked list corresponding to the second numbered resource object in the local pool; responding to the allocation of the resource objects for the preset thread, and sequentially judging whether the available resource linked list and the first numbered resource linked list have the resource objects which meet the use of the preset thread; and responding to the situation that the resource objects which are not used by the preset thread are not met, acquiring the resource objects from the global pool, putting the resource objects into an available resource chain table, acquiring the resource objects from the available resource chain table, and distributing the resource objects to the preset thread. The invention improves the resource allocation and recovery efficiency.

Description

Resource management method, system, storage medium and equipment
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a resource management method, system, storage medium, and device.
Background
High concurrency generally refers to ensuring that a system is able to process many requests in parallel at the same time by design. Colloquially, high concurrency means that many users access the same API interface or URL address at the same time, which often occurs in a service scenario with a large number of active users and a high user aggregation. In a high concurrency scenario of practical application, application and release of a certain type of resource object may be very frequent, and in order to achieve state synchronization of resource allocation and recovery, it is currently common practice to implement the state synchronization in a locking manner. However, when the amount of concurrent requests reaches a critical point, there is a problem of a steep performance drop, which is a bottleneck for a scenario with strict time-distribution requirements.
Disclosure of Invention
In view of the above, an object of the present invention is to provide a resource management method, system, storage medium and device, so as to solve the problem in the prior art that resource allocation and recovery are complicated in a high-concurrency scenario.
Based on the above purpose, the present invention provides a resource management method, which comprises the following steps:
dividing the resource objects under the preset scene into a first numbered resource object and a second numbered resource object according to a preset numbering rule, and putting all the first numbered resource object and the second numbered resource object into a global pool;
establishing a local pool for storing resource objects to be used for each preset thread, and establishing an available resource linked list, a first numbered resource linked list corresponding to the first numbered resource object and a second numbered resource linked list corresponding to the second numbered resource object in the local pool;
responding to the allocation of the resource objects for the preset thread, and sequentially judging whether the available resource linked list and the first numbered resource linked list have the resource objects which meet the use of the preset thread;
and in response to that the available resource linked list and the first numbered resource linked list do not meet the resource object used by the preset thread, acquiring the resource object from the global pool and putting the resource object into the available resource linked list so as to acquire the resource object meeting the use of the preset thread from the available resource linked list and allocate the resource object to the preset thread.
In some embodiments, sequentially determining whether the resource objects meeting the usage of the preset thread exist in the available resource linked list and the first numbered resource linked list includes:
judging whether a resource object meeting the use of a preset thread exists in an available resource linked list or not;
responding to the situation that the resource objects which are used by the preset thread are not met in the available resource linked list, and judging whether the resource objects which are used by the preset thread are met in the first numbered resource linked list or not;
and in response to the first numbered resource linked list having the resource objects meeting the use requirements of the preset threads, acquiring the resource objects from the first numbered resource linked list and putting the resource objects into the available resource linked list so as to acquire the resource objects meeting the use requirements of the preset threads from the available resource linked list and allocate the resource objects to the preset threads.
In some embodiments, the method further comprises:
responding to the fact that a preset thread releases resource objects and the released resource objects are first numbered resource objects, and judging whether the quantity of the resource objects in the available resource linked list exceeds a first preset threshold value or not;
in response to the fact that the number of the resource objects in the available resource linked list does not exceed a first preset threshold value, the released resource objects are placed into the available resource linked list;
and in response to the number of the resource objects in the available resource linked list exceeding a first preset threshold, transferring all the resource objects in the first numbered resource linked list to the global pool, and transferring all the resource objects in the available resource linked list to the first numbered resource linked list.
In some embodiments, the method further comprises:
responding to the situation that a preset thread releases resource objects and the released resource objects are second numbered resource objects, and judging whether the quantity of the resource objects in the second numbered resource chain table exceeds a second preset threshold value or not;
in response to the fact that the number of the resource objects in the second serial number resource linked list does not exceed a second preset threshold value, the released resource objects are placed into the second serial number resource linked list;
and responding to the number of the resource objects in the second serial number resource linked list exceeding a second preset threshold value, and transferring all the resource objects in the second serial number resource linked list to the global pool.
In some embodiments, obtaining resource objects from the global pool and placing into the available resource linked list comprises:
a lock is requested from the global pool, and a resource object is obtained based on the lock and placed into an available resource linked list.
In some embodiments, the method further comprises:
and responding to the allocation of the resource objects for the other threads except the preset thread, requesting a lock from the global pool, acquiring the resource objects from the global pool based on the lock, and allocating the resource objects to the other threads.
In some embodiments, the method further comprises:
and responding to the thread release resource objects in the rest threads, and recycling the released resource objects into the global pool.
In another aspect of the present invention, a resource management system is further provided, including:
the system comprises a number dividing module, a global pool and a resource object management module, wherein the number dividing module is configured and used for dividing resource objects under a preset scene into a first number resource object and a second number resource object according to a preset number rule and putting all the first number resource object and the second number resource object into the global pool;
the linked list creating module is configured to create a local pool for storing the resource objects to be used for each preset thread, and create an available resource linked list, a first numbered resource linked list corresponding to the first numbered resource object and a second numbered resource linked list corresponding to the second numbered resource object in the local pool;
the judging module is configured to respond to the allocation of the resource objects for the preset thread and sequentially judge whether the available resource chain table and the first numbered resource chain table have the resource objects meeting the use of the preset thread; and
and the resource allocation module is configured to, in response to that neither the available resource linked list nor the first numbered resource linked list satisfies the resource object used by the preset thread, acquire the resource object from the global pool and place the resource object into the available resource linked list so that the resource object satisfying the use of the preset thread is acquired from the available resource linked list and allocated to the preset thread.
In yet another aspect of the present invention, there is also provided a computer readable storage medium storing computer program instructions which, when executed, implement any one of the methods described above.
In yet another aspect of the present invention, a computer device is provided, which includes a memory and a processor, the memory storing a computer program, the computer program executing any one of the above methods when executed by the processor.
The invention has at least the following beneficial technical effects:
the global pool is used as an application point of the resource object, a certain amount of resources are dynamically allocated to threads which frequently apply for the resource object or have strict requirements on delay and are used as the local pool of the threads, so that the local pool is preferentially selected when the threads apply for and release the resource object, the global pool is applied if the resource object of the local pool is not used enough, and the local pool where the threads are located does not need to be locked when applying for the resource, so that the application and the release on the local pool do not need to be locked; and then through a buffer chain table and a recovery mechanism of the local pool, the competition caused by resource concurrent application is effectively reduced, the cost of equal lock is greatly reduced, the resource allocation and recovery efficiency is improved, the problem that the performance is suddenly reduced when the concurrent request amount reaches a critical point is solved, and the method is also suitable for scenes with strict requirements on the resource allocation time.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by using the drawings without creative efforts.
Fig. 1 is a schematic diagram of a resource management method according to an embodiment of the present invention;
FIG. 2 is a diagram of a resource management system according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a computer-readable storage medium for implementing a resource management method according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a hardware structure of a computer device for executing a resource management method according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two non-identical entities with the same name or different parameters, and it is understood that "first" and "second" are only used for convenience of expression and should not be construed as limiting the embodiments of the present invention. Furthermore, the terms "comprises" and "comprising," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements does not include all of the other steps or elements inherent in the list.
In view of the above object, a first aspect of the embodiments of the present invention provides an embodiment of a resource management method. Fig. 1 is a schematic diagram illustrating an embodiment of a resource management method provided by the present invention. As shown in fig. 1, the embodiment of the present invention includes the following steps:
step S10, dividing the resource objects under the preset scene into a first numbered resource object and a second numbered resource object according to a preset numbering rule and putting all the first numbered resource object and the second numbered resource object into a global pool;
step S20, establishing a local pool for storing the resource objects to be used for each preset thread, and establishing an available resource linked list, a first numbered resource linked list corresponding to the first numbered resource object and a second numbered resource linked list corresponding to the second numbered resource object in the local pool;
step S30, responding to the allocation of the resource objects for the preset thread, and sequentially judging whether the available resource chain table and the first serial number resource chain table have the resource objects meeting the use of the preset thread;
and step S40, in response to that neither the available resource linked list nor the first numbered resource linked list meets the resource object used by the preset thread, acquiring the resource object from the global pool and putting the resource object into the available resource linked list so as to acquire the resource object meeting the use of the preset thread from the available resource linked list and allocate the resource object to the preset thread.
The preset scenario in the embodiment of the present invention includes, but is not limited to, a high concurrency scenario, that is, a service scenario in which a large number of active users and users are highly aggregated at the same time, and resources are frequently applied and released in the scenario. The preset thread mainly refers to a thread which frequently applies for resources or has strict requirements on time delay.
In this embodiment, the resource objects may be respectively numbered, for example, by integers 1, 2, and 3 … … n, and then the even-numbered object may be the first-numbered object and the odd-numbered object may be the second-numbered object.
In this embodiment, in the initialization stage, the available resource linked list, the first numbered resource linked list, and the second numbered resource linked list are empty, so that there is no resource object in the available resource linked list and the first numbered resource linked list at the beginning, and then the resource object is obtained from the global pool and given to the available resource linked list.
The embodiment of the invention takes the global pool as the application point of the resource object, dynamically allocates a certain amount of resources for the threads which frequently apply for the resource object or have strict requirements on time delay, and uses the resources as the local pool of the threads, so that the local pool of the local pool is preferentially selected when applying for and releasing the resource object; and then through a buffer chain table and a recovery mechanism of the local pool, the competition caused by resource concurrent application is effectively reduced, the cost of equal lock is greatly reduced, the resource allocation and recovery efficiency is improved, the problem that the performance is suddenly reduced when the concurrent request amount reaches a critical point is solved, and the method is also suitable for scenes with strict requirements on the resource allocation time.
In some embodiments, obtaining resource objects from the global pool and placing into the available resource linked list comprises: a lock is requested from the global pool, and a resource object is obtained based on the lock and placed into an available resource linked list.
In some embodiments, sequentially determining whether the resource objects meeting the usage of the preset thread exist in the available resource linked list and the first numbered resource linked list includes: judging whether a resource object meeting the use of a preset thread exists in an available resource linked list or not; responding to the situation that the resource objects which are used by the preset thread are not met in the available resource linked list, and judging whether the resource objects which are used by the preset thread are met in the first numbered resource linked list or not; and in response to the first numbered resource linked list having the resource objects meeting the use requirements of the preset threads, acquiring the resource objects from the first numbered resource linked list and putting the resource objects into the available resource linked list so as to acquire the resource objects meeting the use requirements of the preset threads from the available resource linked list and allocate the resource objects to the preset threads.
In another embodiment, if the available resource linked list has resource objects meeting the use requirement of the preset thread, the resource objects are directly obtained from the available resource linked list.
In some embodiments, the method further comprises: responding to the fact that a preset thread releases resource objects and the released resource objects are first numbered resource objects, and judging whether the quantity of the resource objects in the available resource linked list exceeds a first preset threshold value or not; in response to the fact that the number of the resource objects in the available resource linked list does not exceed a first preset threshold value, the released resource objects are placed into the available resource linked list; and in response to the number of the resource objects in the available resource linked list exceeding a first preset threshold, transferring all the resource objects in the first numbered resource linked list to the global pool, and transferring all the resource objects in the available resource linked list to the first numbered resource linked list.
In the above embodiment, the first numbered resource list plays a role of buffering in resource allocation and reclamation. Because the lock is required when the resource object is applied for allocation in the global pool and the lock is not required when the resource object is applied for allocation in the local pool, the resource object is placed in the local pool as much as possible, and the first numbered resource list can play a buffering role in resource allocation. When the resource object is released, the resource object is left in the first numbered resource chain table, and can be used for the subsequent resource object allocation.
In some embodiments, the method further comprises: responding to the situation that a preset thread releases resource objects and the released resource objects are second numbered resource objects, and judging whether the quantity of the resource objects in the second numbered resource chain table exceeds a second preset threshold value or not; in response to the fact that the number of the resource objects in the second serial number resource linked list does not exceed a second preset threshold value, the released resource objects are placed into the second serial number resource linked list; and responding to the number of the resource objects in the second serial number resource linked list exceeding a second preset threshold value, and transferring all the resource objects in the second serial number resource linked list to the global pool.
In this embodiment, the second numbered resource chain table mainly plays a role in buffering in resource recovery. By transferring the resource objects in the second numbered resource linked list to the global pool, the resource objects in the global pool can be prevented from being insufficient in number.
In some embodiments, the method further comprises: and responding to the allocation of the resource objects for the other threads except the preset thread, requesting a lock from the global pool, acquiring the resource objects from the global pool based on the lock, and allocating the resource objects to the other threads.
In some embodiments, the method further comprises: and responding to the thread release resource objects in the rest threads, and recycling the released resource objects into the global pool.
In the above embodiment, the other threads except the preset thread all apply for allocating the resource object in the global pool or release the resource object to the global pool.
In a second aspect of the embodiments of the present invention, a resource management system is further provided. Fig. 2 is a schematic diagram illustrating an embodiment of a resource management system provided in the present invention. As shown in fig. 2, a resource management system includes: the number dividing module 10 is configured to divide the resource objects in the preset scene into a first number resource object and a second number resource object according to a preset number rule and place all the first number resource object and the second number resource object into the global pool; a linked list creating module 20 configured to create, for each preset thread, a local pool for storing the resource object to be used, and create an available resource linked list, a first numbered resource linked list corresponding to the first numbered resource object, and a second numbered resource linked list corresponding to the second numbered resource object in the local pool; the judging module 30 is configured to respond to allocation of resource objects to the preset thread, and sequentially judge whether there is a resource object which meets the use requirement of the preset thread in the available resource linked list and the first numbered resource linked list; and the resource allocation module 40 is configured to, in response to that neither the available resource linked list nor the first numbered resource linked list satisfies the resource object used by the preset thread, acquire the resource object from the global pool and place the resource object into the available resource linked list so that the resource object satisfying the use of the preset thread is acquired from the available resource linked list and allocated to the preset thread.
In some embodiments, the determining module 30 includes a resource object determining module configured to determine whether there is a resource object satisfying the usage of the preset thread in the available resource linked list; responding to the situation that the resource objects which are used by the preset thread are not met in the available resource linked list, and judging whether the resource objects which are used by the preset thread are met in the first numbered resource linked list or not; and in response to the first numbered resource linked list having the resource objects meeting the use requirements of the preset threads, acquiring the resource objects from the first numbered resource linked list and putting the resource objects into the available resource linked list so as to acquire the resource objects meeting the use requirements of the preset threads from the available resource linked list and allocate the resource objects to the preset threads.
In some embodiments, the system further includes a first recovery module configured to determine whether the number of resource objects in the available resource linked list exceeds a first preset threshold in response to a preset thread releasing the resource objects and the released resource objects being first numbered resource objects; in response to the fact that the number of the resource objects in the available resource linked list does not exceed a first preset threshold value, the released resource objects are placed into the available resource linked list; and in response to the number of the resource objects in the available resource linked list exceeding a first preset threshold, transferring all the resource objects in the first numbered resource linked list to the global pool, and transferring all the resource objects in the available resource linked list to the first numbered resource linked list.
In some embodiments, the system further includes a second recycling module configured to determine whether the number of resource objects in the second numbered resource chain table exceeds a second preset threshold in response to a preset thread releasing the resource objects and the released resource objects being second numbered resource objects; in response to the fact that the number of the resource objects in the second serial number resource linked list does not exceed a second preset threshold value, the released resource objects are placed into the second serial number resource linked list; and responding to the number of the resource objects in the second serial number resource linked list exceeding a second preset threshold value, and transferring all the resource objects in the second serial number resource linked list to the global pool.
In some embodiments, resource allocation module 40 includes a request lock module configured to request a lock from the global pool, and based on the lock, obtain a resource object and place it into a linked list of available resources.
In some embodiments, the system further includes a global pool allocation module configured to, in response to allocating resource objects for the remaining threads other than the preset thread, request a lock from the global pool, and obtain the resource objects from the global pool based on the lock and allocate the resource objects to the remaining threads.
In some embodiments, the system further includes a global pool reclamation module configured to reclaim freed resource objects to the global pool in response to a thread releasing the resource objects in the remaining threads.
The resource management system of the embodiment of the invention takes the global pool as the application point of the resource object, dynamically allocates a certain amount of resources for the threads which frequently apply for the resource object or have strict requirements on time delay, and uses the resources as the local pool of the threads, so that the local pool of the local management system is preferentially selected when applying for and releasing the resource object; and then through a buffer chain table and a recovery mechanism of the local pool, the competition caused by resource concurrent application is effectively reduced, the cost of equal lock is greatly reduced, the resource allocation and recovery efficiency is improved, the problem that the performance is suddenly reduced when the concurrent request amount reaches a critical point is solved, and the method is also suitable for scenes with strict requirements on the resource allocation time.
In a third aspect of the embodiment of the present invention, a computer-readable storage medium is further provided, and fig. 3 is a schematic diagram illustrating a computer-readable storage medium implementing a resource management method according to an embodiment of the present invention. As shown in fig. 3, the computer-readable storage medium 3 stores computer program instructions 31, the computer program instructions 31 being executable by a processor. The computer program instructions 31 when executed implement the method of any of the embodiments described above.
It is to be understood that all embodiments, features and advantages set forth above with respect to the resource management method according to the present invention apply equally, without conflict with one another, to the resource management system and the storage medium according to the present invention.
In a fourth aspect of the embodiments of the present invention, there is further provided a computer device, including a memory 402 and a processor 401, where the memory stores a computer program, and the computer program, when executed by the processor, implements the method of any one of the above embodiments.
Fig. 4 is a schematic hardware structure diagram of an embodiment of a computer device for executing the resource management method according to the present invention. Taking the computer device shown in fig. 4 as an example, the computer device includes a processor 401 and a memory 402, and may further include: an input device 403 and an output device 404. The processor 401, the memory 402, the input device 403 and the output device 404 may be connected by a bus or other means, and fig. 4 illustrates an example of a connection by a bus. The input device 403 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the asset management system. The output device 404 may include a display device such as a display screen.
The memory 402, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the resource management method in the embodiments of the present application. The memory 402 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created by use of the resource management method, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, memory 402 may optionally include memory located remotely from processor 401, which may be connected to local modules via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The processor 401 executes various functional applications of the server and data processing by running nonvolatile software programs, instructions, and modules stored in the memory 402, that is, implements the resource management method of the above-described method embodiment.
Finally, it should be noted that the computer-readable storage medium (e.g., memory) herein can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. By way of example, and not limitation, nonvolatile memory can include Read Only Memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM), which can act as external cache memory. By way of example and not limitation, RAM is available in a variety of forms such as synchronous RAM (DRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The storage devices of the disclosed aspects are intended to comprise, without being limited to, these and other suitable types of memory.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as software or hardware depends upon the particular application and design constraints imposed on the overall system. 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 disclosed embodiments of the present invention.
The various illustrative logical blocks, modules, and circuits described in connection with the disclosure herein may be implemented or performed with the following components designed to perform the functions herein: a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or any combination of these components. A general purpose processor may be a microprocessor, but in the alternative, the processor may be any conventional processor, controller, microcontroller, or state machine. A processor may also be implemented as a combination of computing devices, e.g., a combination of a DSP and a microprocessor, a plurality of microprocessors, one or more microprocessors in conjunction with a DSP, and/or any other such configuration.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the present disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the disclosed embodiments of the invention may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items. The numbers of the embodiments disclosed in the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, of embodiments of the invention is limited to these examples; within the idea of an embodiment of the invention, also technical features in the above embodiment or in different embodiments may be combined and there are many other variations of the different aspects of the embodiments of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present invention are intended to be included within the scope of the embodiments of the present invention.

Claims (10)

1. A method for resource management, comprising the steps of:
dividing the resource objects under the preset scene into a first numbered resource object and a second numbered resource object according to a preset numbering rule, and putting all the first numbered resource object and the second numbered resource object into a global pool;
establishing a local pool for storing resource objects to be used for each preset thread, and establishing an available resource linked list, a first numbered resource linked list corresponding to a first numbered resource object and a second numbered resource linked list corresponding to a second numbered resource object in the local pool;
responding to the allocation of resource objects for a preset thread, and sequentially judging whether the available resource chain table and the first numbered resource chain table have resource objects meeting the use of the preset thread;
and in response to that neither the available resource linked list nor the first numbered resource linked list meets the resource object used by the preset thread, acquiring the resource object from the global pool and putting the resource object into the available resource linked list so as to acquire the resource object meeting the use of the preset thread from the available resource linked list and allocate the resource object to the preset thread.
2. The method of claim 1, wherein sequentially determining whether resource objects satisfying the use of the preset thread exist in the available resource chain table and the first numbered resource chain table comprises:
judging whether the available resource linked list has a resource object meeting the use of the preset thread;
responding to the resource objects which do not meet the use of the preset thread in the available resource linked list, and judging whether the resource objects which meet the use of the preset thread exist in the first numbered resource linked list or not;
and in response to the first numbered resource linked list having the resource objects meeting the use requirements of the preset threads, acquiring the resource objects from the first numbered resource linked list and putting the resource objects into the available resource linked list so as to acquire the resource objects meeting the use requirements of the preset threads from the available resource linked list and allocate the resource objects to the preset threads.
3. The method of claim 1, further comprising:
responding to the situation that a preset thread releases resource objects and the released resource objects are first numbered resource objects, and judging whether the quantity of the resource objects in the available resource linked list exceeds a first preset threshold value or not;
in response to the number of resource objects in the available resource linked list not exceeding the first preset threshold, placing the released resource objects in the available resource linked list;
and in response to the fact that the number of the resource objects in the available resource linked list exceeds the first preset threshold value, transferring all the resource objects in the first numbered resource linked list to the global pool, and transferring all the resource objects in the available resource linked list to the first numbered resource linked list.
4. The method of claim 1, further comprising:
responding to the situation that a preset thread releases resource objects and the released resource objects are second numbered resource objects, and judging whether the quantity of the resource objects in the second numbered resource chain table exceeds a second preset threshold value or not;
in response to the number of the resource objects in the second numbered resource linked list not exceeding the second preset threshold, placing the released resource objects into the second numbered resource linked list;
and in response to the fact that the number of the resource objects in the second numbered resource linked list exceeds the second preset threshold value, transferring all the resource objects in the second numbered resource linked list to the global pool.
5. The method of claim 1, wherein obtaining resource objects from the global pool and placing into the linked list of available resources comprises:
and requesting a lock from the global pool, acquiring a resource object based on the lock and putting the resource object into the available resource linked list.
6. The method of claim 1, further comprising:
and responding to the allocation of resource objects for other threads except for the preset thread, requesting a lock from the global pool, acquiring the resource objects from the global pool based on the lock, and allocating the resource objects to the other threads.
7. The method of claim 6, further comprising:
and responding to the thread release resource object in the rest threads, and recycling the released resource object to the global pool.
8. A resource management system, comprising:
the system comprises a number dividing module, a global pool and a resource object management module, wherein the number dividing module is configured and used for dividing resource objects under a preset scene into a first number resource object and a second number resource object according to a preset number rule and putting all the first number resource object and the second number resource object into the global pool;
the linked list creating module is configured to create a local pool for storing the resource objects to be used for each preset thread, and create an available resource linked list, a first numbered resource linked list corresponding to the first numbered resource object and a second numbered resource linked list corresponding to the second numbered resource object in the local pool;
the judging module is configured to respond to allocation of resource objects for a preset thread and sequentially judge whether the available resource chain table and the first numbered resource chain table have the resource objects meeting the use of the preset thread; and
and the resource allocation module is configured to, in response to that neither the available resource linked list nor the first numbered resource linked list satisfies the resource object used by the preset thread, acquire the resource object from the global pool and place the resource object into the available resource linked list so that the resource object satisfying the use of the preset thread is acquired from the available resource linked list and allocated to the preset thread.
9. A computer-readable storage medium, characterized in that computer program instructions are stored which, when executed, implement the method according to any one of claims 1-7.
10. A computer device comprising a memory and a processor, characterized in that the memory has stored therein a computer program which, when executed by the processor, performs the method according to any one of claims 1-7.
CN202110875936.9A 2021-07-30 2021-07-30 Resource management method, system, storage medium and equipment Active CN113742061B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110875936.9A CN113742061B (en) 2021-07-30 2021-07-30 Resource management method, system, storage medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110875936.9A CN113742061B (en) 2021-07-30 2021-07-30 Resource management method, system, storage medium and equipment

Publications (2)

Publication Number Publication Date
CN113742061A true CN113742061A (en) 2021-12-03
CN113742061B CN113742061B (en) 2023-07-14

Family

ID=78729686

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110875936.9A Active CN113742061B (en) 2021-07-30 2021-07-30 Resource management method, system, storage medium and equipment

Country Status (1)

Country Link
CN (1) CN113742061B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106681835A (en) * 2016-12-28 2017-05-17 华为技术有限公司 Resource allocation method and resource manager
CN111858034A (en) * 2020-06-29 2020-10-30 苏州浪潮智能科技有限公司 Resource management method, system, device and medium
CN112269659A (en) * 2020-10-23 2021-01-26 苏州浪潮智能科技有限公司 Resource management method, system, electronic equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106681835A (en) * 2016-12-28 2017-05-17 华为技术有限公司 Resource allocation method and resource manager
CN111858034A (en) * 2020-06-29 2020-10-30 苏州浪潮智能科技有限公司 Resource management method, system, device and medium
CN112269659A (en) * 2020-10-23 2021-01-26 苏州浪潮智能科技有限公司 Resource management method, system, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113742061B (en) 2023-07-14

Similar Documents

Publication Publication Date Title
CN107360206B (en) Block chain consensus method, equipment and system
US10223253B2 (en) Allocation systems and method for partitioning lockless list structures
CN112214313A (en) Memory allocation method and related equipment
CN111597040A (en) Resource allocation method, device, storage medium and electronic equipment
CN110659905A (en) Transaction verification method, device, terminal equipment and storage medium
WO2023056797A1 (en) Blockchain-based data processing method, apparatus, and device, and storage medium
CN114598658A (en) Flow limiting method and device
CN108388409B (en) Print request processing method, apparatus, computer device and storage medium
CN114063907A (en) Storage space allocation method, system, storage medium and equipment
CN116069493A (en) Data processing method, device, equipment and readable storage medium
CN111831504A (en) Monitoring method, monitoring apparatus, computer device, and medium
CN113742061B (en) Resource management method, system, storage medium and equipment
CN110891033B (en) Network resource processing method, device, gateway, controller and storage medium
CN105490956A (en) Network request processing method and network request processing device
CN108139969B (en) Memory configuration method, device and system
CN115794317A (en) Processing method, device, equipment and medium based on virtual machine
CN115098283A (en) IPC message processing method, system, storage medium and equipment
CN112600765B (en) Method and device for scheduling configuration resources
US20060230246A1 (en) Memory allocation technique using memory resource groups
CN115878309A (en) Resource allocation method, device, processing core, equipment and computer readable medium
CN107273188B (en) Virtual machine Central Processing Unit (CPU) binding method and device
US11016685B2 (en) Method and defragmentation module for defragmenting resources
KR20040101386A (en) Morphing memory pools
CN110941564B (en) Storage space allocation method and device, electronic equipment and storage medium
CN116074553B (en) Video stream transmission method, 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
GR01 Patent grant
GR01 Patent grant