CN109474543B - Queue resource management method, device and storage medium - Google Patents
Queue resource management method, device and storage medium Download PDFInfo
- Publication number
- CN109474543B CN109474543B CN201710801895.2A CN201710801895A CN109474543B CN 109474543 B CN109474543 B CN 109474543B CN 201710801895 A CN201710801895 A CN 201710801895A CN 109474543 B CN109474543 B CN 109474543B
- Authority
- CN
- China
- Prior art keywords
- queue
- message
- dequeue
- resource
- request
- 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
Links
- 238000007726 management method Methods 0.000 title abstract description 64
- 238000012545 processing Methods 0.000 claims description 54
- 238000000034 method Methods 0.000 claims description 49
- 230000015654 memory Effects 0.000 claims description 37
- 238000004590 computer program Methods 0.000 claims description 31
- 239000000758 substrate Substances 0.000 claims 1
- 238000001514 detection method Methods 0.000 description 15
- 230000001360 synchronised effect Effects 0.000 description 9
- 238000010586 diagram Methods 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 230000005291 magnetic effect Effects 0.000 description 4
- 230000003068 static effect Effects 0.000 description 4
- 238000013507 mapping Methods 0.000 description 3
- 235000019800 disodium phosphate Nutrition 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 238000013523 data management Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000005294 ferromagnetic effect Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000004064 recycling Methods 0.000 description 1
- 238000013468 resource allocation Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/50—Queue scheduling
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Multi Processors (AREA)
- Telephonic Communication Services (AREA)
Abstract
The invention discloses a queue resource management method, which comprises the following steps: determining the operation of a queue of the requests according to the current operation request; generating resource linked list information of the requested queue by utilizing the determined operation, and executing the operation on the requested queue according to the generated resource linked list information; the resource linked list information characterizes the logic sequence of the resources in the queue. The invention also discloses a queue resource management device and a storage medium.
Description
Technical Field
The present invention relates to queue management technology in the field of communications, and in particular, to a method, an apparatus, and a storage medium for managing queue resources.
Background
Dequeue management and timeout detection of messages are common and primary functions in communication systems. With the continuous improvement of data service demands, consumers have higher demands on the service quality of data products; with the continuous improvement of data traffic, higher requirements are put forward on the processing time, the number of queues and the resource utilization rate of the messages, and the requirements on the queue management performance are also higher and higher.
For queue resource management, most of the existing methods use the form of pointer groups, and the method has limitation on full utilization of resources and has low resource utilization rate.
In addition, for timeout detection, there is no scene of timeout detection for queue resource management, only timeout detection for hardware queue status is performed, more hardware resources are required for timeout detection for hardware queue status, and the complexity of hardware is increased along with improvement of performance requirements.
Disclosure of Invention
In order to solve the existing technical problems, the embodiment of the invention provides a queue resource management method, a device and a storage medium.
The technical scheme of the embodiment of the invention is realized as follows:
the embodiment of the invention provides a queue resource management method, which comprises the following steps:
determining the operation of a queue of the requests according to the current operation request;
generating resource linked list information of the requested queue by utilizing the determined operation, and executing the operation on the requested queue according to the generated resource linked list information; the resource linked list information characterizes the logic sequence of the resources in the queue.
In the above solution, when the current operation request is a message enqueuing request, before generating the resource linked list information of the queue of the request, the method further includes: determining a target queue of the message requesting enqueuing, and distributing resources from a resource pool;
The resource linked list information of the queue for generating the request comprises: and adding a linked list of the allocated resources to a linked list of the queue tail elements of the target queue.
In the above solution, after the generating the resource linked list information of the queue of the request, the method further includes: generating resource data information of the queue of the request; the resource data information characterizes the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one by one;
the generating the resource data information of the queue of the request comprises the following steps: and storing the message requesting enqueuing into the allocated resources.
In the above solution, before determining the target queue of the message requesting enqueuing, the method further includes:
judging whether the message requesting for enqueuing meets the enqueuing condition or not; and determining that the message requiring enqueuing meets the enqueuing condition, and determining a target queue of the message requiring enqueuing.
In the above solution, the determining whether the message requesting for enqueuing meets the enqueuing condition includes:
extracting a queue field from the message requesting enqueuing;
obtaining a queue relation table; the queue relationship table includes: the corresponding relation between at least one queue field and the target queue;
Judging whether the queue relation table contains the extracted queue field, and determining that the message requesting for enqueuing meets the enqueuing condition when the queue relation table contains the extracted queue field.
In the above solution, the determining the target queue of the message according to the message requesting enqueuing includes:
and searching a target queue corresponding to the extracted queue field in the queue relation table.
In the above solution, when the current operation request is a message dequeue request, the generating resource link list information of the queue of the request includes:
and adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
In the above solution, before the list of queue head elements of the dequeue corresponding to the message of the request dequeue adds the list of resources corresponding to the message of the request dequeue, the method further includes:
judging whether the message requesting dequeuing meets dequeuing conditions or not; and if the message of the request dequeue meets the dequeue condition, adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
In the above solution, the determining whether the message requesting dequeuing meets the dequeuing condition includes:
determining a dequeue corresponding to the message requesting dequeuing, judging whether the dequeue is empty, wherein the dequeue is not empty, and if the handshake operation of the dequeue is effective, determining that the message requesting dequeuing meets the dequeuing condition.
In the above solution, after the generating the resource linked list information of the queue of the request, the method further includes:
and starting timing from message enqueuing, determining that the enqueued message does not dequeue after exceeding the preset time, modifying the state of resources occupied by the enqueued message, and modifying the resource linked list information according to overtime operation so as to process the enqueued message.
The embodiment of the invention also provides a queue resource management device, which comprises: the first processing module and the second processing module; wherein,
the first processing module is used for determining the operation of the queue of the request according to the current operation request;
the second processing module is used for generating resource linked list information of the request queue by utilizing the determined operation, and executing the operation on the request queue according to the generated resource linked list information; the resource linked list information characterizes the logic sequence of the resources in the queue.
In the above solution, when the current operation request is a message enqueuing request, the second processing module is further configured to determine a target queue of the message requesting enqueuing, and allocate resources from a resource pool;
the second processing module is specifically configured to add a linked list of allocated resources to a linked list of queue tail elements of the target queue.
In the above scheme, the second processing module is further configured to generate resource data information of the requested queue; the resource data information characterizes the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one by one;
the second processing module is specifically configured to store the message requesting enqueuing to an allocated resource.
In the above scheme, the second processing module is further configured to determine whether a message requesting for enqueuing meets an enqueuing condition; and determining that the message requiring enqueuing meets the enqueuing condition, and determining a target queue of the message requiring enqueuing.
In the above solution, the second processing module is configured to extract a queue field from the request enqueued packet;
obtaining a queue relation table; the queue relationship table includes: the corresponding relation between at least one queue field and the target queue;
Judging whether the queue relation table contains the extracted queue field, and determining that the message requesting for enqueuing meets the enqueuing condition when the queue relation table contains the extracted queue field.
In the above solution, the second processing module is configured to search the target queue corresponding to the extracted queue field in the queue relation table.
In the above solution, when the current operation request is a message dequeue request, the second processing module is configured to add a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
In the above scheme, the second processing module is configured to determine whether the message requesting dequeuing meets a dequeuing condition; and if the message of the request dequeue meets the dequeue condition, adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
In the above scheme, the second processing module is configured to determine a dequeue corresponding to the message requesting dequeuing, determine whether the dequeue is empty, and determine that the message requesting dequeuing meets the dequeuing condition if the dequeue is not empty and the handshake operation of the dequeue is valid.
In the above scheme, the device further includes: and the third processing module is used for timing from the enqueuing of the messages, determining that the enqueued messages are not dequeued after exceeding the preset time, modifying the state of resources occupied by the enqueued messages, and modifying the resource linked list information according to the overtime operation so as to process the enqueued messages.
The embodiment of the invention also provides a queue resource management device, which comprises: a processor and a memory for storing a computer program capable of running on the processor,
wherein the processor is configured to execute the steps of any one of the queue resource management methods described above when executing the computer program.
The embodiment of the invention also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of any of the queue resource management methods described above.
The queue resource management method, the queue resource management device and the storage medium provided by the embodiment of the invention determine the operation on the queue of the request according to the current operation request; generating resource linked list information of the requested queue by utilizing the determined operation, and executing the operation on the requested queue according to the generated resource linked list information; the resource linked list information characterizes the logic sequence of the resources in the queue. The method, the device and the storage medium of the embodiment of the invention divide the resources in the queue into the resource linked list information and the resource data information for resource management, realize the dequeue management and the enqueue management of the message in a group link mode, and improve the processing efficiency of the resources.
Besides, the scheme of the embodiment of the invention starts timing from the enqueuing of the message, determines that the enqueued message is not dequeued after exceeding the preset time, modifies the state of the resources occupied by the enqueued message, modifies the resource linked list information according to the overtime operation, and is used for processing the enqueued message.
Drawings
In the drawings (which are not necessarily drawn to scale), like numerals may describe similar components in different views. The drawings illustrate generally, by way of example and not by way of limitation, various embodiments discussed herein.
FIG. 1 is a flow chart of a first queue resource management method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a first queue resource management device according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a second queue resource management device according to an embodiment of the present invention;
FIG. 4 is a flow chart of a second queue resource management method according to an embodiment of the present invention;
Fig. 5 is a schematic structural diagram of a queue resource management device three according to an embodiment of the present invention.
Detailed Description
In various embodiments of the present invention, operations on a queue of requests are determined based on a current operation request; generating resource linked list information of the requested queue by utilizing the determined operation, and executing the operation on the requested queue according to the generated resource linked list information; the resource linked list information characterizes the logic sequence of the resources in the queue.
The present invention will be described in further detail with reference to examples.
FIG. 1 is a flow chart of a first queue resource management method according to an embodiment of the present invention; as shown in fig. 1, the queue resource management method includes:
step 101, determining the operation of a queue of requests according to the current operation request;
here, the operation request includes: message enqueue requests and message dequeue requests;
when the current operation request is determined to be a message enqueuing request, executing a message enqueuing operation on a queue of the request;
when the current operation request is determined to be a message dequeuing request, executing a message dequeuing operation on a queue of the request;
102, generating resource linked list information of the requested queue by utilizing the determined operation, and executing the operation on the requested queue according to the generated resource linked list information; the resource linked list information characterizes the logic sequence of the resources in the queue.
Specifically, when the current operation request is a message enqueuing request, before generating the resource linked list information of the queue of the request, the method further includes: determining a target queue of the message requesting enqueuing, and distributing resources from a resource pool;
the resource linked list information of the queue for generating the request comprises: and adding a linked list of the resources distributed by the resource pool to a queue tail element linked list of the target queue.
After the resource linked list information of the queue of the request is generated, the method further comprises the following steps:
generating resource data information of the queue of the request; the resource data information characterizes the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one by one.
The generating the resource data information of the queue of the request comprises the following steps:
and storing the message requesting enqueuing into the allocated resources.
Here, the performing an operation on the queue of requests includes: and executing message enqueuing operation on the target queue according to the generated resource linked list information and the resource data information.
Specifically, each element in the queue corresponds to a resource. The queue corresponds to one queue management information, and the queue management information comprises: the number of resources, the information of the resource chain table and the information of the resource data stored in the current queue.
The management of the resources in the queue is divided into: management of resource linked list information and management of resource data information; the resource linked list information comprises information of group links and link disassembly of resources; the resource data information includes data for each resource in the queue.
For each resource, dividing the resource into a linked list and data, wherein the linked list is matched with the data one by one; the linked list is used for grouping links when queue resources are applied and disassembling links when the queue resources are recovered; the data is used for storing the message to be processed. In the processing process, the linked list is subjected to chain grouping and chain splitting to realize data management corresponding to the linked list.
Here, the resources are managed in a first-in first-out (FIFO, first Input First Output) manner, that is, when a message is enqueued, the linked list of the queue tail element is modified, and the linked list of the queue tail element needs to be linked; when the message is dequeued, modifying the linked list of the queue head element of the queue, and carrying out group chain on the linked list of the queue head element; thereby ensuring the realization of messages entering the queue according to the scene of the FIFO.
Specifically, the determining whether the message requesting for enqueuing meets the enqueuing condition includes:
Extracting a queue field from the message requesting enqueuing;
obtaining a queue relation table; the queue relationship table includes: the corresponding relation between at least one queue field and the target queue;
judging whether the queue relation table contains the extracted queue field, and if the queue relation table contains the extracted queue field, determining that the message requesting for enqueuing meets the enqueuing condition.
Specifically, before determining the target queue of the message requesting enqueuing, the method further includes:
judging whether the message requesting for enqueuing meets the enqueuing condition or not; and determining that the message requiring enqueuing meets the enqueuing condition, and determining a target queue of the message requiring enqueuing.
Here, the determining, according to the message requesting enqueuing, the target queue of the message includes:
and searching a target queue corresponding to the extracted queue field in the queue relation table.
The queue field and the target queue are key value pair relations which are preset and stored, and can be stored in a tabular mode.
It should be noted that, if the system does not respond to the application of allocating the queue resources in time, it may determine to discard the message or continue waiting for resource allocation according to the operation information; here, the operation information is preset and stored by the system according to the requirement.
Specifically, when the current operation request is a message dequeue request, the resource linked list information of the queue for generating the request includes:
and adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
Here, the performing an operation on the queue of requests includes: and executing message dequeuing operation according to the resource linked list information of the dequeue queue. And dequeuing the message of the request dequeuing from the queue head position of the dequeuing queue, and releasing the resources occupied by the message of the request dequeuing, namely finishing dequeuing the message of the request dequeuing.
Specifically, before the queue head element linked list of the dequeue corresponding to the message of the request dequeue adds the linked list of the resource corresponding to the message of the request dequeue, the method further includes:
judging whether the message requesting dequeuing meets dequeuing conditions or not; and if the message of the request dequeue meets the dequeue condition, adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
Here, the determining whether the message requesting dequeuing meets the dequeuing condition includes:
Determining a dequeue corresponding to the message requesting dequeuing, judging whether the dequeue is empty, wherein the dequeue is not empty, and if the handshake operation of the dequeue is effective, determining that the message requesting dequeuing meets the dequeuing condition.
Specifically, the method provided by the embodiment of the invention further comprises the following steps: and for enqueued messages, carrying out overtime detection on the state of resources occupied by the messages after the messages are enqueued.
Specifically, after the generating the resource linked list information of the queue of the request, the method further includes:
and starting timing from message enqueuing, determining that the enqueued message does not dequeue after exceeding the preset time, modifying the state of resources occupied by the enqueued message, and modifying the resource linked list information according to overtime operation so as to process the enqueued message.
The timeout operation includes: dequeuing the message; or directly discarding the message, releasing the resources corresponding to the message, and the like.
The state includes: idle, occupied, timeout, etc.
Here, the system holds a resource state table that is used to hold the state of each resource.
FIG. 2 is a schematic diagram of a first queue resource management device according to an embodiment of the present invention; as shown in fig. 2, the apparatus includes: the first processing module and the second processing module; wherein,
The first processing module is used for determining the operation of the queue of the request according to the current operation request;
the second processing module is used for generating resource linked list information of the request queue by utilizing the determined operation, and executing the operation on the request queue according to the generated resource linked list information; the resource linked list information characterizes the logic sequence of the resources in the queue.
Specifically, when the current operation request is a message enqueuing request, the second processing module is further configured to determine a target queue of the message requesting enqueuing, and allocate resources from a resource pool;
the second processing module is specifically configured to add a linked list of resources allocated by the resource pool to a linked list of queue tail elements of the target queue.
Specifically, the second processing module is further configured to generate resource data information of the queue of the request; the resource data information characterizes the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one by one;
the second processing module is specifically configured to store the message requesting enqueuing to an allocated resource.
Specifically, the second processing module is further configured to determine whether a message requesting for enqueuing meets an enqueuing condition; and determining that the message requiring enqueuing meets the enqueuing condition, and determining a target queue of the message requiring enqueuing.
Specifically, the second processing module is configured to extract a queue field from the message for enqueuing the request;
obtaining a queue relation table; the queue relationship table includes: the corresponding relation between at least one queue field and the target queue;
judging whether the queue relation table contains the extracted queue field, and determining that the message requesting for enqueuing meets the enqueuing condition when the queue relation table contains the extracted queue field.
Specifically, the second processing module is configured to search the target queue corresponding to the extracted queue field in the queue relation table.
Specifically, when the current operation request is a message dequeue request, the second processing module is configured to add a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
Specifically, the second processing module is configured to determine whether a message requesting dequeuing meets a dequeuing condition; and if the message of the request dequeue meets the dequeue condition, adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
Specifically, the second processing module is configured to determine a dequeue corresponding to the message requesting dequeuing, determine whether the dequeue is empty, and determine that the message requesting dequeuing meets the dequeuing condition if the dequeue is not empty and the handshake operation of the dequeue is valid.
Specifically, the device further comprises: and the third processing module is used for timing from the enqueuing of the messages, determining that the enqueued messages are not dequeued after exceeding the preset time, modifying the state of resources occupied by the enqueued messages, and modifying the resource linked list information according to the overtime operation so as to process the enqueued messages.
FIG. 3 is a schematic diagram of a second queue resource management device according to an embodiment of the present invention; as shown in fig. 3, the queue resource management device includes: the system comprises a message receiving module, a resource management module, an enqueue management module, a dequeue management module and a timeout detection module; wherein,
the message receiving module is used for receiving a message requesting enqueuing;
the resource management module is used for configuring resources according to system requirements, responding to the application of the resources and returning the resources, and processing the resources occupied by the timeout message;
The enqueue management module is used for mapping a target queue of the message requesting enqueuing according to the enqueue request of the message, determining the target queue corresponding to the message requesting enqueuing, and applying for resources from the resource pool;
the dequeue management module is used for dequeuing the message requesting dequeuing according to the dequeue request of the message and releasing the resources occupied by the message;
the overtime detection module is used for carrying out overtime detection on the message, triggering corresponding overtime operation when the message enqueuing time exceeds the preset time, releasing corresponding resources and modifying the state of the resources.
The device stores a resource state table, resource linked list information and resource data information; wherein,
the resource state table stores the state of each resource;
the resource linked list information comprises group link information and link disassembly information of a linked list of the resource;
the resource data information comprises data of each resource in the queue, and the data of the resource is used for storing messages to be processed.
Here, when the message enqueues, the corresponding resource is applied to store the resource linked list information and the resource data information.
The enqueue management module is specifically configured to determine whether a message requesting enqueuing meets an enqueuing condition when a current operation request is a message enqueuing request, determine a target queue of the message requesting enqueuing if the message requesting enqueuing meets the enqueuing condition, and request a resource management module to allocate a resource from a resource pool; after the resources allocated by the resource management module are obtained, adding a linked list of the allocated resources to a queue tail element linked list of the target queue, and storing the message requesting enqueuing into the allocated resources; and executing message enqueuing operation.
The dequeue management module is specifically configured to determine, when the current operation request is a message dequeue request, whether a message requesting dequeue meets a dequeue condition, and if the message requesting dequeue meets the dequeue condition, add a linked list of resources corresponding to the message requesting dequeue to a queue element linked list of a dequeue corresponding to the message requesting dequeue; and executing the message dequeuing operation.
FIG. 4 is a flow chart of a second queue resource management method according to an embodiment of the present invention; as shown in fig. 4, the queue resource management method includes:
step 401, initializing a system to enable the system to meet the performance requirement of the overall design;
here, the system initialization may include:
setting a FIFO mode; generating a resource state table for storing each resource state; and setting the maximum number of messages which can be stored in the queue according to the performance requirement.
Step 402, a message receiving module receives a message requesting enqueuing;
step 403, mapping a message queue;
here, assuming that the number of queues is N, when determining that a message requests for enqueuing, the enqueuing management module extracts a queue field from the message requesting for enqueuing, and searches a target queue M corresponding to the extracted queue field in the queue relation table i And (5) finishing the mapping of the message queue.
The queue relationship table includes: correspondence of at least one queue field with a target queue.
Step 404, applying for resources;
here, the enqueue management module sends resource application information to the resource management module to apply for resources; and the resource management module allocates and returns resources from the resource pool according to the resource application information. The resource pool is a collection of resources and is a queue adopting a FIFO management mode, and one resource can be directly popped out of the head of the queue and returned to the enqueue management module.
The enqueuing condition includes: the target queue matched with the message belongs to the queue in the queue relation table. For example: the system comprises a queue M1 and a queue M2 … …, wherein if a target queue matched with the message belongs to any one of the queue M1 and the queue M2 … …, the message is determined to meet the enqueuing condition, and if the target queue does not belong to any one of the queue M1 and the queue M2 … …, the message is determined not to meet the enqueuing condition.
Step 405, report Wen Rudui;
here, the enqueuing management module receives the returned resource, generates resource linked list information and resource data information of the target queue, and executes message enqueuing operation according to the resource linked list information and the resource data information.
Here, the generating resource linked list information of the target queue includes: and modifying the resource linked list information of the corresponding target queue according to the linked list of the resources, namely adding the linked list of the allocated resources to the queue tail element linked list of the target queue.
The generating the resource data information of the target queue includes: and storing the message requesting enqueuing into the allocated resources.
Step 406, dequeuing the message;
here, the message dequeue state machine polls a dequeue queue M corresponding to a message requesting dequeuing j The dequeue management module judges whether dequeue conditions are met, and if the dequeue conditions are met, a dequeue queue M is generated j And (3) releasing the resources to a resource management module according to the resource linked list information dequeue message, and the resource management module recycling and pushing the released resources into a FIFO queue of the resources.
The dequeue M is generated j The resource linked list information of (1) includes: modifying dequeue M j Resource chain table information of (i.e. in dequeue M) j Adding a linked list of resources for storing the message requesting dequeuing to the queue head element linked list.
The dequeue condition includes: the current dequeue queue is not empty and the dequeue handshake operation is active.
It should be noted that, one queue corresponds to one resource linked list information, and for the same queue, message enqueuing and message dequeuing are modified for the same resource linked list information, where the generated resource linked list information is the modified resource linked list information. Specifically, when the message is enqueued, enqueuing is carried out from the tail of the chain, and a linked list of allocated resources is added to a linked list of tail elements of the queue; when the message dequeues, dequeues from the chain head, and adds the chain table of the resource corresponding to the message in the chain table of the queue head element of the queue, thereby ensuring the first-in first-out of the message.
Step 407, detecting the state of each resource in a timeout mode, modifying the state of the resource, and performing corresponding processing;
here, the timeout detection module stores a resource status table, which is used for storing the status of each resource in the resource module; the state includes: state a, state B, state C, etc.; the state a may be an idle state, the state B may be an occupied state, and the state C may be a timeout state.
Here, the timeout detection module detects the state of each resource in real time, and modifies the state of the resource, for example: the resource is occupied, and the state of the resource is modified from an idle state to an occupied state; the occupied time of the resource exceeds the preset time, and the occupied state is modified into a timeout state and the like.
And the overtime detection module determines whether the state of the resource is legal or not according to the state of the resource and performs corresponding processing. Specifically: when a resource is applied, the timeout detection module detects that the state of the resource is idle, namely legal, and other states are illegal; when dequeuing, the overtime detection module detects that the state of the resource is an overtime state, and the overtime state of the message stored by the resource is indicated to be illegal, and the enqueued message is processed according to the preset overtime operation.
The timeout operation includes: directly dequeuing according to the normal message processing flow; extracting a certain message and dequeuing the message; or, directly discarding the message, releasing the resource, etc.
Here, the status of the resource and the operation on the messages in different states may be set according to the system requirement and the number of the resources, so as to meet the performance requirement of the system.
The overtime detection time can be set to a reasonable value according to the whole system requirement and the quantity of resources so as to meet the whole performance requirement of the system.
In order to implement the method of the embodiment of the present invention, the embodiment of the present invention provides a queue resource management device, specifically, as shown in fig. 5, the device 50 includes:
A processor 501 and a memory 502 for storing a computer program capable of running on the processor; wherein,
the processor 501 is configured to execute, when executing the computer program:
determining the operation of a queue of the requests according to the current operation request;
generating resource linked list information of the requested queue by utilizing the determined operation, and executing the operation on the requested queue according to the generated resource linked list information; the resource linked list information characterizes the logic sequence of the resources in the queue.
In an embodiment, the processor 501 is configured to execute, when executing the computer program:
when the current operation request is a message enqueuing request, determining a target queue of the message for enqueuing, and distributing resources from a resource pool; and adding a linked list of the resources distributed by the resource pool to a queue tail element linked list of the target queue.
In an embodiment, the processor 501 is configured to execute, when executing the computer program:
generating resource data information of the queue of the request; the resource data information characterizes the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one by one.
In an embodiment, the processor 501 is configured to execute, when executing the computer program:
and storing the message requesting enqueuing into the allocated resources.
In an embodiment, the processor 501 is configured to execute, when executing the computer program:
judging whether the message requesting for enqueuing meets the enqueuing condition or not; and determining that the message requiring enqueuing meets the enqueuing condition, and determining a target queue of the message requiring enqueuing.
In an embodiment, the processor 501 is configured to execute, when executing the computer program:
extracting a queue field from the message requesting enqueuing;
obtaining a queue relation table; the queue relationship table includes: the corresponding relation between at least one queue field and the target queue;
judging whether the queue relation table contains the extracted queue field, and determining that the message requesting for enqueuing meets the enqueuing condition when the queue relation table contains the extracted queue field.
In an embodiment, the processor 501 is configured to execute, when executing the computer program:
and searching a target queue corresponding to the extracted queue field in the queue relation table.
In an embodiment, the processor 501 is configured to execute, when executing the computer program:
When the current operation request is a message dequeue request, adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
In an embodiment, the processor 501 is configured to execute, when executing the computer program:
judging whether the message requesting dequeuing meets dequeuing conditions or not; and if the message of the request dequeue meets the dequeue condition, adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
In an embodiment, the processor 501 is configured to execute, when executing the computer program:
determining a dequeue corresponding to the message requesting dequeuing, judging whether the dequeue is empty, wherein the dequeue is not empty, and if the handshake operation of the dequeue is effective, determining that the message requesting dequeuing meets the dequeuing condition.
In an embodiment, the processor 501 is configured to execute, when executing the computer program:
and starting timing from message enqueuing, determining that the enqueued message does not dequeue after exceeding the preset time, modifying the state of resources occupied by the enqueued message, and modifying the resource linked list information according to overtime operation so as to process the enqueued message.
It should be noted that: the queue resource management device and the queue resource management method provided in the foregoing embodiments belong to the same concept, and specific implementation processes of the queue resource management device and the queue resource management method are detailed in the method embodiments and are not repeated herein.
Of course, in practical application, as shown in fig. 5, the apparatus 50 may further include: at least one network interface 503. The various components in the device 50 are coupled together by a bus system 504. It is to be appreciated that bus system 504 is employed to enable connected communications between these components. The bus system 504 includes a power bus, a control bus, and a status signal bus in addition to the data bus. But for clarity of illustration, the various buses are labeled as bus system 504 in fig. 5.
The number of the processors 501 may be at least one.
The network interface 503 is used for wired or wireless communication between the apparatus 50 and other devices.
The memory 502 in embodiments of the present invention is used to store various types of data to support the operation of the device 50.
The method disclosed in the above embodiment of the present invention may be applied to the processor 501 or implemented by the processor 501. The processor 501 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuitry in hardware or instructions in software in the processor 501. The processor 501 may be a general purpose processor, a digital signal processor (DSP, digital Signal Processor), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. The processor 501 may implement or perform the methods, steps and logic blocks disclosed in embodiments of the present invention. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the method disclosed in the embodiment of the invention can be directly embodied in the hardware of the decoding processor or can be implemented by combining hardware and software modules in the decoding processor. The software modules may be located in a storage medium in memory 502 and processor 501 reads information in memory 502 to perform the steps of the method described above in connection with its hardware.
In an exemplary embodiment, the queue resource management device 50 may be implemented by one or more application specific integrated circuits (ASIC, application Specific Integrated Circuit), DSPs, programmable logic devices (PLD, programmable Logic Device), complex programmable logic devices (CPLD, complex Programmable Logic Device), field-programmable gate arrays (FPGA, field-Programmable Gate Array), general purpose processors, controllers, microcontrollers (MCU, micro Controller Unit), microprocessors (Microprocessor), or other electronic components for performing the aforementioned methods.
It will be appreciated that the memory (e.g., memory 502) in embodiments of the invention can be either volatile memory or nonvolatile memory, and can include both volatile and nonvolatile memory. Wherein the nonvolatile Memory may be Read Only Memory (ROM), programmable Read Only Memory (PROM, programmable Read-Only Memory), erasable programmable Read Only Memory (EPROM, erasable Programmable Read-Only Memory), electrically erasable programmable Read Only Memory (EEPROM, electrically Erasable Programmable Read-Only Memory), magnetic random access Memory (FRAM, ferromagnetic random access Memory), flash Memory (Flash Memory), magnetic surface Memory, optical disk, or compact disk Read Only Memory (CD-ROM, compact Disc Read-Only Memory); the magnetic surface memory may be a disk memory or a tape memory. The volatile memory may be random access memory (RAM, random Access Memory), which acts as external cache memory. By way of example, and not limitation, many forms of RAM are available, such as static random access memory (SRAM, static Random Access Memory), synchronous static random access memory (SSRAM, synchronous Static Random Access Memory), dynamic random access memory (DRAM, dynamic Random Access Memory), synchronous dynamic random access memory (SDRAM, synchronous Dynamic Random Access Memory), double data rate synchronous dynamic random access memory (ddr SDRAM, double Data Rate Synchronous Dynamic Random Access Memory), enhanced synchronous dynamic random access memory (ESDRAM, enhanced Synchronous Dynamic Random Access Memory), synchronous link dynamic random access memory (SLDRAM, syncLink Dynamic Random Access Memory), direct memory bus random access memory (DRRAM, direct Rambus Random Access Memory). The memory described by embodiments of the present invention is intended to comprise, without being limited to, these and any other suitable types of memory.
In an exemplary embodiment, the present invention also provides a computer readable storage medium, such as a memory 502 including a computer program executable by the processor 501 of the queue resource management device 50 to perform the steps described in the foregoing method.
In particular, embodiments of the present invention provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs:
determining the operation of a queue of the requests according to the current operation request;
generating resource linked list information of the requested queue by utilizing the determined operation, and executing the operation on the requested queue according to the generated resource linked list information; the resource linked list information characterizes the logic sequence of the resources in the queue.
In one embodiment, the computer program, when executed by a processor, performs:
when the current operation request is a message enqueuing request, determining a target queue of the message for enqueuing, and distributing resources from a resource pool; and adding a linked list of the resources distributed by the resource pool to a queue tail element linked list of the target queue.
In one embodiment, the computer program, when executed by a processor, performs:
Generating resource data information of the queue of the request; the resource data information characterizes the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one by one.
In one embodiment, the computer program, when executed by a processor, performs:
and storing the message requesting enqueuing into the allocated resources.
In one embodiment, the computer program, when executed by a processor, performs:
judging whether the message requesting for enqueuing meets the enqueuing condition or not; and determining that the message requiring enqueuing meets the enqueuing condition, and determining a target queue of the message requiring enqueuing.
In one embodiment, the computer program, when executed by a processor, performs:
extracting a queue field from the message requesting enqueuing;
obtaining a queue relation table; the queue relationship table includes: the corresponding relation between at least one queue field and the target queue;
judging whether the queue relation table contains the extracted queue field, and determining that the message requesting for enqueuing meets the enqueuing condition when the queue relation table contains the extracted queue field.
In one embodiment, the computer program, when executed by a processor, performs:
And searching a target queue corresponding to the extracted queue field in the queue relation table.
In one embodiment, the computer program, when executed by a processor, performs:
when the current operation request is a message dequeue request, adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
In one embodiment, the computer program, when executed by a processor, performs:
judging whether the message requesting dequeuing meets dequeuing conditions or not; and if the message of the request dequeue meets the dequeue condition, adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
In one embodiment, the computer program, when executed by a processor, performs:
determining a dequeue corresponding to the message requesting dequeuing, judging whether the dequeue is empty, wherein the dequeue is not empty, and if the handshake operation of the dequeue is effective, determining that the message requesting dequeuing meets the dequeuing condition.
In one embodiment, the computer program, when executed by a processor, performs:
And starting timing from message enqueuing, determining that the enqueued message does not dequeue after exceeding the preset time, modifying the state of resources occupied by the enqueued message, and modifying the resource linked list information according to overtime operation so as to process the enqueued message.
It should be noted that: the computer readable storage medium provided by the embodiment of the invention can be FRAM, ROM, PROM, EPROM, EEPROM, flash Memory, magnetic surface Memory, optical disk, CD-ROM or other Memory; but may be a variety of devices including one or any combination of the above memories.
The above description is not intended to limit the scope of the invention, but is intended to cover any modifications, equivalents, and improvements within the spirit and principles of the invention.
Claims (20)
1. A method of queue resource management, the method comprising:
determining the operation of a queue of the requests according to the current operation request;
generating resource linked list information of the requested queue by utilizing the determined operation, and executing the operation on the requested queue according to the generated resource linked list information; the resource linked list information characterizes the logic sequence of the resources in the queue;
Wherein after the generating the resource linked list information of the queue of the request, the method further comprises:
starting timing from message enqueuing, determining that the enqueued message is not dequeued after exceeding a preset time, modifying the state of resources occupied by the enqueued message, and modifying the resource linked list information according to overtime operation, wherein the overtime operation is selected from one of dequeuing the message, directly discarding the message and releasing the resources corresponding to the message, and the state is selected from one of idle, occupied and overtime;
after the resource linked list information of the queue of the request is generated, the method further comprises the following steps: generating resource data information of the queue of the request; the resource data information characterizes the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one by one.
2. The method of claim 1, wherein when the current operation request is a message enqueue request, before generating the resource linked list information of the queue of the request, the method further comprises: determining a target queue of the message requesting enqueuing, and distributing resources from a resource pool;
The resource linked list information of the queue for generating the request comprises: and adding a linked list of the allocated resources to a linked list of the queue tail elements of the target queue.
3. The method of claim 2, wherein the step of determining the position of the substrate comprises,
the generating the resource data information of the queue of the request includes: and storing the message requesting enqueuing into the allocated resources.
4. The method of claim 2, wherein prior to determining the target queue for the message requesting enqueuing, the method further comprises:
judging whether the message requesting for enqueuing meets the enqueuing condition or not; and determining that the message requiring enqueuing meets the enqueuing condition, and determining a target queue of the message requiring enqueuing.
5. The method of claim 4, wherein determining whether the message requesting enqueuing satisfies an enqueue condition comprises:
extracting a queue field from the message requesting enqueuing;
obtaining a queue relation table; the queue relationship table includes: the corresponding relation between at least one queue field and the target queue;
judging whether the queue relation table contains the extracted queue field, and determining that the message requesting for enqueuing meets the enqueuing condition when the queue relation table contains the extracted queue field.
6. The method of claim 5, wherein determining the target queue of the message based on the message requesting enqueuing comprises:
and searching a target queue corresponding to the extracted queue field in the queue relation table.
7. The method of claim 1, wherein when the current operation request is a message dequeue request, the generating resource link list information of the queue of the request includes:
and adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
8. The method of claim 7, wherein before the list of queue head elements of the dequeue corresponding to the message requesting dequeuing adds the list of resources corresponding to the message requesting dequeuing, the method further comprises:
judging whether the message requesting dequeuing meets dequeuing conditions or not; and if the message of the request dequeue meets the dequeue condition, adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
9. The method of claim 8, wherein determining whether the dequeued message satisfies a dequeue condition comprises:
Determining a dequeue corresponding to the message requesting dequeuing, judging whether the dequeue is empty, wherein the dequeue is not empty, and if the handshake operation of the dequeue is effective, determining that the message requesting dequeuing meets the dequeuing condition.
10. A queue resource management device, the device comprising: the first processing module and the second processing module; wherein,
the first processing module is used for determining the operation of the queue of the request according to the current operation request;
the second processing module is used for generating resource linked list information of the request queue by utilizing the determined operation, and executing the operation on the request queue according to the generated resource linked list information; the resource linked list information characterizes the logic sequence of the resources in the queue;
wherein the apparatus further comprises: the third processing module is used for timing from the enqueuing of the messages, determining that the enqueued messages are not dequeued after exceeding the preset time, modifying the state of resources occupied by the enqueued messages, and modifying the resource linked list information according to overtime operation, wherein the overtime operation is selected from one of dequeuing the messages, directly discarding the messages and releasing the resources corresponding to the messages, and the state is selected from one of idle state, occupied state and overtime state;
The second processing module is further configured to generate resource data information of the requested queue; the resource data information characterizes the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one by one.
11. The apparatus of claim 10, wherein when the current operation request is a message enqueue request, the second processing module is further configured to determine a target queue of the message requesting enqueue, and allocate resources from a resource pool;
the second processing module is specifically configured to add a linked list of allocated resources to a linked list of queue tail elements of the target queue.
12. The apparatus of claim 11, wherein the device comprises a plurality of sensors,
the second processing module is specifically configured to store the message requesting enqueuing to an allocated resource.
13. The apparatus of claim 11, wherein the second processing module is further configured to determine whether a message requesting enqueuing satisfies an enqueuing condition; and determining that the message requiring enqueuing meets the enqueuing condition, and determining a target queue of the message requiring enqueuing.
14. The apparatus of claim 13, wherein the second processing module is configured to extract a queue field from the message requesting enqueuing;
Obtaining a queue relation table; the queue relationship table includes: the corresponding relation between at least one queue field and the target queue;
judging whether the queue relation table contains the extracted queue field, and determining that the message requesting for enqueuing meets the enqueuing condition when the queue relation table contains the extracted queue field.
15. The apparatus of claim 14, wherein the second processing module is configured to look up a target queue corresponding to the extracted queue field in the queue relationship table.
16. The apparatus of claim 10, wherein when the current operation request is a message dequeue request, the second processing module is configured to add a linked list of resources corresponding to the message requesting dequeue to a head element linked list of a dequeue corresponding to the message requesting dequeue.
17. The apparatus of claim 16, wherein the second processing module is configured to determine whether a dequeue request message satisfies a dequeue condition; and if the message of the request dequeue meets the dequeue condition, adding a linked list of resources corresponding to the message of the request dequeue to a queue head element linked list of a dequeue corresponding to the message of the request dequeue.
18. The apparatus of claim 17, wherein the second processing module is configured to determine a dequeue corresponding to the message requesting dequeuing, determine whether the dequeue is empty, the dequeue is not empty, and if a handshake operation of the dequeue is valid, determine that the message requesting dequeuing satisfies the dequeue condition.
19. A queue resource management device, comprising: a processor and a memory for storing a computer program capable of running on the processor,
wherein the processor is adapted to perform the steps of the method of any of claims 1 to 9 when the computer program is run.
20. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method according to any one of claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710801895.2A CN109474543B (en) | 2017-09-07 | 2017-09-07 | Queue resource management method, device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710801895.2A CN109474543B (en) | 2017-09-07 | 2017-09-07 | Queue resource management method, device and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109474543A CN109474543A (en) | 2019-03-15 |
CN109474543B true CN109474543B (en) | 2023-11-14 |
Family
ID=65658388
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710801895.2A Active CN109474543B (en) | 2017-09-07 | 2017-09-07 | Queue resource management method, device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109474543B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101217499A (en) * | 2008-01-21 | 2008-07-09 | 中兴通讯股份有限公司 | Array dispatching method |
US7782885B1 (en) * | 2002-12-10 | 2010-08-24 | Cisco Technology, Inc. | System and method for queue management using queue sets |
CN103543954A (en) * | 2012-07-16 | 2014-01-29 | 中兴通讯股份有限公司 | Data storage management method and device |
CN106302238A (en) * | 2015-05-13 | 2017-01-04 | 深圳市中兴微电子技术有限公司 | A kind of queue management method and device |
-
2017
- 2017-09-07 CN CN201710801895.2A patent/CN109474543B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7782885B1 (en) * | 2002-12-10 | 2010-08-24 | Cisco Technology, Inc. | System and method for queue management using queue sets |
CN101217499A (en) * | 2008-01-21 | 2008-07-09 | 中兴通讯股份有限公司 | Array dispatching method |
CN103543954A (en) * | 2012-07-16 | 2014-01-29 | 中兴通讯股份有限公司 | Data storage management method and device |
CN106302238A (en) * | 2015-05-13 | 2017-01-04 | 深圳市中兴微电子技术有限公司 | A kind of queue management method and device |
Also Published As
Publication number | Publication date |
---|---|
CN109474543A (en) | 2019-03-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8381230B2 (en) | Message passing with queues and channels | |
CN113918101B (en) | Method, system, equipment and storage medium for writing data cache | |
US9378047B1 (en) | Efficient communication of interrupts from kernel space to user space using event queues | |
CN101150488B (en) | A receiving method for zero copy network packet | |
CN109726005B (en) | Method, server system and computer readable medium for managing resources | |
CN111324427B (en) | Task scheduling method and device based on DSP | |
US8996774B2 (en) | Performing emulated message signaled interrupt handling | |
US9413358B2 (en) | Forward counter block | |
CN111290979B (en) | Data transmission method, device and system | |
CN112650558B (en) | Data processing method and device, readable medium and electronic equipment | |
CN113010297A (en) | Database write scheduler based on message queue, write method and storage medium | |
CN111190854A (en) | Communication data processing method, device, equipment, system and storage medium | |
US20150134883A1 (en) | Method and system for communicating with non-volatile memory via multiple data paths | |
CN114661414A (en) | Computing system, memory page fault processing method and storage medium | |
CN112698959A (en) | Multi-core communication method and device | |
CN115964319A (en) | Data processing method for remote direct memory access and related product | |
CN112491426A (en) | Service assembly communication architecture and task scheduling and data interaction method facing multi-core DSP | |
US8543722B2 (en) | Message passing with queues and channels | |
CN103823712A (en) | Data flow processing method and device for multi-CPU virtual machine system | |
US10095643B2 (en) | Direct memory access control device for at least one computing unit having a working memory | |
CN106537321B (en) | Method, device and storage system for accessing file | |
CN109474543B (en) | Queue resource management method, device and storage medium | |
CN114860460B (en) | Database acceleration method and device and computer equipment | |
WO2022199560A1 (en) | Memory management method and device | |
WO2017070869A1 (en) | Memory configuration method, apparatus and system |
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 |