CN109474543A - A kind of queue resource management method, device and storage medium - Google Patents

A kind of queue resource management method, device and storage medium Download PDF

Info

Publication number
CN109474543A
CN109474543A CN201710801895.2A CN201710801895A CN109474543A CN 109474543 A CN109474543 A CN 109474543A CN 201710801895 A CN201710801895 A CN 201710801895A CN 109474543 A CN109474543 A CN 109474543A
Authority
CN
China
Prior art keywords
queue
resource
linked list
enqueuing
dequeue
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201710801895.2A
Other languages
Chinese (zh)
Other versions
CN109474543B (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.)
Shenzhen ZTE Microelectronics Technology Co Ltd
Original Assignee
Shenzhen ZTE Microelectronics Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen ZTE Microelectronics Technology Co Ltd filed Critical Shenzhen ZTE Microelectronics Technology Co Ltd
Priority to CN201710801895.2A priority Critical patent/CN109474543B/en
Publication of CN109474543A publication Critical patent/CN109474543A/en
Application granted granted Critical
Publication of CN109474543B publication Critical patent/CN109474543B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Telephonic Communication Services (AREA)
  • Multi Processors (AREA)

Abstract

The invention discloses a kind of queue resource management methods, comprising: according to current operation requests, determines the operation of the queue to request;Using determining operation, the resource link table information of the queue of the request is generated, the operation of the queue to the request is executed according to the resource link table information of generation;The logical order of the resource chained list information representation resource in the queue.The invention also discloses a kind of queue resource managing device and storage mediums.

Description

Queue resource management method, device and storage medium
Technical Field
The present invention relates to queue management technologies in the field of communications, and in particular, to a queue resource management method, an apparatus, and a storage medium.
Background
The in-out management and timeout detection of messages is a common and major function in communication systems. With the continuous improvement of data service requirements, consumers have higher requirements on the service quality of data products; with the continuous improvement of data flow, 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 management performance of the queues are higher and higher.
For queue resource management, most of the existing methods use a form of pointer group, and the methods have limitations on full utilization of resources and low resource utilization rate.
In addition, for timeout detection, at present, there is no scenario of performing timeout detection on queue resource management, and only the hardware queue state is subjected to timeout detection, so that hardware resources required for timeout detection of the hardware queue state are more, and along with the improvement of performance requirements, the complexity of hardware is also improved.
Disclosure of Invention
In order to solve the existing technical problem, embodiments of the present invention provide a queue resource management method, an apparatus, 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 request queue according to the current operation request;
generating resource linked list information of the requested queue by using 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 logical order of the resources in the queue.
In the foregoing solution, when the current operation request is a packet enqueue request, and before the resource chain table information of the queue of the request is generated, the method further includes: determining a target queue of the message requesting for enqueuing, and allocating resources from a resource pool;
the resource linked list information of the queue generating the request includes: and adding a linked list of the distributed resources in the tail element linked list of the target queue.
In the foregoing solution, after generating the resource linked list information of the requested queue, the method further includes: generating resource data information of the requested queue; the resource data information represents the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one to one;
the resource data information of the queue generating the request comprises: and storing the message requesting for enqueuing in the allocated resources.
In the foregoing solution, before determining the target queue of the message requesting to be enqueued, the method further includes:
judging whether the message requesting for enqueuing meets the enqueuing condition; and determining a target queue of the message requesting for enqueuing if the message requesting for enqueuing meets the enqueuing condition.
In the foregoing solution, the determining whether the message requesting for enqueuing meets an enqueuing condition includes:
extracting a queue field from the message requesting for enqueuing;
acquiring a queue relation table; the queue relationship table includes: a correspondence of at least one queue field to a target queue;
and judging whether the queue relation table contains the extracted queue field, and when the queue relation table contains the extracted queue field, determining that the message requesting for enqueuing meets enqueuing conditions.
In the above scheme, the determining a target queue of the packet according to the packet requesting for enqueuing includes:
and searching 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 resource chain table information of the queue generating the request includes:
and adding a linked list of resources corresponding to the dequeuing-requested message to a head element linked list of the dequeuing queue corresponding to the dequeuing-requested message.
In the foregoing solution, before adding the linked list of the resource corresponding to the dequeue requested packet to the head element linked list of the dequeue queue corresponding to the dequeue requested packet, the method further includes:
judging whether the message requesting dequeuing meets a dequeuing condition or not; and if the message requesting dequeuing meets the dequeuing condition, adding a linked list of resources corresponding to the message requesting dequeuing to a head element linked list of a dequeuing queue corresponding to the message requesting dequeuing.
In the foregoing solution, the determining whether the message requesting dequeuing meets a dequeuing condition includes:
determining a dequeue queue corresponding to the message requesting dequeue, and judging whether the dequeue queue is empty or not, if the dequeue queue is not empty and the handshake operation of the dequeue queue is effective, determining that the message requesting dequeue meets the dequeue condition.
In the foregoing solution, after generating the resource linked list information of the requested queue, the method further includes:
timing from the beginning of message enqueuing, determining that the enqueued messages are not dequeued after the enqueued messages exceed the preset time, modifying the state of resources occupied by the enqueued messages, and modifying the resource linked list information according to overtime operation so as to process the enqueued messages.
An embodiment of the present invention further provides a queue resource management device, where the device includes: the device comprises a first processing module and a second processing module; wherein,
the first processing module is used for determining the operation of the request queue according to the current operation request;
the second processing module is configured to generate resource chain table information of the requested queue by using the determined operation, and execute an operation on the requested queue according to the generated resource chain table information; the resource linked list information characterizes the logical order of the resources in the queue.
In the above scheme, 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 for enqueue, and allocate resources from a resource pool;
the second processing module is specifically configured to add a linked list of the allocated resources to the tail element linked list of the target queue.
In the foregoing solution, the second processing module is further configured to generate resource data information of the requested queue; the resource data information represents the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one to one;
the second processing module is specifically configured to store the message requesting for enqueuing in the 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 a target queue of the message requesting for enqueuing if the message requesting for enqueuing meets the enqueuing condition.
In the above scheme, the second processing module is configured to extract a queue field from the message requesting for enqueuing;
acquiring a queue relation table; the queue relationship table includes: a correspondence of at least one queue field to a target queue;
and judging whether the queue relation table contains the extracted queue field, and when the queue relation table contains the extracted queue field, determining that the message requesting for enqueuing meets enqueuing conditions.
In the foregoing solution, the second processing module is configured to search the target queue corresponding to the extracted queue field in the queue relationship table.
In the above scheme, 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 dequeue-requested message to a head-of-line element linked list of a dequeue queue corresponding to the dequeue-requested message.
In the above scheme, the second processing module is configured to determine whether a message requesting dequeuing meets a dequeuing condition; and if the message requesting dequeuing meets the dequeuing condition, adding a linked list of resources corresponding to the message requesting dequeuing to a head element linked list of a dequeuing queue corresponding to the message requesting dequeuing.
In the above scheme, the second processing module is configured to determine a dequeue queue corresponding to the dequeue-requested message, determine whether the dequeue queue is empty, determine that the dequeue queue is not empty, and determine that the dequeue-requested message satisfies the dequeue condition if a handshake operation of the dequeue queue is valid.
In the above scheme, the apparatus further comprises: and the third processing module is used for timing from the beginning of message enqueuing, determining that the enqueued messages are not dequeued after the enqueued messages exceed the preset time, modifying the state of resources occupied by the enqueued messages, and modifying the resource linked list information according to overtime operation so as to process the enqueued messages.
An embodiment of the present invention further provides a queue resource management device, including: a processor and a memory for storing a computer program capable of running on the processor,
wherein the processor is configured to execute any of the above steps of the queue resource management method when running the computer program.
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of any one of the above queue resource management methods.
According to the queue resource management method, the queue resource management device and the storage medium provided by the embodiment of the invention, the operation on the queue of the request is determined according to the current operation request; generating resource linked list information of the requested queue by using 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 logical order 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 dequeue management and enqueue management of the message by adopting a chain grouping mode, and improve the processing efficiency of the resources.
In addition, according to the scheme of the embodiment of the invention, the time is counted from the time of message queuing, the enqueued message is determined not to be dequeued after the time of the enqueued message exceeds the preset time, the state of the resource occupied by the enqueued message is modified, the resource linked list information is modified according to the overtime operation so as to be used for processing the enqueued message, the overtime detection method is provided, the state of the resource is monitored, the resource linked list information is modified according to the overtime operation on the overtime resource, the resource is recovered in time, the utilization rate of the resource is improved, and the performance of the whole system is improved.
Drawings
In the drawings, which are not necessarily drawn to scale, like reference numerals may describe similar components in different views. The drawings illustrate generally, by way of example, but not by way of limitation, various embodiments discussed herein.
Fig. 1 is a flowchart illustrating a first queue resource management method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a first queue resource management device according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a second queue resource management device according to an embodiment of the present invention;
fig. 4 is a flowchart illustrating a second method for queue resource management according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of a third queue resource management device according to an embodiment of the present invention.
Detailed Description
In various embodiments of the present invention, operations to a queue of requests are determined based on a current operation request; generating resource linked list information of the requested queue by using 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 logical order of the resources in the queue.
The present invention will be described in further detail with reference to examples.
Fig. 1 is a flowchart illustrating 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 request queue according to a current operation request;
here, the operation request includes: a message enqueue request and a message dequeue request;
when the current operation request is determined to be a message enqueue request, executing message enqueue operation on a request queue;
when the current operation request is determined to be a message dequeue request, message dequeue operation is performed on a request queue;
102, generating resource chain table information of the requested queue by using the determined operation, and executing the operation on the requested queue according to the generated resource chain table information; the resource linked list information characterizes the logical order of the resources in the queue.
Specifically, when the current operation request is a message enqueue request and before the resource linked list information of the queue of the generation request, the method further includes: determining a target queue of the message requesting for enqueuing, and allocating resources from a resource pool;
the resource linked list information of the queue generating the request includes: and adding a linked list of the resources distributed by the resource pool to the queue tail element linked list of the target queue.
After the resource chain table information of the queue of the request is generated, the method further includes:
generating resource data information of the requested queue; the resource data information represents the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one to one.
The resource data information of the queue generating the request comprises:
and storing the message requesting for enqueuing in the allocated resources.
Here, the performing the operation on the queue of the request includes: and executing message enqueue 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 is corresponding to a queue management message, and the queue management message includes: the number of resources stored in the current queue, the resource linked list information and the resource data information.
The management of resources in the queue is divided into: managing resource linked list information and managing resource data information; the resource linked list information comprises information of group links and link removal 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 and the data are matched one by one; the linked list is used for grouping the links when applying for the queue resources and disassembling the links when recycling the queue resources; and the data is used for storing the messages to be processed. And in the processing process, the data management corresponding to the linked list is realized by grouping and splitting the linked list.
Here, the resources are managed in a First-in First-out (FIFO) manner, that is, when a message is enqueued, the linked list of the queue tail elements of the queue is modified, and a group link needs to be performed on the linked list of the queue tail elements; when the message is dequeued, modifying a linked list of head-of-line elements of the queue, and performing chain grouping on the linked list of the head-of-line elements; therefore, the realization of messages entering the queue according to the FIFO scene is ensured.
Specifically, the determining whether the message requesting for enqueuing meets an enqueuing condition includes:
extracting a queue field from the message requesting for enqueuing;
acquiring a queue relation table; the queue relationship table includes: a correspondence of at least one queue field to a target queue;
and judging whether the queue relation table contains the extracted queue field or not, and if so, determining that the message requesting for enqueuing meets the enqueuing condition.
Specifically, before determining the target queue of the message requesting to be enqueued, the method further includes:
judging whether the message requesting for enqueuing meets the enqueuing condition; and determining a target queue of the message requesting for enqueuing if the message requesting for enqueuing meets the enqueuing condition.
Here, the determining a target queue of the packet according to the packet requesting for enqueuing includes:
and searching the target queue corresponding to the extracted queue field in the queue relation table.
The queue field and the target queue are in a preset and stored key-value pair relationship, and can be stored in a table mode.
It should be noted that if the system does not respond to the application for allocating the queue resource in time, it may determine to discard the packet or continue to wait 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 generating the request includes:
and adding a linked list of resources corresponding to the dequeuing-requested message to a head element linked list of the dequeuing queue corresponding to the dequeuing-requested message.
Here, the performing the operation on the queue of the request includes: and executing the dequeuing operation of the message according to the resource linked list information of the dequeuing queue. And the message requesting dequeuing is dequeued from the head position of the dequeuing queue, and the resource occupied by the message requesting dequeuing is released, namely the dequeuing of the message requesting dequeuing is completed.
Specifically, before adding the linked list of the resource corresponding to the dequeue requested packet to the head element linked list of the dequeue queue corresponding to the dequeue requested packet, the method further includes:
judging whether the message requesting dequeuing meets a dequeuing condition or not; and if the message requesting dequeuing meets the dequeuing condition, adding a linked list of resources corresponding to the message requesting dequeuing to a head element linked list of a dequeuing queue corresponding to the message requesting dequeuing.
Here, the determining whether the message requesting dequeuing satisfies a dequeuing condition includes:
determining a dequeue queue corresponding to the message requesting dequeue, and judging whether the dequeue queue is empty or not, if the dequeue queue is not empty and the handshake operation of the dequeue queue is effective, determining that the message requesting dequeue meets the dequeue condition.
Specifically, the method provided by the embodiment of the present invention further includes: and for the enqueued messages, after the enqueued messages, performing overtime detection on the states of the resources occupied by the messages.
Specifically, after generating the resource linked list information of the requested queue, the method further includes:
timing from the beginning of message enqueuing, determining that the enqueued messages are not dequeued after the enqueued messages exceed the preset time, modifying the state of resources occupied by the enqueued messages, and modifying the resource linked list information according to overtime operation so as to process the enqueued messages.
The timeout operation includes: dequeuing the message; or directly discarding the message, releasing the resource corresponding to the message, and the like.
The state, comprising: idle, occupied, timeout, etc.
Here, the system holds a resource state table for holding the state of each resource.
Fig. 2 is a schematic structural 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 device comprises a first processing module and a second processing module; wherein,
the first processing module is used for determining the operation of the request queue according to the current operation request;
the second processing module is configured to generate resource chain table information of the requested queue by using the determined operation, and execute an operation on the requested queue according to the generated resource chain table information; the resource linked list information characterizes the logical order of the resources in the queue.
Specifically, 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 for enqueue, and allocate resources from a resource pool;
and the second processing module is specifically configured to add the linked list of the resources allocated by the resource pool to the queue tail element linked list of the target queue.
Specifically, the second processing module is further configured to generate resource data information of the requested queue; the resource data information represents the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one to one;
the second processing module is specifically configured to store the message requesting for enqueuing in the allocated resource.
Specifically, the second processing module is further configured to determine whether a message requesting for enqueuing meets an enqueuing condition; and determining a target queue of the message requesting for enqueuing if the message requesting for enqueuing meets the enqueuing condition.
Specifically, the second processing module is configured to extract a queue field from the message requesting for enqueuing;
acquiring a queue relation table; the queue relationship table includes: a correspondence of at least one queue field to a target queue;
and judging whether the queue relation table contains the extracted queue field, and when the queue relation table contains the extracted queue field, determining that the message requesting for enqueuing meets enqueuing conditions.
Specifically, the second processing module is configured to search the target queue corresponding to the extracted queue field in the queue relationship 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 dequeue-requested message to a head-of-line element linked list of a dequeue queue corresponding to the dequeue-requested message.
Specifically, the second processing module is configured to determine whether a message requesting dequeuing meets a dequeue condition; and if the message requesting dequeuing meets the dequeuing condition, adding a linked list of resources corresponding to the message requesting dequeuing to a head element linked list of a dequeuing queue corresponding to the message requesting dequeuing.
Specifically, the second processing module is configured to determine a dequeue queue corresponding to the dequeue-requested message, determine whether the dequeue queue is empty, determine that the dequeue queue is not empty, and determine that the dequeue-requested message satisfies the dequeue condition if the handshake operation of the dequeue queue is valid.
Specifically, the apparatus further comprises: and the third processing module is used for timing from the beginning of message enqueuing, determining that the enqueued messages are not dequeued after the enqueued messages exceed the preset time, modifying the state of resources occupied by the enqueued messages, and modifying the resource linked list information according to overtime operation so as to process the enqueued messages.
Fig. 3 is a schematic structural 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 apparatus includes: the system comprises a message receiving module, a resource management module, an enqueue management module, an dequeue management module and an overtime detection module; wherein,
the message receiving module is used for receiving a message requesting for enqueuing;
the resource management module is used for configuring resources according to system requirements, responding to resource application and resource return, and processing resources occupied by overtime messages;
the enqueue management module is used for mapping a target queue of a message requesting for enqueue according to an enqueue request of the message, determining the target queue corresponding to the message requesting for enqueue, and applying for resources from a resource pool;
the dequeue management module is used for dequeuing the message requested to be dequeued according to the dequeue request of the message and releasing the resource occupied by the message;
and the overtime detection module is used for carrying out overtime detection on the message, and triggering corresponding overtime operation to release corresponding resources and modify the state of the resources when the enqueue time of the message exceeds the preset time.
The device stores a resource state table, resource linked list information and resource data information; wherein,
the resource state table stores the states of all resources;
the resource linked list information comprises group link information and link disassembly information of linked lists of resources;
the resource data information comprises data of each resource in the queue, and the data of the resource is used for storing messages needing to be processed.
Here, when the message is enqueued, the corresponding resource is applied to store the resource linked list information and the resource data information.
Specifically, the enqueue management module is specifically configured to, when determining that the current operation request is a message enqueue request, determine whether a message requesting for enqueue meets an enqueue condition, determine that the message requesting for enqueue meets the enqueue condition, determine a target queue of the message requesting for enqueue, and request the resource management module to allocate resources from a resource pool; after the resources distributed by the resource management module are obtained, adding a linked list of the distributed resources in a linked list of elements at the tail of the target queue, and storing the message requesting for enqueuing in the distributed resources; and executing message enqueue operation.
Specifically, the dequeue management module is specifically configured to determine whether a dequeue-requested message meets a dequeue condition when the current operation request is a message dequeue request, determine that the dequeue-requested message meets the dequeue condition, and add a linked list of resources corresponding to the dequeue-requested message to a head element linked list of a dequeue queue corresponding to the dequeue-requested message; and executing the dequeue operation of the message.
Fig. 4 is a flowchart illustrating a second method for queue resource management 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 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 the states of all the resources; and setting the maximum number of the messages which can be stored in the queue according to the performance requirement.
Step 402, a message receiving module receives a message requesting for enqueuing;
step 403, message queue mapping;
here, assuming that the number of queues is N, when determining that a message requests to be enqueued, the enqueue management module extracts a queue field from the message requesting to be enqueued, and searches a target queue M corresponding to the extracted queue field in a queue relation tableiAnd completing message queue mapping.
The queue relationship table includes: a correspondence of at least one queue field to 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 the resource; 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, is a queue adopting an FIFO management mode, and can directly pop up a resource from the head of the queue and return the resource to the enqueue management module.
The enqueuing condition comprises: and 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 queues M1 and M2 … …, the message is determined to meet the enqueue condition, and if the target queue does not belong to any one of the queues M1 and M2 … …, the message is determined not to meet the enqueue condition.
Step 405, enqueuing the message;
here, the enqueue management module receives the returned resource, generates resource linked list information and resource data information of the target queue, and executes message enqueue 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 distributed resources in the tail element linked list of the target queue.
The generating resource data information of the target queue includes: and storing the message requesting for enqueuing in the allocated resources.
Step 406, dequeuing the message;
here, the message dequeue state machine polls a dequeue queue M corresponding to a message requesting dequeuejThe dequeue management module judges whether the dequeue condition is met, and if the dequeue condition is met, the dequeue queue M is generatedjAccording to the dequeue message of the resource linked list information, releasing the resource to the resource management module, and the resource management module recycles and presses the released resource into an FIFO queue of the resource.
The generating of the dequeue queue MjThe resource chain table information of (a),the method comprises the following steps: modifying dequeue queue MjResource chain table information of, i.e. in, the dequeue queue MjAnd adding a linked list for storing the resource of 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 valid.
It should be noted that one queue corresponds to one resource linked list information, and for the same queue, the message enqueuing and the message dequeuing are modified for the same resource linked list information, and the generated resource linked list information is the modified resource linked list information. Specifically, when a message is enqueued, enqueuing from the tail of the chain, and adding a linked list of the distributed resources in a linked list of a queue tail element of the queue; when the message is dequeued, dequeuing from the head of the chain, and adding the linked list of the resource corresponding to the message in the linked list of the head element of the queue, thereby ensuring the first-in first-out of the message.
407, detecting the state of each resource overtime, modifying the state of the resource and performing corresponding processing;
here, the timeout detection module stores a resource state table, configured to store a state of each resource in the resource module; the state, comprising: 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: if the resource is occupied, 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, the method comprises the following steps: when applying for resources, the overtime detection module detects that the state of the resources is an idle state, namely legal, and other states are illegal; when dequeuing the queue, the overtime detection module detects that the state of the resource is an overtime state, which indicates that the message stored by the resource is overtime and illegal, and processes the enqueued message according to preset overtime operation.
The timeout operation includes: directly dequeuing according to a normal message processing flow; extracting a certain message and dequeuing the message; or directly discarding the message, releasing the resources and the like.
Here, the states of the resources and the operations on the messages in different states may be set according to the system requirements and the number of the resources, so as to meet the performance requirements 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 overall performance requirement of the system.
To implement the method according to the embodiment of the present invention, an embodiment of the present invention provides a queue resource management device, and specifically, as shown in fig. 5, the device 50 includes:
a processor 501 and a memory 502 for storing computer programs executable on the processor; wherein,
the processor 501 is configured to, when running the computer program, perform:
determining the operation of a request queue according to the current operation request;
generating resource linked list information of the requested queue by using 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 logical order of the resources in the queue.
In an embodiment, the processor 501 is configured to execute, when running the computer program, the following steps:
when the current operation request is a message enqueue request, determining a target queue of the message requesting for enqueue, and allocating resources from a resource pool; and adding a linked list of the resources distributed by the resource pool to the queue tail element linked list of the target queue.
In an embodiment, the processor 501 is configured to execute, when running the computer program, the following steps:
generating resource data information of the requested queue; the resource data information represents the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one to one.
In an embodiment, the processor 501 is configured to execute, when running the computer program, the following steps:
and storing the message requesting for enqueuing in the allocated resources.
In an embodiment, the processor 501 is configured to execute, when running the computer program, the following steps:
judging whether the message requesting for enqueuing meets the enqueuing condition; and determining a target queue of the message requesting for enqueuing if the message requesting for enqueuing meets the enqueuing condition.
In an embodiment, the processor 501 is configured to execute, when running the computer program, the following steps:
extracting a queue field from the message requesting for enqueuing;
acquiring a queue relation table; the queue relationship table includes: a correspondence of at least one queue field to a target queue;
and judging whether the queue relation table contains the extracted queue field, and when the queue relation table contains the extracted queue field, determining that the message requesting for enqueuing meets enqueuing conditions.
In an embodiment, the processor 501 is configured to execute, when running the computer program, the following steps:
and searching the target queue corresponding to the extracted queue field in the queue relation table.
In an embodiment, the processor 501 is configured to execute, when running the computer program, the following steps:
and when the current operation request is a message dequeuing request, adding a linked list of resources corresponding to the dequeuing-requested message to a head element linked list of a dequeuing queue corresponding to the dequeuing-requested message.
In an embodiment, the processor 501 is configured to execute, when running the computer program, the following steps:
judging whether the message requesting dequeuing meets a dequeuing condition or not; and if the message requesting dequeuing meets the dequeuing condition, adding a linked list of resources corresponding to the message requesting dequeuing to a head element linked list of a dequeuing queue corresponding to the message requesting dequeuing.
In an embodiment, the processor 501 is configured to execute, when running the computer program, the following steps:
determining a dequeue queue corresponding to the message requesting dequeue, and judging whether the dequeue queue is empty or not, if the dequeue queue is not empty and the handshake operation of the dequeue queue is effective, determining that the message requesting dequeue meets the dequeue condition.
In an embodiment, the processor 501 is configured to execute, when running the computer program, the following steps:
timing from the beginning of message enqueuing, determining that the enqueued messages are not dequeued after the enqueued messages exceed the preset time, modifying the state of resources occupied by the enqueued messages, and modifying the resource linked list information according to overtime operation so as to process the enqueued messages.
It should be noted that: the embodiments of 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 thereof are described in the embodiments of the methods for details, and are not described herein again.
Of course, in practical applications, 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 understood that the bus system 504 is used to enable communications among the components. The bus system 504 includes a power bus, a control bus, and a status signal bus in addition to a data bus. For clarity of illustration, however, the various buses are labeled as bus system 504 in fig. 5.
The number of the processors 504 may be at least one.
The network interface 503 is used for communication between the apparatus 50 and other devices in a wired or wireless manner.
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 by the above-mentioned embodiments 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 circuits of hardware or instructions in the form of software in the processor 501. The Processor 501 may be a general purpose Processor, a Digital Signal Processor (DSP), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc. Processor 501 may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present invention. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the method disclosed by the embodiment of the invention can be directly implemented by a hardware 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 located in the memory 502, and the processor 501 reads the information in the memory 502 and performs the steps of the aforementioned methods in conjunction with its hardware.
In an exemplary embodiment, the queue resource management Device 50 may be implemented by one or more Application Specific Integrated Circuits (ASICs), DSPs, Programmable Logic Devices (PLDs), Complex Programmable Logic Devices (CPLDs), Field Programmable Gate Arrays (FPGAs), general purpose processors, controllers, Micro Controllers (MCUs), microprocessors (microprocessors), or other electronic components for performing the foregoing methods.
It is to be understood that the memory (e.g., memory 502) in embodiments of the present invention may be volatile memory or nonvolatile memory, or may include both volatile and nonvolatile memory. The nonvolatile Memory may be a Read Only Memory (ROM), a Programmable Read Only Memory (PROM), an Erasable Programmable Read Only Memory (EPROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a magnetic random access Memory (FRAM), a Flash Memory (Flash Memory), a magnetic surface Memory, an optical Disc, or a Compact Disc Read Only Memory (CD-ROM); the magnetic surface storage may be disk storage or tape storage. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of illustration and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM, Double Data Synchronous Random Access Memory), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM, Enhanced Synchronous Dynamic Random Access Memory), Synchronous link Dynamic Random Access Memory (SLDRAM, Synchronous Dynamic Random Access Memory), Direct Memory bus (DRmb Access Memory, Random Access Memory). The described memory for 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 further provides a computer readable storage medium, such as a memory 502, comprising a computer program, which is executable by a processor 501 of the queue resource management device 50 to perform the steps of the foregoing method.
Specifically, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program performs:
determining the operation of a request queue according to the current operation request;
generating resource linked list information of the requested queue by using 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 logical order of the resources in the queue.
In one embodiment, the computer program, when executed by the processor, performs:
when the current operation request is a message enqueue request, determining a target queue of the message requesting for enqueue, and allocating resources from a resource pool; and adding a linked list of the resources distributed by the resource pool to the queue tail element linked list of the target queue.
In one embodiment, the computer program, when executed by the processor, performs:
generating resource data information of the requested queue; the resource data information represents the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one to one.
In one embodiment, the computer program, when executed by the processor, performs:
and storing the message requesting for enqueuing in the allocated resources.
In one embodiment, the computer program, when executed by the processor, performs:
judging whether the message requesting for enqueuing meets the enqueuing condition; and determining a target queue of the message requesting for enqueuing if the message requesting for enqueuing meets the enqueuing condition.
In one embodiment, the computer program, when executed by the processor, performs:
extracting a queue field from the message requesting for enqueuing;
acquiring a queue relation table; the queue relationship table includes: a correspondence of at least one queue field to a target queue;
and judging whether the queue relation table contains the extracted queue field, and when the queue relation table contains the extracted queue field, determining that the message requesting for enqueuing meets enqueuing conditions.
In one embodiment, the computer program, when executed by the processor, performs:
and searching the target queue corresponding to the extracted queue field in the queue relation table.
In one embodiment, the computer program, when executed by the processor, performs:
and when the current operation request is a message dequeuing request, adding a linked list of resources corresponding to the dequeuing-requested message to a head element linked list of a dequeuing queue corresponding to the dequeuing-requested message.
In one embodiment, the computer program, when executed by the processor, performs:
judging whether the message requesting dequeuing meets a dequeuing condition or not; and if the message requesting dequeuing meets the dequeuing condition, adding a linked list of resources corresponding to the message requesting dequeuing to a head element linked list of a dequeuing queue corresponding to the message requesting dequeuing.
In one embodiment, the computer program, when executed by the processor, performs:
determining a dequeue queue corresponding to the message requesting dequeue, and judging whether the dequeue queue is empty or not, if the dequeue queue is not empty and the handshake operation of the dequeue queue is effective, determining that the message requesting dequeue meets the dequeue condition.
In one embodiment, the computer program, when executed by the processor, performs:
timing from the beginning of message enqueuing, determining that the enqueued messages are not dequeued after the enqueued messages exceed the preset time, modifying the state of resources occupied by the enqueued messages, and modifying the resource linked list information according to overtime operation so as to process the enqueued messages.
It should be noted that: the computer-readable storage medium provided by the embodiment of the invention can be memories such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface Memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.
The above description is only exemplary of the present invention and should not be taken as limiting the scope of the present invention, and any modifications, equivalents, improvements, etc. that are within the spirit and principle of the present invention should be included in the present invention.

Claims (22)

1. A method for queue resource management, the method comprising:
determining the operation of a request queue according to the current operation request;
generating resource linked list information of the requested queue by using 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 logical order of the resources in the queue.
2. The method according to claim 1, wherein when the current operation request is a packet enqueue request, before generating resource linked list information of a queue of requests, the method further comprises: determining a target queue of the message requesting for enqueuing, and allocating resources from a resource pool;
the resource linked list information of the queue generating the request includes: and adding a linked list of the distributed resources in the tail element linked list of the target queue.
3. The method of claim 2, wherein after generating the resource linked list information for the requested queue, the method further comprises: generating resource data information of the requested queue; the resource data information represents the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one to one;
the resource data information of the queue generating the request comprises: and storing the message requesting for enqueuing in the allocated resources.
4. The method of claim 2, wherein before determining the target queue for the message requesting enqueuing, the method further comprises:
judging whether the message requesting for enqueuing meets the enqueuing condition; and determining a target queue of the message requesting for enqueuing if the message requesting for enqueuing meets the enqueuing condition.
5. The method according to claim 4, wherein the determining whether the message requesting for enqueuing satisfies enqueuing conditions comprises:
extracting a queue field from the message requesting for enqueuing;
acquiring a queue relation table; the queue relationship table includes: a correspondence of at least one queue field to a target queue;
and judging whether the queue relation table contains the extracted queue field, and when the queue relation table contains the extracted queue field, determining that the message requesting for enqueuing meets enqueuing conditions.
6. The method of claim 5, wherein determining the target queue of the message according to the message requesting to be enqueued comprises:
and searching the target queue corresponding to the extracted queue field in the queue relation table.
7. The method according to claim 1, wherein when the current operation request is a message dequeue request, the generating resource linked list information of the request queue includes:
and adding a linked list of resources corresponding to the dequeuing-requested message to a head element linked list of the dequeuing queue corresponding to the dequeuing-requested message.
8. The method according to claim 7, wherein before the adding the linked list of resources corresponding to the dequeued packet to the linked list of head-of-line elements of the dequeue queue corresponding to the dequeued packet, the method further comprises:
judging whether the message requesting dequeuing meets a dequeuing condition or not; and if the message requesting dequeuing meets the dequeuing condition, adding a linked list of resources corresponding to the message requesting dequeuing to a head element linked list of a dequeuing queue corresponding to the message requesting dequeuing.
9. The method of claim 8, wherein the determining whether the dequeue-requested packet satisfies a dequeue condition comprises:
determining a dequeue queue corresponding to the message requesting dequeue, and judging whether the dequeue queue is empty or not, if the dequeue queue is not empty and the handshake operation of the dequeue queue is effective, determining that the message requesting dequeue meets the dequeue condition.
10. The method of claim 1, wherein after generating the resource linked list information for the requested queue, the method further comprises:
timing from the beginning of message enqueuing, determining that the enqueued messages are not dequeued after the enqueued messages exceed the preset time, modifying the state of resources occupied by the enqueued messages, and modifying the resource linked list information according to overtime operation so as to process the enqueued messages.
11. An apparatus for queue resource management, the apparatus comprising: the device comprises a first processing module and a second processing module; wherein,
the first processing module is used for determining the operation of the request queue according to the current operation request;
the second processing module is configured to generate resource chain table information of the requested queue by using the determined operation, and execute an operation on the requested queue according to the generated resource chain table information; the resource linked list information characterizes the logical order of the resources in the queue.
12. The apparatus according to claim 11, 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 enqueued request, and allocate resources from a resource pool;
the second processing module is specifically configured to add a linked list of the allocated resources to the tail element linked list of the target queue.
13. The apparatus of claim 12, wherein the second processing module is further configured to generate resource data information of the requested queue; the resource data information represents the storage space of the resource in the queue, and the resource linked list information corresponds to the resource data information one to one;
the second processing module is specifically configured to store the message requesting for enqueuing in the allocated resource.
14. The apparatus according to claim 12, wherein the second processing module is further configured to determine whether the message requesting for enqueuing satisfies an enqueuing condition; and determining a target queue of the message requesting for enqueuing if the message requesting for enqueuing meets the enqueuing condition.
15. The apparatus according to claim 14, wherein the second processing module is configured to extract a queue field from the message requesting enqueuing;
acquiring a queue relation table; the queue relationship table includes: a correspondence of at least one queue field to a target queue;
and judging whether the queue relation table contains the extracted queue field, and when the queue relation table contains the extracted queue field, determining that the message requesting for enqueuing meets enqueuing conditions.
16. The apparatus of claim 15, wherein the second processing module is configured to look up a target queue corresponding to the extracted queue field in the queue relationship table.
17. The apparatus according to claim 11, 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 dequeue-requested message to a head-of-line element linked list of a dequeue queue corresponding to the dequeue-requested message.
18. The apparatus according to claim 17, wherein the second processing module is configured to determine whether the message requesting dequeuing satisfies a dequeuing condition; and if the message requesting dequeuing meets the dequeuing condition, adding a linked list of resources corresponding to the message requesting dequeuing to a head element linked list of a dequeuing queue corresponding to the message requesting dequeuing.
19. The apparatus according to claim 18, wherein the second processing module is configured to determine a dequeue queue corresponding to the dequeue-requested packet, determine whether the dequeue queue is empty, determine that the dequeue queue is not empty, and determine that the dequeue-requested packet satisfies the dequeue condition if a handshake operation of the dequeue queue is valid.
20. The apparatus of claim 11, further comprising: and the third processing module is used for timing from the beginning of message enqueuing, determining that the enqueued messages are not dequeued after the enqueued messages exceed the preset time, modifying the state of resources occupied by the enqueued messages, and modifying the resource linked list information according to overtime operation so as to process the enqueued messages.
21. A queue resource management apparatus, 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 one of claims 1 to 10 when running the computer program.
22. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 10.
CN201710801895.2A 2017-09-07 2017-09-07 Queue resource management method, device and storage medium Active CN109474543B (en)

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 true CN109474543A (en) 2019-03-15
CN109474543B 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)

* Cited by examiner, † Cited by third party
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

Patent Citations (4)

* Cited by examiner, † Cited by third party
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
CN109474543B (en) 2023-11-14

Similar Documents

Publication Publication Date Title
EP3073374B1 (en) Thread creation method, service request processing method and related device
WO2019223596A1 (en) Method, device, and apparatus for event processing, and storage medium
US9792051B2 (en) System and method of application aware efficient IO scheduler
CN109697122B (en) Task processing method, device and computer storage medium
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
US8996774B2 (en) Performing emulated message signaled interrupt handling
US20190286582A1 (en) Method for processing client requests in a cluster system, a method and an apparatus for processing i/o according to the client requests
CN111949568A (en) Message processing method and device and network chip
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
CN112860387A (en) Distributed task scheduling method and device, computer equipment and storage medium
CN111290979A (en) Data transmission method, device and system
CN111190541B (en) Flow control method of storage system and computer readable storage medium
US20150100818A1 (en) Back-off mechanism for a peripheral page request log
US20200104193A1 (en) Port Groups
WO2017176446A1 (en) QoS-CLASS BASED SERVICING OF REQUESTS FOR A SHARED RESOURCE
US9990240B2 (en) Event handling in a cloud data center
US10846265B2 (en) Method and apparatus for accessing file, and storage system
WO2017070869A1 (en) Memory configuration method, apparatus and system
CN109474543A (en) A kind of queue resource management method, device and storage medium
WO2022199560A1 (en) Memory management method and device
US8214448B2 (en) Optimized utilization of DMA buffers for incoming data packets in a network protocol
CN113886082A (en) Request processing method and device, computing equipment and medium
EP2972847A1 (en) Fast and scalable concurrent queuing 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