CN109656515A - Operating method, device and the storage medium of queue message - Google Patents

Operating method, device and the storage medium of queue message Download PDF

Info

Publication number
CN109656515A
CN109656515A CN201811372489.XA CN201811372489A CN109656515A CN 109656515 A CN109656515 A CN 109656515A CN 201811372489 A CN201811372489 A CN 201811372489A CN 109656515 A CN109656515 A CN 109656515A
Authority
CN
China
Prior art keywords
queue
pointer
message
queue message
moved
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811372489.XA
Other languages
Chinese (zh)
Inventor
邓硕灵
陈子文
陈滨
李玉龙
彭世雄
俞瑾
郭未
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SHENZHEN STOCK EXCHANGE
Original Assignee
SHENZHEN STOCK EXCHANGE
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 STOCK EXCHANGE filed Critical SHENZHEN STOCK EXCHANGE
Priority to CN201811372489.XA priority Critical patent/CN109656515A/en
Publication of CN109656515A publication Critical patent/CN109656515A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F7/00Methods or arrangements for processing data by operating upon the order or content of the data handled
    • G06F7/76Arrangements for rearranging, permuting or selecting data according to predetermined rules, independently of the content of the data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephonic Communication Services (AREA)

Abstract

The invention discloses a kind of operating methods of queue message, the operating method of queue message is applied to storage medium, head pointer, tail pointer, release pointer and queue storage space are set in storage medium, head pointer, tail pointer and release pointer are directed toward queue storage space;The operating method of queue message determines the type of operational order the following steps are included: in the operational order for receiving queue message, and operational order includes joining the team instruction, dequeue instruction and to release order;According to operational order, the target position of pointer and pointer to be moved to be moved in queue storage space is determined, the data volume of each queue message in queue storage space can not be identical;It controls pointer to be moved and is moved to target position, and the corresponding operation of operational order is executed to queue message.Invention additionally discloses the operating devices of a kind of storage medium and queue message.Storage medium disclosed by the invention can combine flexibility, low time delay and big three characteristic of high-performance.

Description

Operating method, device and the storage medium of queue message
Technical field
The present invention relates to field of communication technology more particularly to a kind of operating methods of queue message, device and storage medium.
Background technique
In computer software design field, the message queue design pattern classical as one is widely used in difference Program structure among.The message queue of mainstream can be divided into " non-embedded message queue " and " embedded message queue in industry ", non-embedded message queue independently can be disposed and be used as individual program;And Embedded message queue is general It is embedded in inside program as library function, is disposed together with service logic.
For " non-embedded message queue ", since it is individually disposed as an independent process, and with it is most of with Service logic program passes through the interprocess communication modes interaction datas such as TCP/IP, Unix Socket, IPC, therefore, communication delay It is larger compared to embedded message queue, it is not suitable for the field sensitive to delay requirement such as financial instrument industry.
For " embedded message queue ", although its time delay is lower, due to complicated business demand, lead to industry Boundary's product is supported the mode and not perfect, such as queues such as Boost::LockFreeQueue, only supports fixed message Length, and the communication between striding course can not be carried out.And ZeroMQ design is complicated, although there is biggish promotion in flexibility, It is to be designed since it is flexible, has lost biggish performance, and support and its weakness to multithreading, can not effectively utilize The computing capability of single machine.
To sum up, existing message queue product is difficult to take into account flexibility, low time delay and high-performance.
Summary of the invention
The main purpose of the present invention is to provide a kind of operating method of queue message, device and storage mediums, it is intended to solve Certainly message queue product is difficult to take into account flexibility, low time delay and high performance problem.
To achieve the above object, the operating method of a kind of queue message provided by the invention, the operation of the queue message Method is applied to storage medium, and head pointer, tail pointer, release pointer and queue storage space, institute are set in the storage medium It states head pointer, the tail pointer and the release pointer and is directed toward the queue storage space;The operation side of the queue message Method the following steps are included:
In the operational order for receiving queue message, the type of the operational order is determined, wherein the operational order Including instruction of joining the team, dequeue instruction and release order;
According to the operational order, it is empty to determine that pointer to be moved and the pointer to be moved are stored in the queue Between in target position, wherein the data volume of each queue message in the queue storage space can not be identical;
It controls the pointer to be moved and is moved to the target position, and the operation is executed to the queue message and is referred to Enable corresponding operation.
In one embodiment, determination pointer to be moved and the pointer to be moved store empty in the queue Between in target position the step of include:
When the operational order is to join the team to instruct, the data volume of the queue message is determined, and the tail pointer is true It is set to pointer to be moved;
The memory block in queue message region to be allocated in the queue storage space is determined according to the data volume Domain, and using the tail portion of the storage region as the target position of the pointer to be moved.
In one embodiment, after the step of data volume of the determination queue message, further includes:
Judge whether the data volume of the queue message is less than or equal to the amount of storage in the region to be allocated;
When the data volume of the queue message is less than or equal to the amount of storage in the region to be allocated, execute the tail Pointer is determined as the step of pointer to be moved;
When the data volume of the queue message is greater than the amount of storage in the region to be allocated, by the region to be allocated State by it is to be allocated be changed to it is inseparable be equipped with to obtain can not distribution region, and the tail pointer is moved to the tail pointer and is existed Initial position in the queue storage space.
In one embodiment, determination pointer to be moved and the pointer to be moved store empty in the queue Between in target position the step of include:
When the operational order is dequeue instruction, the head pointer is determined as to pointer to be moved, and described in determination Position of the tail portion of queue message in the queue storage space;
The position is determined as to the target position of the pointer to be moved.
In one embodiment, determination pointer to be moved and the pointer to be moved store empty in the queue Between in target position the step of include:
When the operational order is to release order, using the release pointer as pointer to be moved, and described in determination The tail portion of queue message;
Using the tail portion of the queue message as the corresponding target position of the pointer to be moved.
It is in one embodiment, described using the release pointer as after the step of pointer to be moved, further includes:
Judge whether there is the to be recycled queue region adjacent with the queue message, wherein the queue region to be recycled Contain a queue message to be recycled or multiple successively adjacent queue messages to be recycled, the queue region to be recycled in domain Domain is located at after the queue message;
When not containing the to be recycled queue region adjacent with the queue message, the determination queue message is executed Tail portion the step of;
When containing the to be recycled queue region adjacent with the queue message, by the tail portion of the queue region to be recycled Target position as the pointer to be moved.
In one embodiment, it after the described the step of pointer to be moved is moved to the target position, also wraps It includes:
In the release pointer moving process by can not distribution region, and the head pointer and the tail pointer are equal Positioned at it is described can not be after distribution region when, by it is described can not distribution region state by inseparable to be allocated with being changed to, with By it is described can not distribution region be changed to region to be allocated.
In one embodiment, described the step of executing the operational order corresponding operation to the queue message, includes:
The operational order be join the team instruct when, by the queue message be placed in the queue message for storage Region, and according to the data structure of the locating queue storage space of queue message update;
When the operational order is to join the team to instruct, the message body in the queue message is replicated, by the message body It is sent to target application, and the state of the queue message is changed to team by having joined the team;
When the operational order is to release order, release shape is set by having gone out team by the state of the queue message State, and the queue message is discharged.
To achieve the above object, the present invention also provides a kind of operating device of queue message, the operation of institute's queue message is filled It sets including processor, memory and the operation for being stored in the queue message that can be run on the memory and on the processor Program, the operation sequence of the queue message realize the operating method of queue message as described above when being executed by the processor Each step.
To achieve the above object, the present invention also provides a kind of storage medium, in the storage medium storage in set head pointer, Tail pointer, release pointer and queue storage space, described in the head pointer, the tail pointer and release pointer direction Queue storage space, the storage medium are also stored with the operation sequence of queue message, the operation sequence quilt of the queue message The processor realizes each step of the operating method of queue message as described above when executing.
Operating method, device and the storage medium of queue message provided by the invention, in the operation for receiving queue message When instruction, the type of operational order is determined, thus according to the operational order, in tail pointer, head pointer and release pointer It determines pointer to be moved, and determines the target position of pointer to be moved in queue storage space, to control to be moved Pointer be moved to target position, to execute the corresponding operation of operational order to queue message;Due to each in storage medium The data volume of queue message is variable, so that the flexibility of storage medium storage queue message is higher, simultaneously as storage medium exists Its internal dequeue operation and enqueue operations executed to queue message, without carrying out out team in a network environment and joining the team Operation, so that operation time delay is smaller, the performance namely storage medium provided by the invention for improving storage medium can be simultaneous simultaneously Care for flexibility, low time delay and big three characteristic of high-performance.
Detailed description of the invention
Fig. 1 be the present embodiments relate to storage medium hardware structural diagram;
Fig. 2 is the first embodiment of the operating method of queue message of the present invention;
The refinement flow diagram that Fig. 3 is step S20 in Fig. 2;
Fig. 4 is another refinement flow diagram of step S20 in Fig. 2;
Fig. 5 is another refinement flow diagram of step S20 in Fig. 2;
Fig. 6 is the simple process schematic diagram of the enqueue operations of queue message in the present invention;
Fig. 7 is the simple process schematic diagram of the dequeue operation of queue message in the present invention;
Fig. 8 is the simple process schematic diagram of the release operation of queue message in the present invention.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that described herein, specific examples are only used to explain the present invention, is not intended to limit the present invention.
The primary solutions of the embodiment of the present invention are: in the operational order for receiving queue message, determining the behaviour Make the type that instructs, wherein the operational order includes joining the team instruction, dequeue instruction and to release order;According to the operation Instruction, determines the target position of pointer and the pointer to be moved to be moved in the queue storage space, wherein The data volume of each queue message in the queue storage space can not be identical;It controls the pointer to be moved and is moved to institute Target position is stated, and the corresponding operation of the operational order is executed to the queue message.
Since the data volume of each queue message in storage medium is variable, so that the spirit of storage medium storage queue message Activity is higher, simultaneously as storage medium executes the dequeue operation and enqueue operations to queue message inside it, without Team and enqueue operations are carried out out in a network environment, so that operation time delay is smaller, improve the performance of storage medium, Ye Jiben The storage medium that invention provides can combine flexibility, low time delay and big three characteristic of high-performance.
As a kind of implementation, storage medium can be as shown in Figure 1.
What is involved is storage medium 102, storage mediums 102 to connect processor 101, such as CPU for the embodiment of the present invention And communication bus 103, storage medium 102 include head pointer, tail pointer discharges pointer and queue storage space.Wherein, lead to Bus 103 is believed for realizing the connection communication between these components, and head pointer, tail pointer, release pointer are directed to queue storage Space.
Storage medium can be high speed RAM memory, be also possible to stable memory (non-volatile Memory), such as magnetic disk storage, storage medium can also be the producer and consumer on a shared medium one section continuously Location space.As shown in Figure 1, may include the operation sequence of queue message in storage medium;And processor 101 can be used for calling and deposit The operation sequence of the queue message stored in storage inoculation, and execute following operation:
In the operational order for receiving queue message, the type of the operational order is determined, wherein the operational order Including instruction of joining the team, dequeue instruction and release order;
According to the operational order, it is empty to determine that pointer to be moved and the pointer to be moved are stored in the queue Between in target position, wherein the data volume of each queue message in the queue storage space can not be identical;
It controls the pointer to be moved and is moved to the target position, and the operation is executed to the queue message and is referred to Enable corresponding operation.
In one embodiment, processor 101 can be used for calling the screening procedure of the projector stored in storage medium, and Execute following operation:
When the operational order is to join the team to instruct, the data volume of the queue message is determined, and the tail pointer is true It is set to pointer to be moved;
The memory block in queue message region to be allocated in the queue storage space is determined according to the data volume Domain, and using the tail portion of the storage region as the target position of the pointer to be moved.
In one embodiment, processor 101 can be used for calling the screening procedure of the projector stored in storage medium, and Execute following operation:
Judge whether the data volume of the queue message is less than or equal to the amount of storage in the region to be allocated;
When the data volume of the queue message is less than or equal to the amount of storage in the region to be allocated, execute the tail Pointer is determined as the step of pointer to be moved;
When the data volume of the queue message is greater than the amount of storage in the region to be allocated, by the region to be allocated State by it is to be allocated be changed to it is inseparable be equipped with to obtain can not distribution region, and the tail pointer is moved to the tail pointer and is existed Initial position in the queue storage space.
In one embodiment, processor 101 can be used for calling the screening procedure of the projector stored in storage medium, and Execute following operation:
When the operational order is dequeue instruction, the head pointer is determined as to pointer to be moved, and described in determination Position of the tail portion of queue message in the queue storage space;
The position is determined as to the target position of the pointer to be moved.
In one embodiment, processor 101 can be used for calling the screening procedure of the projector stored in storage medium, and Execute following operation:
When the operational order is to release order, using the release pointer as pointer to be moved, and described in determination The tail portion of queue message;
Using the tail portion of the queue message as the corresponding target position of the pointer to be moved.
In one embodiment, processor 101 can be used for calling the screening procedure of the projector stored in storage medium, and Execute following operation:
Judge whether there is the to be recycled queue region adjacent with the queue message, wherein the queue region to be recycled Contain a queue message to be recycled or multiple successively adjacent queue messages to be recycled, the queue region to be recycled in domain Domain is located at after the queue message;
When not containing the to be recycled queue region adjacent with the queue message, the determination queue message is executed Tail portion the step of;
When containing the to be recycled queue region adjacent with the queue message, by the tail portion of the queue region to be recycled Target position as the pointer to be moved.
In one embodiment, processor 101 can be used for calling the screening procedure of the projector stored in storage medium, and Execute following operation:
In the release pointer moving process by can not distribution region, and the head pointer and the tail pointer are equal Positioned at it is described can not be after distribution region when, by it is described can not distribution region state by inseparable to be allocated with being changed to, with By it is described can not distribution region be changed to region to be allocated.
In one embodiment, processor 101 can be used for calling the screening procedure of the projector stored in storage medium, and Execute following operation:
The operational order be join the team instruct when, by the queue message be placed in the queue message for storage Region, and according to the data structure of the locating queue storage space of queue message update;
When the operational order is to join the team to instruct, the message body in the queue message is replicated, by the message body It is sent to target application, and the state of the queue message is changed to team by having joined the team;
When the operational order is to release order, release shape is set by having gone out team by the state of the queue message State, and the queue message is discharged.
The present embodiment is according to above scheme, in the operational order for receiving queue message, determines the type of operational order, To determine pointer to be moved in tail pointer, head pointer and release pointer according to the operational order, and determine wait move Target position of the dynamic pointer in queue storage space, so that controlling pointer to be moved is moved to target position, to team Column message executes the corresponding operation of operational order;Since the data volume of each queue message in storage medium is variable, so that depositing The flexibility of storage media storage queue message is higher, simultaneously as storage medium executes inside it goes out team to queue message Operation and enqueue operations, so that operation time delay is smaller, are improved without carrying out out team and enqueue operations in a network environment The performance of storage medium namely storage medium provided by the invention can combine flexibility, low time delay and high-performance Big three characteristic.
Based on the hardware architecture of above-mentioned storage medium, the embodiment of the operating method of queue message of the present invention is proposed.
It is the first embodiment of the operating method of queue message of the present invention, the operation of the queue message referring to Fig. 2, Fig. 2 Method the following steps are included:
Step S10 determines the type of the operational order, wherein described in the operational order for receiving queue message Operational order includes joining the team instruction, dequeue instruction and to release order;
In the present invention, head pointer (head), tail pointer (tail), release pointer (Release) are equipped in storage medium And queue storage space, head pointer, tail pointer and release pointer are directed to queue storage space, head pointer, tail pointer with And release pointer is a sector address, the length of address is fixed, and queue storage space is ring structure, is equipped in queue storage space Metadata area, metadata area include head pointer, tail pointer and the address for discharging pointer.It should be noted that in this hair In bright, storage medium can be the producer and the one section of continuation address space of consumer on a shared medium, for example, process is privately owned Memory, virtual memory etc. are also possible to non-fugitiveness storage, e.g., disk, shared drive etc..
When storage medium receives the operational order of queue message, it is thus necessary to determine that the type of operational order, and according to operation Instruction determines the queue message for needing to operate, and queue message includes the data of queue message state, message body and queue message Amount, data volume namely data length, data volume (length), quene state (status) and the message body of queue message (body) successively adjacent composition queue message, quene state include the states such as team, having joined the team, is to be recycled.
Step S20 determines pointer to be moved and the pointer to be moved in the team according to the operational order Target position in column memory space, wherein the data volume of each queue message in the queue storage space can not be identical;
When storage medium receive join the team instruct when, then can move tail pointer, receive dequeue instruction in storage medium When, mobile head pointer, when storage medium is received and is released order, mobile release pointer, it is to be understood that operational order packet It includes instruction of joining the team, dequeue instruction and releases order.It should be noted that the number of the queue message stored in queue storage space According to amount can different namely each queue message data lengths be not to fix, be variable.
When operational order is to join the team to instruct, storage medium then needs to execute queue message enqueue operations (Push behaviour Make), and determine pointer and the corresponding target position of pointer to be moved to be moved, specifically, referring to Fig. 3, i.e. step S20 packet It includes:
Step S21 determines the data volume of the queue message, and will be described when the operational order is to join the team to instruct Tail pointer is determined as pointer to be moved;
Step S22 determines queue message region to be allocated in the queue storage space according to the data volume Storage region, and using the tail portion of the storage region as the target position of the pointer to be moved;
When operational order is to join the team to instruct, pointer to be moved is tail pointer;Queue storage space is equipped with area to be allocated Domain, region to be allocated are idle storage region, and queue storage space storage queue message follows the principle of first in first out, namely By the more early queue message joined the team closer to metadata area;Storage medium can determine whether the data volume of queue message, thus according to Data volume and first in first out determine the storage region in queue message region to be allocated, and the tail portion of storage region is that tail refers to The corresponding target position of needle, namely after tail pointer is moved to target position, queue message is placed in the storage region.
It should be noted that storage medium needs to judge the data of queue message after determining the data volume of queue message Whether amount is less than or equal to the amount of storage in region to be allocated, if data volume is less than or equal to the amount of storage in region to be allocated, table Bright region to be allocated can storage queue message, at this point, thening follow the steps S21, step S22 and step S30;If data volume is big Amount of storage in region to be allocated, then show region to be allocated can not storage queue message, at this point, by the state in region to be allocated Be changed to it is inseparable match, thus by region to be allocated be changed to can not distribution region, can not distribution region can use the region gap table Sign, at this point, tail pointer is moved to initial position of the tail pointer in queue storage space.
When operational order is dequeue instruction, storage medium then needs to execute dequeue operation (pop operation) to queue message, And determine pointer and the corresponding target position of pointer to be moved to be moved, specifically, referring to Fig. 4, i.e. step S20 includes:
The head pointer is determined as pointer to be moved when the operational order is dequeue instruction by step S23, and Determine position of the tail portion of the queue message in the queue storage space;
The position is determined as the target position of the pointer to be moved by step S24;
When operational order is dequeue instruction, then show that storage medium needs to replicate the queue message of storage, and pass Corresponding target application is transported to, at this point, pointer to be moved is head pointer;It should be noted that dequeue operation also needs to follow elder generation Into the principle first gone out;Queue message queue storage space have queue region, the tail portion namely first position in the region, i.e., For the target position of head pointer, and when queue message is in and joins the team state, head pointer position is inevitable in the queue message Head before, it is to be understood that after head pointer is moved to the target position, the mobile region of head pointer necessarily includes this Queue message.
It should be noted that when carrying out dequeue operation, if head pointer encounter can not distribution region when, head pointer need to be got over Cross can not distribution region, namely only replication queue message, do not replicate to can not the data such as state of distribution region replicate, In addition, replication queue message, can only replication queue message message body.
When operational order be release order when, storage medium then need to queue message execute release operation, and determine to Mobile pointer and the corresponding target position of pointer to be moved, specifically, referring to Fig. 5, i.e. step S20 includes:
Step S25, when the operational order is to release order, using the release pointer as pointer to be moved, and Determine the tail portion of the queue message;
Step S26, using the tail portion of the queue message as the corresponding target position of the pointer to be moved;
When operational order is to release order, then shows that storage medium needs to discharge the queue message, need to illustrate It is that the state of the queue message is team's state, target application can send to storage medium and believe after obtaining the queue message Breath, when storage medium receives the information, that is, produces releasing order for the queue operation;Queue message is in team's state When, head pointer is directed toward the tail portion of the queue message, therefore when release operates (Rlease operation), release pointer need to be moved to head The corresponding position of pointer, to complete the release to the queue message.
It, can (releasable queue disappears by the releasable queue message adjacent with the queue message in addition, carrying out release operation Breath is that state is queue message to be recycled) it discharges together, in this regard, storage medium is in release pointer as pointer to be moved Afterwards, judge whether containing the to be recycled queue region adjacent with queue message, it is to be recycled containing one in queue region to be recycled Queue message or multiple successively adjacent queue messages to be recycled, and queue region to be recycled is after the queue message; If do not contain the to be recycled queue region adjacent with queue message, step S205 and step S206 can be performed, if containing When adjacent with queue message queue region to be recycled, then need to discharge the queue region to be recycled together with queue message, Also i.e. using the tail portion of queue region to be recycled as the target position of release pointer.
In addition, in release pointer moving process, if by can not distribution region, namely pass through the region gap, and head refers to Needle and tail pointer when can not be after distribution region, need to by can not distribution region state by it is inseparable be changed to point Match, thus can not distribution region be changed to region to be allocated.
Step S30 controls the pointer to be moved and is moved to the target position, and executes institute to the queue message State the corresponding operation of operational order;
In the present invention, when pointer difference to be moved, storage medium is different to the operation of queue message, specifically, When pointer to be moved is tail pointer, queue message is placed in the corresponding storage region of queue message, and according to queue The data structure of information updating queue storage space, data structure refer to the storage data quantity and queue of queue message The setting of the setting of message oneself state, queue message oneself state refers to being set as having joined the team by the state of queue message;
When pointer to be moved is head pointer, message body in replication queue message, so that message body is sent to Target application, and the state of queue message is changed to team by having joined the team simultaneously;
When pointer to be moved is release pointer, release conditions are set by having gone out team by the state of queue message, And queue message is discharged, namely queue message can be completed at the tail portion for being moved to queue message in release pointer Release.
It is the simple process schematic diagram of the enqueue operations of queue message in the present invention referring to Fig. 6, Fig. 6;It is referring to Fig. 7, Fig. 7 The simple process schematic diagram of the dequeue operation of queue message in the present invention;And referring to Fig. 8, Fig. 8 is queue message in the present invention Release operation simple process schematic diagram;This is no longer going to repeat them for the operating process of three kinds of queue messages.
In technical solution provided in this embodiment, in the operational order for receiving queue message, operational order is determined Type determine pointer to be moved in tail pointer, head pointer and release pointer thus according to the operational order, and The target position of pointer to be moved in queue storage space is determined, so that controlling pointer to be moved is moved to target position It sets, to execute the corresponding operation of operational order to queue message;Since the data volume of each queue message in storage medium can Become, so that the flexibility of storage medium storage queue message is higher, disappears simultaneously as storage medium executes inside it to queue The dequeue operation and enqueue operations of breath, without carrying out out team and enqueue operations in a network environment, so that operation time delay It is smaller, the performance namely storage medium provided by the invention for improving storage medium can combine flexibility, low time delay with And big three characteristic of high-performance.
The present invention also provides a kind of operating device of queue message, the operating device of institute's queue message includes processor, deposits Reservoir and the operation sequence for being stored in the queue message that can be run on the memory and on the processor, the queue disappear The operation sequence of breath realizes each step of the operating method of queue message described in embodiment as above when being executed by the processor Suddenly.
It is interior in the storage medium storage to set head pointer, tail pointer, release pointer the present invention also provides a kind of storage medium And queue storage space, the head pointer, the tail pointer and the release pointer are directed toward the queue storage space, institute The operation sequence that storage medium is also stored with queue message is stated, when the operation sequence of the queue message is executed by the processor Realize each step of the operating method of queue message described in embodiment as above.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the device that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or device institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or device.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in one as described above In storage medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that terminal device (it can be mobile phone, Computer, server, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (10)

1. a kind of operating method of queue message, which is characterized in that the operating method of the queue message is applied to storage medium, Head pointer, tail pointer, release pointer and queue storage space, the head pointer, the tail pointer are set in the storage medium And the release pointer is directed toward the queue storage space;The operating method of the queue message the following steps are included:
In the operational order for receiving queue message, the type of the operational order is determined, wherein the operational order includes It instruction, the dequeue instruction of joining the team and releases order;
According to the operational order, determine pointer to be moved and the pointer to be moved in the queue storage space Target position, wherein the data volume of each queue message in the queue storage space can not be identical;
It controls the pointer to be moved and is moved to the target position, and the operational order pair is executed to the queue message The operation answered.
2. the operating method of queue message as described in claim 1, which is characterized in that determination pointer to be moved and The step of target position of the pointer to be moved in the queue storage space includes:
When the operational order is to join the team to instruct, the data volume of the queue message is determined, and the tail pointer is determined as Pointer to be moved;
The storage region in queue message region to be allocated in the queue storage space is determined according to the data volume, and Using the tail portion of the storage region as the target position of the pointer to be moved.
3. the operating method of queue message as claimed in claim 2, which is characterized in that the number of the determination queue message After the step of amount, further includes:
Judge whether the data volume of the queue message is less than or equal to the amount of storage in the region to be allocated;
When the data volume of the queue message is less than or equal to the amount of storage in the region to be allocated, execute the tail pointer The step of being determined as pointer to be moved;
When the data volume of the queue message is greater than the amount of storage in the region to be allocated, by the state in the region to be allocated By it is to be allocated be changed to it is inseparable be equipped with to obtain can not distribution region, and the tail pointer is moved to the tail pointer described Initial position in queue storage space.
4. the operating method of queue message as described in claim 1, which is characterized in that determination pointer to be moved and The step of target position of the pointer to be moved in the queue storage space includes:
When the operational order is dequeue instruction, the head pointer is determined as to pointer to be moved, and determine the queue Position of the tail portion of message in the queue storage space;
The position is determined as to the target position of the pointer to be moved.
5. the operating method of queue message as described in claim 1, which is characterized in that determination pointer to be moved and The step of target position of the pointer to be moved in the queue storage space includes:
When the operational order is to release order, using the release pointer as pointer to be moved, and the queue is determined The tail portion of message;
Using the tail portion of the queue message as the corresponding target position of the pointer to be moved.
6. the operating method of queue message as claimed in claim 5, which is characterized in that it is described using the release pointer as to After the step of mobile pointer, further includes:
Judge whether there is the to be recycled queue region adjacent with the queue message, wherein in the queue region to be recycled Containing a queue message to be recycled or multiple successively adjacent queue messages to be recycled, the queue region position to be recycled After the queue message;
When not containing the to be recycled queue region adjacent with the queue message, the tail of the determination queue message is executed The step of portion;
Contain the to be recycled queue region adjacent with the queue message when, using the tail portion of the queue region to be recycled as The target position of the pointer to be moved.
7. the operating method of queue message as claimed in claim 5, which is characterized in that described to move the pointer to be moved After the step of moving to the target position, further includes:
In the release pointer moving process by can not distribution region, and the head pointer and the tail pointer are respectively positioned on It is described when can not be after distribution region, by it is described can not distribution region state by inseparable to be allocated with being changed to, by institute State can not distribution region be changed to region to be allocated.
8. such as the operating method of the described in any item queue messages of claim 1-7, which is characterized in that described to disappear to the queue Breath executes the step of operational order corresponding operation and includes:
The operational order be join the team instruct when, by the queue message be placed in the queue message for memory block Domain, and according to the data structure of the locating queue storage space of queue message update;
When the operational order is to join the team to instruct, the message body in the queue message is replicated, the message body is sent To target application, and the state of the queue message is changed to team by having joined the team;
When the operational order is to release order, release conditions are set by having gone out team by the state of the queue message, and The queue message is discharged.
9. a kind of operating device of queue message, which is characterized in that the operating device of institute's queue message includes processor, memory With the operation sequence for being stored in the queue message that can be run on the memory and on the processor, the queue message The each of the operating method such as the described in any item queue messages of claim 1-8 is realized when operation sequence is executed by the processor A step.
10. a kind of storage medium, which is characterized in that set in the storage medium storage head pointer, tail pointer, release pointer with And queue storage space, the head pointer, the tail pointer and the release pointer are directed toward the queue storage space, described Storage medium is also stored with the operation sequence of queue message, real when the operation sequence of the queue message is executed by the processor Now such as each step of the operating method of the described in any item queue messages of claim 1-8.
CN201811372489.XA 2018-11-16 2018-11-16 Operating method, device and the storage medium of queue message Pending CN109656515A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811372489.XA CN109656515A (en) 2018-11-16 2018-11-16 Operating method, device and the storage medium of queue message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811372489.XA CN109656515A (en) 2018-11-16 2018-11-16 Operating method, device and the storage medium of queue message

Publications (1)

Publication Number Publication Date
CN109656515A true CN109656515A (en) 2019-04-19

Family

ID=66112058

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811372489.XA Pending CN109656515A (en) 2018-11-16 2018-11-16 Operating method, device and the storage medium of queue message

Country Status (1)

Country Link
CN (1) CN109656515A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110427525A (en) * 2019-08-08 2019-11-08 北京字节跳动网络技术有限公司 Data access method and device
CN111556562A (en) * 2019-07-19 2020-08-18 新华三技术有限公司 Positioning method, device and system
CN114785714A (en) * 2022-03-01 2022-07-22 阿里巴巴(中国)有限公司 Message transmission delay detection method, storage medium and equipment
CN115269392A (en) * 2022-07-20 2022-11-01 北京斯年智驾科技有限公司 Visual debugging method, equipment and medium for fusion perception
CN117573377A (en) * 2024-01-15 2024-02-20 摩尔线程智能科技(北京)有限责任公司 Memory management method, device, equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7895239B2 (en) * 2002-01-04 2011-02-22 Intel Corporation Queue arrays in network devices
CN102984089A (en) * 2012-11-19 2013-03-20 中兴通讯股份有限公司 Method and device for traffic management and scheduling
CN103530130A (en) * 2013-10-28 2014-01-22 迈普通信技术股份有限公司 Method and equipment for implementing multiple-input and multiple-output queues
CN104168217A (en) * 2014-08-15 2014-11-26 杭州华三通信技术有限公司 Scheduling method and device for first in first out queue
CN105045632A (en) * 2015-08-10 2015-11-11 京信通信技术(广州)有限公司 Method and device for implementing lock free queue in multi-core environment
CN105912273A (en) * 2016-04-15 2016-08-31 成都欧飞凌通讯技术有限公司 FPGA-basedmessage share storage management implementation method
CN106254270A (en) * 2015-06-15 2016-12-21 深圳市中兴微电子技术有限公司 A kind of queue management method and device
CN106302238A (en) * 2015-05-13 2017-01-04 深圳市中兴微电子技术有限公司 A kind of queue management method and device
CN107342954A (en) * 2017-06-29 2017-11-10 北京东土军悦科技有限公司 The dispatching method and device of a kind of message
CN107730229A (en) * 2017-10-19 2018-02-23 广州市万表科技股份有限公司 A kind of credit card fund management method and system
CN108234348A (en) * 2016-12-13 2018-06-29 深圳市中兴微电子技术有限公司 A kind of processing method and processing device in queue operation

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7895239B2 (en) * 2002-01-04 2011-02-22 Intel Corporation Queue arrays in network devices
CN102984089A (en) * 2012-11-19 2013-03-20 中兴通讯股份有限公司 Method and device for traffic management and scheduling
CN103530130A (en) * 2013-10-28 2014-01-22 迈普通信技术股份有限公司 Method and equipment for implementing multiple-input and multiple-output queues
CN104168217A (en) * 2014-08-15 2014-11-26 杭州华三通信技术有限公司 Scheduling method and device for first in first out queue
CN106302238A (en) * 2015-05-13 2017-01-04 深圳市中兴微电子技术有限公司 A kind of queue management method and device
CN106254270A (en) * 2015-06-15 2016-12-21 深圳市中兴微电子技术有限公司 A kind of queue management method and device
CN105045632A (en) * 2015-08-10 2015-11-11 京信通信技术(广州)有限公司 Method and device for implementing lock free queue in multi-core environment
CN105912273A (en) * 2016-04-15 2016-08-31 成都欧飞凌通讯技术有限公司 FPGA-basedmessage share storage management implementation method
CN108234348A (en) * 2016-12-13 2018-06-29 深圳市中兴微电子技术有限公司 A kind of processing method and processing device in queue operation
CN107342954A (en) * 2017-06-29 2017-11-10 北京东土军悦科技有限公司 The dispatching method and device of a kind of message
CN107730229A (en) * 2017-10-19 2018-02-23 广州市万表科技股份有限公司 A kind of credit card fund management method and system

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111556562A (en) * 2019-07-19 2020-08-18 新华三技术有限公司 Positioning method, device and system
CN110427525A (en) * 2019-08-08 2019-11-08 北京字节跳动网络技术有限公司 Data access method and device
CN110427525B (en) * 2019-08-08 2022-02-25 北京字节跳动网络技术有限公司 Data access method and device
CN114785714A (en) * 2022-03-01 2022-07-22 阿里巴巴(中国)有限公司 Message transmission delay detection method, storage medium and equipment
CN114785714B (en) * 2022-03-01 2023-08-22 阿里巴巴(中国)有限公司 Message transmission delay detection method, storage medium and equipment
CN115269392A (en) * 2022-07-20 2022-11-01 北京斯年智驾科技有限公司 Visual debugging method, equipment and medium for fusion perception
CN115269392B (en) * 2022-07-20 2023-11-14 北京斯年智驾科技有限公司 Visual debugging method, device and medium for fusion perception
CN117573377A (en) * 2024-01-15 2024-02-20 摩尔线程智能科技(北京)有限责任公司 Memory management method, device, equipment and storage medium
CN117573377B (en) * 2024-01-15 2024-06-25 摩尔线程智能科技(北京)有限责任公司 Memory management method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109656515A (en) Operating method, device and the storage medium of queue message
EP2715539B1 (en) Distributed computing framework
US10037222B2 (en) Virtualization of hardware accelerator allowing simultaneous reading and writing
TWI310527B (en) Method for processing vertex, triangle, and pixel graphics data packets
US11347480B2 (en) Transpose operations using processing element array
US20120278587A1 (en) Dynamic Data Partitioning For Optimal Resource Utilization In A Parallel Data Processing System
CN104331255B (en) A kind of stream data read method based on embedded file system
CN106325758B (en) A kind of queue storage space management method and device
Kumar et al. Acceleration of an asynchronous message driven programming paradigm on IBM Blue Gene/Q
JP6698177B2 (en) Reconfigurable distributed processing
CN103810009B (en) A kind of method and apparatus of computer operating system Acceleration of starting
US20090083753A1 (en) Dynamic thread generation and management for improved computer program performance
JP5945006B2 (en) Data transmission in cloud-based systems
US9563466B2 (en) Method and apparatus for supporting programmable software context state execution during hardware context restore flow
JP2017505931A (en) System and method for dynamically throttling CPU frequency for gaming workloads
CN110309088A (en) ZYNQ fpga chip and its data processing method, storage medium
CN106406820B (en) A kind of multi-emitting parallel instructions processing method and processing device of network processor micro-engine
CN108701024A (en) Method for distributing virtual register storehouse in stack machine
CN107066292A (en) Server environment dispositions method and device
JP2013196706A (en) Reconfigurable processor based on mini-cores, and schedule apparatus and method for the same
KR20140004654A (en) Methods and systems for synchronous operation of a processing device
Tang et al. Mrorder: Flexible job ordering optimization for online mapreduce workloads
CN104009904B (en) The virtual network construction method and system of facing cloud platform big data processing
US9792135B2 (en) Differential voltage and frequency scaling (DVFS) switch reduction
Fei et al. Principles towards real-time simulation of material point method on modern GPUs

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20190419

RJ01 Rejection of invention patent application after publication