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

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

Info

Publication number
CN113742061B
CN113742061B CN202110875936.9A CN202110875936A CN113742061B CN 113742061 B CN113742061 B CN 113742061B CN 202110875936 A CN202110875936 A CN 202110875936A CN 113742061 B CN113742061 B CN 113742061B
Authority
CN
China
Prior art keywords
resource
linked list
objects
numbered
available
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110875936.9A
Other languages
Chinese (zh)
Other versions
CN113742061A (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 equipment, wherein the method comprises the following steps: dividing resource objects in a 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; in response to the allocation of the resource objects for the preset thread, sequentially judging whether the available resource linked list and the first numbered resource linked list have the resource objects meeting the use of the preset thread or not; and responding to the resource objects which do not meet the use requirement of the preset thread, acquiring the resource objects from the global pool, putting the resource objects into an available resource linked list, acquiring the resource objects from the available resource linked list, 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 method, a system, a storage medium, and an apparatus for resource management.
Background
High concurrency generally refers to ensuring that a system is able to process many requests in parallel at the same time by design. In colloquial terms, high concurrency means that at the same point in time, many users access the same API interface or URL address at the same time, which often occurs in business scenarios with a large number of active users and a high aggregation of users. 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, a current common practice is to implement in a locking manner. However, when the concurrent request amount reaches a critical point, there is a problem of abrupt performance degradation, which is a bottleneck for a scenario with strict requirements on allocation time.
Disclosure of Invention
In view of the above, the present invention aims to provide a method, a system, a storage medium and a device for resource management, which are used for solving the problem of complicated resource allocation and recovery in a high concurrency scenario in the prior art.
Based on the above object, the present invention provides a resource management method, comprising the steps of:
dividing resource objects in a 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;
in response to the allocation of the resource objects for the preset thread, sequentially judging whether the available resource linked list and the first numbered resource linked list have the resource objects meeting the use of the preset thread or not;
and responding to the resource objects which do not meet the use of the preset thread in the available resource linked list and the first numbered resource linked list, acquiring the resource objects from the global pool and putting the resource objects into the available resource linked list so as to acquire the resource objects meeting the use of the preset thread from the available resource linked list and allocate the resource objects to the preset thread.
In some embodiments, sequentially determining whether the available resource linked list and the first numbered resource linked list have resource objects satisfying the preset thread usage includes:
judging whether a resource object meeting the use of a preset thread exists in the available resource linked list;
judging whether the first numbered resource linked list has resource objects meeting the use of the preset thread or not according to the resource objects not meeting the use of the preset thread in the available resource linked list;
and responding to the resource objects meeting the use of the preset thread in the first numbered resource linked list, acquiring the resource objects from the first numbered resource linked list and putting the resource objects into an available resource linked list so as to acquire the resource objects meeting the use of the preset thread from the available resource linked list and distributing the resource objects to the preset thread.
In some embodiments, the method further comprises:
responding to the condition that a preset thread releases a resource object and the released resource object is a first numbered resource object, and judging whether the number of the resource objects in an available resource linked list exceeds a first preset threshold value or not;
the released resource objects are put into the available resource linked list in response to the number of the resource objects in the available resource linked list not exceeding a first preset threshold;
and in response to the number of the resource objects in the available resource chain table exceeding a first preset threshold, transferring all the resource objects in the first numbered resource chain table to a global pool, and transferring all the resource objects in the available resource chain table to the first numbered resource chain table.
In some embodiments, the method further comprises:
responding to the condition that a preset thread releases the resource object and the released resource object is a second numbered resource object, and judging whether the number of the resource objects in a second numbered resource linked list exceeds a second preset threshold value or not;
responding to the number of the resource objects in the second numbered resource chain table not exceeding a second preset threshold, and placing the released resource objects into the second numbered resource chain table;
and transferring all the resource objects in the second numbered resource chain table to the global pool in response to the number of the resource objects in the second numbered resource chain table exceeding a second preset threshold.
In some embodiments, retrieving resource objects from a global pool and placing them in a linked list of available resources includes:
a lock is requested from the global pool and a resource object is obtained based on the lock and placed into a linked list of available resources.
In some embodiments, the method further comprises:
in response to allocating resource objects for the remaining threads other than the preset thread, a lock is requested from the global pool, and the resource objects are obtained from the global pool and allocated to the remaining threads based on the lock.
In some embodiments, the method further comprises:
and responding to the release of the resource objects by the threads in the rest threads, and recycling the released resource objects into the global pool.
In another aspect of the present invention, there is also provided a resource management system, including:
the number dividing module 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 put all the first number resource object and the second number resource object into the global pool;
the chain table creation 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 chain table, a first numbered resource chain table corresponding to the first numbered resource object and a second numbered resource chain table 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 linked list and the first numbered resource linked list have the resource objects meeting the use of the preset thread or not; and
and the resource allocation module is configured to acquire the resource object from the global pool and put the resource object into the available resource linked list in response to the fact that the resource object meeting the use of the preset thread is not in the available resource linked list and the first numbered resource linked list, so that the resource object meeting 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 of the methods described above.
In yet another aspect of the present invention, there is also provided a computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, performs any of the methods described above.
The invention has at least the following beneficial technical effects:
the invention takes the global pool as the application point of the resource object, dynamically allocates certain resource amount for the threads which frequently apply for the resource object or have strict requirements on delay, and uses the resource object as the local pool of the thread, so that the local pool is preferentially selected when the resource object is applied and released, if the resource object of the local pool is not enough to be used, the global pool application is only carried out, and as the global pool is only applied for resources, the local pool where the thread is located is not required to be locked when the local pool is applied for resources, the application and release on the local pool are not required to be equally locked; the buffer linked list and the recovery mechanism of the local pool effectively reduce the competition brought by resource concurrency application, greatly reduce the overhead of equal locks, improve the resource allocation and recovery efficiency, solve the problem that the performance is suddenly reduced when the concurrency request quantity reaches a critical point, and are also suitable for the scene with strict requirements on the resource allocation time.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are necessary for the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention and that other embodiments may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a resource management method according to an embodiment of the present invention;
FIG. 2 is a schematic 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 implementing a resource management method according to an embodiment of the present invention;
fig. 4 is a schematic hardware structure of a computer device for performing 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 will be described in further detail with reference to the accompanying drawings.
It should be noted that, in the embodiments of the present invention, all the expressions "first" and "second" are used to distinguish two non-identical entities with the same name or non-identical parameters, and it is noted that the "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 "comprise" and "have," and any variations thereof, are intended to cover a non-exclusive inclusion, such as a process, method, system, article, or other step or unit that comprises a list of steps or units.
Based on the above object, a first aspect of the embodiments of the present invention proposes an embodiment of a resource management method. Fig. 1 is a schematic diagram of 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 in a 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, a local pool for storing the resource objects to be used is established for each preset thread, and 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 are established in the local pool;
step S30, in response to the allocation of the resource objects for the preset thread, judging whether the available resource linked list and the first numbered resource linked list have the resource objects meeting the use of the preset thread or not in sequence;
and step S40, in response to the fact that the available resource linked list and the first numbered resource linked list are not provided with the resource objects meeting the use of the preset thread, acquiring the resource objects from the global pool and putting the resource objects into the available resource linked list so that the resource objects meeting the use of the preset thread are acquired from the available resource linked list and distributed to the preset thread.
The preset scene in the embodiment of the invention comprises, but is not limited to, a high concurrency scene, namely a service scene with a large number of active users and high aggregation of users at the same time, and resources can be frequently applied and released in the scene. The preset thread mainly refers to a thread which frequently applies resources or has strict requirements on delay.
In this embodiment, each resource object may be individually numbered, for example, by an integer of 1, 2, or 3 … … n, and then the even number may be the first number and the odd number may be the second number.
In this embodiment, in the initialization stage, the available resource list, the first numbered resource list and the second numbered resource list are empty, so that there is no resource object in the available resource list and the first numbered resource list at the beginning, and then the resource object is acquired from the global pool and is given to the available resource list.
According to the embodiment of the invention, the global pool is used as an application point of a resource object, and a certain amount of resources are dynamically allocated for threads which frequently apply for the resource object or have strict requirements on delay, so that the threads are used as local pools, when the local pools apply for and release the resource object, the local pools are preferentially selected, if the resource object of the local pools is not enough, the global pool application is carried out, and as the global pool is only applied for resources, the local pools where the threads are located are not required to be locked, and the local pools are not required to be applied for and released; the buffer linked list and the recovery mechanism of the local pool effectively reduce the competition brought by resource concurrency application, greatly reduce the overhead of equal locks, improve the resource allocation and recovery efficiency, solve the problem that the performance is suddenly reduced when the concurrency request quantity reaches a critical point, and are also suitable for the scene with strict requirements on the resource allocation time.
In some embodiments, retrieving resource objects from a global pool and placing them in a linked list of available resources includes: a lock is requested from the global pool and a resource object is obtained based on the lock and placed into a linked list of available resources.
In some embodiments, sequentially determining whether the available resource linked list and the first numbered resource linked list have resource objects satisfying the preset thread usage includes: judging whether a resource object meeting the use of a preset thread exists in the available resource linked list; judging whether the first numbered resource linked list has resource objects meeting the use of the preset thread or not according to the resource objects not meeting the use of the preset thread in the available resource linked list; and responding to the resource objects meeting the use of the preset thread in the first numbered resource linked list, acquiring the resource objects from the first numbered resource linked list and putting the resource objects into an available resource linked list so as to acquire the resource objects meeting the use of the preset thread from the available resource linked list and distributing the resource objects to the preset thread.
In another embodiment, if the available resource linked list has resource objects meeting the use 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 condition that a preset thread releases a resource object and the released resource object is a first numbered resource object, and judging whether the number of the resource objects in an available resource linked list exceeds a first preset threshold value or not; the released resource objects are put into the available resource linked list in response to the number of the resource objects in the available resource linked list not exceeding a first preset threshold; and in response to the number of the resource objects in the available resource chain table exceeding a first preset threshold, transferring all the resource objects in the first numbered resource chain table to a global pool, and transferring all the resource objects in the available resource chain table to the first numbered resource chain table.
In the above embodiment, the first numbered resource list plays a role of buffering in resource allocation and reclamation. Because the lock is needed when the resource object is applied to be allocated in the global pool, and the lock is not needed when the resource object is applied to be allocated in the local pool, the resource object is put into the local pool as much as possible, and the buffer function can be achieved when the resource is allocated through the first numbered resource list. When the resource object is released, the resource object is left in the first numbered resource chain table and can be used for later resource object allocation.
In some embodiments, the method further comprises: responding to the condition that a preset thread releases the resource object and the released resource object is a second numbered resource object, and judging whether the number of the resource objects in a second numbered resource linked list exceeds a second preset threshold value or not; responding to the number of the resource objects in the second numbered resource chain table not exceeding a second preset threshold, and placing the released resource objects into the second numbered resource chain table; and transferring all the resource objects in the second numbered resource chain table to the global pool in response to the number of the resource objects in the second numbered resource chain table exceeding a second preset threshold.
In this embodiment, the second numbered resource list mainly plays a role in buffering during resource recovery. By transferring the resource objects in the second numbered resource chain table to the global pool, an insufficient number of resource objects in the global pool can be prevented.
In some embodiments, the method further comprises: in response to allocating resource objects for the remaining threads other than the preset thread, a lock is requested from the global pool, and the resource objects are obtained from the global pool and allocated to the remaining threads based on the lock.
In some embodiments, the method further comprises: and responding to the release of the resource objects by the threads in the rest threads, and recycling the released resource objects into the global pool.
In the above embodiment, all the threads except the preset thread 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 embodiment of the present invention, a resource management system is also provided. FIG. 2 is a schematic diagram of an embodiment of a resource management system provided by 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 put all the first number resource object and the second number resource object into a global pool; the link list creation module 20 is configured to create a local pool for storing resource objects to be used by each preset thread, and create an available resource link list, a first numbered resource link list corresponding to the first numbered resource object, and a second numbered resource link list corresponding to the second numbered resource object in the local pool; a judging module 30, configured to sequentially judge whether resource objects meeting the use of the preset thread exist in the available resource linked list and the first numbered resource linked list in response to the allocation of the resource objects for the preset thread; and a resource allocation module 40 configured to obtain a resource object from the global pool and put into the available resource linked list so that the resource object satisfying the use of the preset thread is obtained from the available resource linked list and allocated to the preset thread in response to the resource object not satisfying the use of the preset thread in both the available resource linked list and the first numbered resource linked list.
In some embodiments, the judging module 30 includes a resource object judging module configured to judge whether there are resource objects in the available resource linked list that satisfy the preset thread usage; judging whether the first numbered resource linked list has resource objects meeting the use of the preset thread or not according to the resource objects not meeting the use of the preset thread in the available resource linked list; and responding to the resource objects meeting the use of the preset thread in the first numbered resource linked list, acquiring the resource objects from the first numbered resource linked list and putting the resource objects into an available resource linked list so as to acquire the resource objects meeting the use of the preset thread from the available resource linked list and distributing the resource objects to the preset thread.
In some embodiments, the system further includes a first reclamation module configured to determine, in response to a preset thread releasing a resource object and the released resource object being a first numbered resource object, whether a number of resource objects in the available resource linked list exceeds a first preset threshold; the released resource objects are put into the available resource linked list in response to the number of the resource objects in the available resource linked list not exceeding a first preset threshold; and in response to the number of the resource objects in the available resource chain table exceeding a first preset threshold, transferring all the resource objects in the first numbered resource chain table to a global pool, and transferring all the resource objects in the available resource chain table to the first numbered resource chain table.
In some embodiments, the system further includes a second reclamation module configured to determine, in response to a preset thread releasing a resource object and the released resource object being a second numbered resource object, whether a number of resource objects in the second numbered resource linked list exceeds a second preset threshold; responding to the number of the resource objects in the second numbered resource chain table not exceeding a second preset threshold, and placing the released resource objects into the second numbered resource chain table; and transferring all the resource objects in the second numbered resource chain table to the global pool in response to the number of the resource objects in the second numbered resource chain table exceeding a second preset threshold.
In some embodiments, the resource allocation module 40 includes a request lock module configured to request a lock from the global pool and to retrieve a resource object based on the lock and place it into a linked list of available resources.
In some embodiments, the system further comprises a global pool allocation module configured to request a lock from the global pool and to obtain and allocate resource objects from the global pool to the remaining threads based on the lock in response to allocating resource objects for the remaining threads other than the preset thread.
In some embodiments, the system further comprises a global pool reclamation module configured to reclaim the freed resource objects into the global pool in response to threads in the remaining threads freeing the resource objects.
According to the resource management system provided by the embodiment of the invention, the global pool is used as the application point of the resource object, and a certain amount of resources are dynamically allocated for threads which frequently apply for the resource object or have strict requirements on delay, so that the local pool is used as the local pool of the thread, when the resource object is applied and released, the local pool is preferentially selected, if the resource object of the local pool is not used enough, the global pool application is carried out, and as the global pool is only applied for resources, the local pool where the thread is located is not required to be locked, and the application and release on the local pool are not required to be equally locked; the buffer linked list and the recovery mechanism of the local pool effectively reduce the competition brought by resource concurrency application, greatly reduce the overhead of equal locks, improve the resource allocation and recovery efficiency, solve the problem that the performance is suddenly reduced when the concurrency request quantity reaches a critical point, and are also suitable for the scene with strict requirements on the resource allocation time.
In a third aspect of the embodiments of the present invention, a computer readable storage medium is provided, and fig. 3 is a schematic diagram of 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, which computer program instructions 31 are executable by a processor. The computer program instructions 31 when executed implement the method of any of the embodiments described above.
It should be understood that all of the embodiments, features and advantages set forth above for the resource management method according to the present invention equally apply to the resource management system and storage medium according to the present invention, without conflicting therewith.
In a fourth aspect of the embodiments of the present invention, there is also provided a computer device comprising a memory 402 and a processor 401, the memory storing a computer program which, when executed by the processor, implements the method of any of the embodiments described above.
Fig. 4 is a schematic hardware structure of an embodiment of a computer device for performing the resource management method according to the present invention. Taking the example of a computer device as shown in fig. 4, a processor 401 and a memory 402 are included in the computer device, and may further include: an input device 403 and an output device 404. The processor 401, memory 402, input device 403, and output device 404 may be connected by a bus or otherwise, for example in fig. 4. 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 resource management system. The output 404 may include a display device such as a display screen.
The memory 402 is used as a non-volatile computer readable storage medium, and 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. Memory 402 may include a storage program area that may store an operating system, at least one application program required for functionality, and a storage data area; the storage data area may store data created by the use of the resource management method, and the like. In addition, 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 the local module 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, i.e., implements the resource management method of the above-described method embodiment, by running nonvolatile software programs, instructions, and modules stored in the memory 402.
Finally, it should be noted that the computer-readable storage media (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 acts as external cache memory. By way of example, and not limitation, RAM may be 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 present disclosure.
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 thereof. 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 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 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 foregoing embodiment of the present invention has been disclosed with reference to the number of embodiments for the purpose of description only, and does not represent the advantages or disadvantages of the embodiments.
Those of ordinary skill in the art will appreciate that: the above discussion of any embodiment is merely exemplary and is not intended to imply that the scope of the disclosure of embodiments of the invention, including the claims, is limited to such examples; combinations of features of the above embodiments or in different embodiments are also possible within the idea of an embodiment of the invention, and many other variations of the different aspects of the embodiments of the invention as described above exist, which are not provided in detail for the sake of brevity. Therefore, any omission, modification, equivalent replacement, improvement, etc. of the embodiments should be included in the protection scope of the embodiments of the present invention.

Claims (9)

1. A method of resource management, comprising the steps of:
dividing resource objects in a 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 number resource linked list corresponding to a first number resource object and a second number resource linked list corresponding to a second number resource object in the local pool;
in response to allocating a resource object for a preset thread, sequentially judging whether the available resource linked list and the first numbered resource linked list have the resource object meeting the use of the preset thread, further comprising:
judging whether the available resource linked list has resource objects meeting the use of the preset thread or not;
judging whether the first numbered resource linked list has resource objects meeting the use of the preset thread or not according to the resource objects not meeting the use of the preset thread in the available resource linked list;
responding to the resource objects meeting the use of the preset thread in the first numbered resource linked list, 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 of the preset thread from the available resource linked list and distributing the resource objects to the preset thread;
and responding to the resource objects which do not meet the use of the preset thread in the available resource linked list and the first numbered resource linked list, acquiring the resource objects from the global pool and putting the resource objects into the available resource linked list so as to acquire the resource objects meeting the use of the preset thread from the available resource linked list and allocate the resource objects to the preset thread.
2. The method as recited in claim 1, further comprising:
responding to the condition that a preset thread releases a resource object and the released resource object is a first numbered resource object, and judging whether the number of the resource objects in the available resource linked list exceeds a first preset threshold value or not;
responding to the quantity of the resource objects in the available resource linked list not exceeding the first preset threshold, and placing the released resource objects into the available resource linked list;
and in response to the number of the resource objects in the available resource linked list exceeding the 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.
3. The method as recited in claim 1, further comprising:
responding to a condition that a preset thread releases a resource object and the released resource object is a second numbered resource object, and judging whether the number of the resource objects in a second numbered resource linked list exceeds a second preset threshold;
responding to the number of the resource objects in the second numbered resource linked list not exceeding the second preset threshold, and placing the released resource objects into the second numbered resource linked list;
and transferring all the resource objects in the second numbered resource chain table to the global pool in response to the number of the resource objects in the second numbered resource chain table exceeding the second preset threshold.
4. The method of claim 1, wherein obtaining resource objects from the global pool and placing them in the linked list of available resources comprises:
and requesting a lock from the global pool, acquiring a resource object based on the lock, and placing the resource object into the available resource linked list.
5. The method as recited in claim 1, further comprising:
in response to allocating resource objects for the remaining threads other than the preset thread, a lock is requested from the global pool, and the resource objects are obtained from the global pool and allocated to the remaining threads based on the lock.
6. The method as recited in claim 5, further comprising:
and responding to the release of the resource objects by threads in the rest threads, and recycling the released resource objects into the global pool.
7. A resource management system, comprising:
the number dividing module 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 put all the first number resource object and the second number resource object into the global pool;
the chain table 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 chain table, a first numbered resource chain table corresponding to the first numbered resource object and a second numbered resource chain table 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 linked list and the first numbered resource linked list have the resource objects meeting the use of the preset thread or not, and further comprises: judging whether the available resource linked list has resource objects meeting the use of the preset thread or not; judging whether the first numbered resource linked list has resource objects meeting the use of the preset thread or not according to the resource objects not meeting the use of the preset thread in the available resource linked list; responding to the resource objects meeting the use of the preset thread in the first numbered resource linked list, 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 of the preset thread from the available resource linked list and distributing the resource objects to the preset thread; and
and the resource allocation module is configured to respond to the resource objects which do not meet the use of the preset thread in the available resource linked list and the first numbered resource linked list, acquire the resource objects from the global pool and put the resource objects into the available resource linked list so as to acquire the resource objects meeting the use of the preset thread from the available resource linked list and allocate the resource objects to the preset thread.
8. A computer readable storage medium, characterized in that computer program instructions are stored, which when executed implement the method of any of claims 1-6.
9. A computer device comprising a memory and a processor, wherein the memory has stored therein a computer program which, when executed by the processor, performs the method of any of claims 1-6.
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 CN113742061A (en) 2021-12-03
CN113742061B true 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
CN113742061A (en) 2021-12-03

Similar Documents

Publication Publication Date Title
US9292448B2 (en) Dynamic sizing of memory caches
US20160306680A1 (en) Thread creation method, service request processing method, and related device
CN112099958A (en) Distributed multi-task management method and device, computer equipment and storage medium
CN111104208B (en) Process scheduling management method, device, computer equipment and storage medium
WO2022057231A1 (en) Method and apparatus for accessing server, device, and storage medium
CN106802939B (en) Method and system for solving data conflict
CN112929291A (en) Distributed current limiting method based on redis, computer equipment and storage medium
CN112214313A (en) Memory allocation method and related equipment
CN105843819A (en) Method and device for exporting data
CN109067562B (en) Dynamic configuration updating method and system based on intelligent pointer, server and medium
CN114598658A (en) Flow limiting method and device
CN110866011B (en) Data table synchronization method and device, computer equipment and storage medium
CN108388409B (en) Print request processing method, apparatus, computer device and storage medium
CN113742061B (en) Resource management method, system, storage medium and equipment
CN111831504A (en) Monitoring method, monitoring apparatus, computer device, and medium
CN112260962A (en) Bandwidth control method and device
CN110049350B (en) Video transcoding processing method and device, computer equipment and storage medium
CN110891033B (en) Network resource processing method, device, gateway, controller and storage medium
US10606795B2 (en) Methods for managing a buffer cache and devices thereof
WO2017070869A1 (en) Memory configuration method, apparatus and system
CN109522113B (en) Memory management method and device
CN105490956A (en) Network request processing method and network request processing device
CN113419672B (en) Storage capacity management method, system and storage medium
CN115098283A (en) IPC message processing method, system, storage medium and equipment
CN107273188B (en) Virtual machine Central Processing Unit (CPU) binding method and device

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