CN109871277B - Inter-process multi-request management method and device, terminal equipment and readable storage medium - Google Patents

Inter-process multi-request management method and device, terminal equipment and readable storage medium Download PDF

Info

Publication number
CN109871277B
CN109871277B CN201910061991.7A CN201910061991A CN109871277B CN 109871277 B CN109871277 B CN 109871277B CN 201910061991 A CN201910061991 A CN 201910061991A CN 109871277 B CN109871277 B CN 109871277B
Authority
CN
China
Prior art keywords
message
current
sequence identifier
data message
sequence
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.)
Expired - Fee Related
Application number
CN201910061991.7A
Other languages
Chinese (zh)
Other versions
CN109871277A (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.)
TP Link Technologies Co Ltd
Original Assignee
TP Link Technologies 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 TP Link Technologies Co Ltd filed Critical TP Link Technologies Co Ltd
Priority to CN201910061991.7A priority Critical patent/CN109871277B/en
Publication of CN109871277A publication Critical patent/CN109871277A/en
Application granted granted Critical
Publication of CN109871277B publication Critical patent/CN109871277B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Computer And Data Communications (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a method and a device for managing multiple requests among processes, terminal equipment and a readable storage medium, wherein the method comprises the following steps: receiving a current data message sent by a first process; judging whether a first sequence identifier of the current data message corresponds to a current second sequence identifier according to a preset first corresponding rule or not; if the first sequence identification of the current data message corresponds to the current second sequence identification according to the first corresponding rule, processing the request data of the current data message, and updating the current second sequence identification according to a preset updating rule; and if the first sequence identification of the current data message does not correspond to the second sequence identification of the current data message according to the first corresponding rule, storing the current data message into a preset message linked list, and processing the data message to be processed stored in the message linked list. The invention can realize the normal sequence processing of the data, ensure the correctness of the data processing and further improve the efficiency of data transmission.

Description

Inter-process multi-request management method and device, terminal equipment and readable storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for inter-process multi-request management, a terminal device, and a readable storage medium.
Background
A process is the basic unit of allocation of resources by a computer system. The operating system manages the resources of each Process through a Process Control Block (PCB) and isolates them from each other. In order to make different processes access resources to each other to coordinate work, communication modes among the processes are generated as required, and are used for information propagation or exchange among the processes.
Generally speaking, a main program runs a corresponding main process in the running process, and in one or more messages received by the main process, one or more request commands from other processes may exist, and one or more sub-processes carrying request data need to be generated correspondingly, and after a plurality of system calls are executed, the sub-processes are sent to other processes needing to request data. Because the main process sending the request data is located upstream of the data flow line relative to the other processes receiving the request data, and there may be an inclusion relationship between the request data, the other processes receiving the request data need to receive all the request data to complete the subsequent processing. However, the time required for various system calls may be inconsistent, which may cause confusion of connection order established between each sub-process and other processes receiving the request data, abnormal data transmission, and failure of other processes requiring the request data to normally process the received request data.
Disclosure of Invention
The technical problem to be solved by the embodiments of the present invention is to provide a method, an apparatus, a terminal device and a readable storage medium for inter-process multi-request management, which can implement data processing according to a normal sequence, ensure correctness of data processing, and further improve efficiency of data transmission.
In order to solve the above technical problem, an embodiment of the present invention provides an inter-process multi-request management method, where the method includes:
receiving a current data message sent by a first process; the current data message is generated by the first process responding to a request message sent by a second process correspondingly; the current data message carries a first sequence identifier and request data;
judging whether the first sequence identification of the current data message corresponds to the current second sequence identification according to a preset first corresponding rule or not; the first sequence identifier represents the sequence of analyzing the request data of the corresponding data message from the source data, and the second sequence identifier represents the sequence of correctly processing a plurality of request data by the second process;
if the first sequence identification of the current data message corresponds to the current second sequence identification according to the first corresponding rule, processing the request data of the current data message, and updating the current second sequence identification according to a preset updating rule;
and if the first sequence identification of the current data message does not correspond to the second sequence identification of the current data message according to the first corresponding rule, storing the current data message into a preset message linked list, and processing the data message to be processed stored in the message linked list.
Preferably, the processing the to-be-processed data packet stored in the packet chain table specifically includes:
judging whether a target data message corresponding to a first sequence identifier and a current second sequence identifier according to the first corresponding rule exists in the message linked list;
and if the target data message exists in the message linked list, processing the request data of the target data message, and updating the current second sequence identifier according to the updating rule.
Preferably, the message linked list is an ordered message linked list;
then, the storing the current data packet into a preset packet chain table specifically includes:
inserting the current data message into the ordered message linked list according to the first sequence identifier of the current data message;
distributing a third sequence identifier to the storage node corresponding to the current data message; and the third sequence identifier corresponds to the first sequence identifier of the current data message according to a preset second corresponding rule.
Preferably, the processing the to-be-processed data packet stored in the packet chain table specifically includes:
judging whether a target data message corresponding to the first sequence identifier and the current second sequence identifier according to the first corresponding rule exists in the ordered message linked list or not according to a third sequence identifier of a header storage node of the ordered message linked list;
if the target data message exists in the ordered message linked list, processing the request data of the target data message, and updating the current second sequence identifier according to the updating rule;
and deleting the target data message from the ordered message linked list.
Preferably, after the processing the request data of the current data packet and updating the current second sequence identifier according to a preset update rule, the method further includes:
judging whether the message linked list is empty or not;
when the message linked list is not empty, judging whether a target data message corresponding to a first sequence identifier and a current second sequence identifier according to the first corresponding rule exists in the message linked list;
and if the target data message exists in the message linked list, processing the request data of the target data message, and updating the current second sequence identifier according to the updating rule.
Preferably, the first rule is that the first sequence identifier is the same as the second sequence identifier.
Preferably, the first sequence identifier and the second sequence identifier are both digital serial numbers, the first corresponding rule is that the first sequence identifier is equal to the second sequence identifier, and the update rule is that 1 is added to the current second sequence identifier.
In order to solve the above technical problem, an embodiment of the present invention further provides an inter-process multi-request management apparatus, where the apparatus includes:
the receiving module is used for receiving the current data message sent by the first process; the current data message is generated by the first process responding to a request message sent by a second process correspondingly; the current data message carries a first sequence identifier and request data;
the judging module is used for judging whether the first sequence identification of the current data message corresponds to the current second sequence identification according to a preset first corresponding rule; the first sequence identifier represents the sequence of analyzing the request data of the corresponding data message from the source data, and the second sequence identifier represents the sequence of correctly processing a plurality of request data by the second process;
the first processing module is used for processing the request data of the current data message and updating the current second sequence identifier according to a preset updating rule if the first sequence identifier of the current data message corresponds to the current second sequence identifier according to the first corresponding rule;
and the second processing module is used for storing the current data message into a preset message linked list and processing the data message to be processed stored in the message linked list if the first sequence identifier of the current data message does not correspond to the current second sequence identifier according to the first corresponding rule.
In order to solve the technical problem, an embodiment of the present invention further provides a terminal device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where the processor implements the inter-process multi-request management method provided above when executing the computer program.
In order to solve the technical problem, an embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, and when the computer program runs, the apparatus where the computer-readable storage medium is located is controlled to execute the inter-process multi-request management method provided above.
The inter-process multi-request management method, the inter-process multi-request management device, the terminal equipment and the readable storage medium can manage the received data message, not blindly process the request data of the current received data message, but process the request data of the data message currently required to be processed by the second process, can process the data according to the normal sequence, ensure the correctness of data processing, and further improve the efficiency of data transmission.
Drawings
Fig. 1 is a schematic application scenario diagram of an inter-process multi-request management method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for inter-process multi-request management according to an embodiment of the present invention;
fig. 3 is a flowchart of an embodiment of processing the to-be-processed data stored in the message linked list in step S400 in the embodiment shown in fig. 2;
fig. 4 is a flowchart of an embodiment of storing the current data packet in a preset packet linked list in step S400 in the embodiment shown in fig. 2;
fig. 5 is a flowchart of another embodiment of processing the to-be-processed data stored in the message linked list in step S400 in the embodiment shown in fig. 2;
fig. 6 is a flowchart illustrating an inter-process multi-request management method according to a second embodiment of the present invention;
fig. 7 is a schematic structural diagram of an inter-process multi-request management apparatus according to a third embodiment of the present invention;
fig. 8 is a schematic structural diagram of a terminal device according to a fourth embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Referring to fig. 1, fig. 1 is a schematic view of an application scenario of a method for inter-process multi-request management according to an embodiment of the present invention.
In some application scenarios, a first process carries active data, which may contain request data needed by one or more second processes. When the second process needs to access the request data of the first process to work, the second process sends a request message to the first process to request the first process to send the required request data to the second process; and after receiving the request message of the second process, the first process responds to the request message sent by the second process, analyzes the request data in the source data, executes the call of a related system and sends the request message to the second process.
It should be noted that the source data of the first process may be input to the first process by other data sources, or may be carried by the first process itself; the source data input to the first process by the other data sources may come from a wide area network, a local area network, a cloud server, an interactive APP, etc.
Referring to fig. 2, fig. 2 is a flowchart illustrating an inter-process multi-request management method according to an embodiment of the present invention; specifically, the inter-process multi-request management method provided in this embodiment includes:
s100, receiving a current data message sent by a first process; the current data message is generated by the first process responding to a request message sent by a second process correspondingly; the current data message carries a first sequence identifier and request data;
s200, judging whether the first sequence identification of the current data message corresponds to the current second sequence identification according to a preset first corresponding rule;
s300, if the first sequence identification of the current data message corresponds to the current second sequence identification according to the first corresponding rule, processing the request data of the current data message, and updating the current second sequence identification according to a preset updating rule;
s400, if the first sequence identification of the current data message does not correspond to the second sequence identification of the current data message according to the first corresponding rule, storing the current data message into a preset message linked list, and processing the data message to be processed stored in the message linked list.
The first process may generate one or more data packets corresponding to the request packet sent by the second process, each data packet carries a first sequence identifier corresponding to the request packet of the data packet, and each first sequence identifier has a second sequence identifier uniquely corresponding to the first correspondence rule. The first sequence identifier carried by each data message represents the sequence of the request data of the data message analyzed from the source data, and the second sequence identifier updated according to the updating rule represents the sequence of the second process for correctly processing the plurality of request data. The second process needs to process one or more received data messages containing request data according to a correct processing sequence to ensure the correctness of data processing, and the correct processing sequence of the data messages needs the sequence of the data messages analyzed from the source data to correspond to each other.
Specifically, after sending a request message to the first process, the second process monitors a data message containing request data sent by the first process; the second process receives the current data message sent by the first process, and because the time length of calling each data message by the system is inconsistent, the current data message is not necessarily the data message needing to be processed currently, and the first sequence identification of the current data message also needs to be judged; judging whether a first sequence identifier of the current data message corresponds to a current second sequence identifier according to a preset first corresponding rule or not; if the first sequence identifier of the current data message corresponds to the current second sequence identifier according to the first corresponding rule, it is indicated that the current data message is a data message which needs to be processed currently by the second process, the request data of the current data message is processed, for example, the request data of the current data message is forwarded or written into a certain section of memory, and the like, and the current second sequence identifier is updated according to a preset updating rule, and the updated current second sequence identifier is a second sequence identifier corresponding to the first sequence identifier of a data message which needs to be processed next by the second process; if the first sequence identification of the current data message does not correspond to the current second sequence identification according to the first corresponding rule, the current data message is not the data message which needs to be processed currently by the second process, the request data processing of the current data message is not needed, the current data message is stored into a preset message linked list, and the data message to be processed which is stored in the message linked list is processed.
The inter-process multi-request management method provided by the embodiment of the invention can ensure that the request data processed by the second process each time needs to be processed for the second process currently, can realize the normal sequence processing of the data, ensures the correctness of data processing, and further improves the efficiency of data transmission.
It should be noted that the to-be-processed data packet stored in the packet chain table is processed, not necessarily the request data of the to-be-processed data packet stored in the packet chain table, and may be processed in one or more other processing situations, for example, the number of nodes of the packet chain table is detected, the first sequence identifiers of all the to-be-processed data packets of the packet chain table are detected in a traversal manner, the to-be-processed data packets of the packet chain table are sorted, deleted or inserted, or the request data of a specific to-be-processed data packet of the packet chain table is processed. If the current data packet is not the data packet currently required to be processed by the second process, the present embodiment does not limit the manner in which the second process acquires the data packet currently required to be processed, as long as it is ensured that the data packet processed by the second process is the data packet processed in the correct order, and for example, the second process may continue to receive the current data packet sent by the first process until the current data packet is the data packet currently required to be processed by the second process, or the second process preferentially uses the data packet to be processed in the packet chain table, detect whether the packet chain table contains the data packet currently required to be processed, if so, process the request data of the data packet currently required to be processed in the packet chain table, or the second process does not preferentially use the data packet to be processed in the packet chain table, if it is known from the packet chain table that the data packet currently required to be processed has been received early, and retransmitting the request message of the data message to the first process so that the first process retransmits the data message.
Optionally, the message linked list may be set as a message linked list with a fixed preset linked list length, and the current data message is stored in an established node of the message linked list; the message linked list can also be set as a linked list with unknown linked list length, and a node is added for storing the current data message when the current data message needs to be stored in the message linked list; the message linked list can also be set as a linked list which has a preset linked list length at the initial time and the linked list length can be adjusted according to the requirement of storing the current data message.
Optionally, the message linked list may be an unordered linked list or an ordered linked list, that is, the to-be-processed data messages stored in the message linked list may be stored in an unordered arrangement or in an unordered arrangement.
It should be noted that the chain table length setting of the message chain table and the unordered/ordered setting of the message chain table are independent from each other, and those skilled in the art can freely set the length according to actual requirements. For example, the message linked list is set to be an unordered linked list with a fixed preset linked list length, the number of storage nodes of the message linked list is set to be 30, and when the current data message needs to be stored, and when a certain storage node of the message linked list is detected to be an empty node without stored data, the current data message is stored on the empty node; for another example, the message linked list is set to be an ordered linked list with a fixed preset linked list length, the number of storage nodes of the message linked list is set to be not less than the number of request data required by the second process, each data message has a corresponding storage node in the ordered message linked list, and the arrangement sequence of the storage nodes in the ordered linked list corresponds to the processing sequence of the corresponding data message one to one.
Optionally, the first sequence identifier and the second sequence identifier may be in various forms, such as a string of numbers, letters, punctuation marks, and combinations thereof; the first correspondence rule may also be in various forms as long as there is a correspondence mapping relationship between the first order identifier and the second order identifier. For example, the first sequence identifiers 1, 2, 5, 4, and 5 respectively correspond to the second sequence identifiers 1, 2, 3, 4, and 5 according to the first corresponding rule, or respectively correspond to the second sequence identifiers 5, 3, 4, 1, and 2 according to the first corresponding rule, or respectively correspond to the second sequence identifiers A, B, C, D, E according to the first corresponding rule; for example, the first sequence identifier A, B, C, D, E corresponds to the second sequence identifiers a, B, C, D, and E according to the first corresponding rule, or corresponds to the second sequence identifiers E, g, f, D, and h according to the first corresponding rule, or corresponds to the second sequence identifiers 1A, 2B, 3C, 4D, and 5E according to the first corresponding rule.
It should be noted that, the process of parsing one or more request data from the source data by the first process to respond to the request packet of the second process may be: the method comprises the steps that a first process analyzes request data of source data, and when one request data is analyzed, a unique first sequence identification is distributed to the request data, a setenv interface is called, and the first sequence identification is set as an environment variable, so that a subsequent related process can read the first sequence identification; meanwhile, the first process repeatedly engraves a first sub-process for the request data through the fork function, the first sub-process inherits the copy of the data space, the stack and the stack of the first process, the request data and a first sequence identifier set as an environment variable are copied in the first sub-process, the first sub-process reads the first sequence identifier through calling the getenv function, the first sequence identifier is written in the request data to form a new data message, and after certain system calling is executed, for example, after read-write operation or IO (input/output) system calling related to the response process is executed, the formed new data message is sent to the second process. As shown in fig. 1, the data packet data1, the data packet data2, and the data packet data3 are new data packets, and are sent to the second process after the system call is executed.
Optionally, in the process that the first process parses one or more request data from the source data to respond to the request packet of the second process, the second sub-process may replace the first sub-process to process the request data and the first sequence identifier, that is, after the request data and the first sequence identifier set as the environment variable are copied to the first sub-process, the first sub-process may further call an exec function to generate the second sub-process to replace the first sub-process, the second sub-process reads the first sequence identifier by calling a getenv function, writes the first sequence identifier into the request data, and forms a data packet carrying the request data and the corresponding first sequence identifier, and sends the data packet to the second process after executing a certain system call. The second subprocess replaces the first subprocess, so that the process for processing the request data is disconnected from the first subprocess, all the request data is processed by the second subprocess, and the first subprocess can continue to process other request data, thereby accelerating the data processing speed and improving the data transmission efficiency.
Optionally, the data packet generally carrying the request data includes the request data and a packet header, where the packet header may contain other data, for example, whether the request data needs to be forwarded, related information of forwarding, and the like, and the first sub-process writes the first sequence identifier into the request data through the following processes: the first sub-process opens up a new field in the message header and stores the read first sequence identifier in the new field to form a new data message carrying the request data and the corresponding first sequence identifier.
Referring to fig. 3, a flowchart of an embodiment of processing the to-be-processed data stored in the message linked list in step S400 in the embodiment shown in fig. 2 is shown.
Preferably, the processing the to-be-processed data packet stored in the packet chain table specifically includes:
s401, judging whether a target data message corresponding to a first sequence identifier and a current second sequence identifier exists in the message linked list according to the first corresponding rule;
s402, if the target data message exists in the message linked list, processing the request data of the target data message, and updating the current second sequence identifier according to the updating rule.
Specifically, the second process preferentially uses the data packet to be processed in the packet linked list, and if the current data packet is not the data packet that the second process needs to process currently, whether a target data packet exists in the packet linked list is determined, and if the target data packet exists in the packet linked list, the request data of the target data packet is processed, and the current second sequence identifier is updated.
It should be noted that, if the target data packet does not exist in the packet chain table, it is indicated that the first process has not sent the data packet that the second process needs to process currently to the second process, and the second process continues to monitor the data packet sent by the first process.
The inter-process multi-request management method provided by the embodiment of the invention can realize that the target data message stored in the message linked list is preferentially used, and the data message required to be processed currently in the second process is acquired from the step S100 to the step S200 without storing the target data message, so that the time for acquiring the current data message is reduced, and the data processing efficiency is further improved.
Referring to fig. 4, a flowchart of an embodiment of storing the current data packet in a preset packet chain table in step S400 in the embodiment shown in fig. 2 is shown.
Preferably, the message linked list is an ordered message linked list;
then, the storing the current data packet into a preset packet chain table specifically includes:
s403, inserting the current data message into the ordered message linked list according to the first sequence identifier of the current data message;
s404, distributing a third sequence identifier for the storage node corresponding to the current data message; and the third sequence identifier corresponds to the first sequence identifier of the current data message according to a preset second corresponding rule.
Specifically, the message linked list is a linked list with an unknown linked list length, and if the current data message needs to be stored in the message linked list, the current data message is inserted into the ordered message linked list according to the first sequence identifier of the current data message, and a third sequence identifier is allocated to the storage node corresponding to the current data message. The data messages to be processed stored in the message linked list all have corresponding third sequence identifiers, and the third sequence identifiers of the storage nodes correspond to the first sequence identifiers according to a preset second corresponding rule, the second process can obtain the second sequence identifiers corresponding to the third sequence identifiers one to one according to the first corresponding rule and the second corresponding rule, and then whether the message linked list contains the third sequence identifiers corresponding to the current second sequence identifiers can be detected, and the storage nodes where the third sequence identifiers corresponding to the current second sequence identifiers are located are the storage nodes for storing the data messages which are required to be processed by the second process at present.
Optionally, the second sequence identifier corresponding to each third sequence identifier may be indirectly determined through the first corresponding rule and the second corresponding rule, and a person skilled in the art may further set a third corresponding rule according to the first corresponding rule and the second corresponding rule, where the third corresponding rule directly specifies the second sequence identifier corresponding to each third sequence identifier, and when the second sequence identifier corresponding to each third sequence identifier is determined, the second sequence identifier corresponding to each third sequence identifier may be directly obtained through the third corresponding rule, and it is not necessary to deduce the second sequence identifier corresponding to each third sequence identifier from the first corresponding rule and the second corresponding rule every time of correspondence.
The message linked list is set to be the linked list with unknown linked list length, so that the message linked list can be ensured to have storage nodes for storing the current data message, the number of the storage nodes of the message linked list can be reduced, and the occupation of memory resources is reduced. The message linked list is set as an ordered linked list, the data messages to be processed are arranged according to the processing sequence, and the insertion positions of the storage nodes can be determined according to the first sequence identifier, the first corresponding rule and the updating rule; and generally, to-be-processed data messages in the message linked list are processed, which are sequentially detected or processed from a header storage node, the message linked list is set as an ordered linked list, and if the message linked list has data messages to be processed by the second process, once the data messages to be processed by the second process are detected, the following to-be-processed data messages do not need to be judged, so that the data processing efficiency is further improved.
Referring to fig. 5, a flowchart of another embodiment of processing the to-be-processed data stored in the message linked list in step S400 in the embodiment shown in fig. 2 is shown.
Preferably, the processing the to-be-processed data packet stored in the packet chain table specifically includes:
s405, judging whether a target data message corresponding to the first sequence identifier and the current second sequence identifier according to the first corresponding rule exists in the ordered message linked list according to a third sequence identifier of a header storage node of the ordered message linked list;
s406, if the target data message exists in the ordered message linked list, processing the request data of the target data message, and updating the current second sequence identifier according to the updating rule;
s407, deleting the target data message from the ordered message linked list.
Specifically, after the target data message is processed, the target data message is deleted in the message linked list, so that the data messages to be processed stored in the message linked list are all unprocessed, because the message linked list is an ordered message linked list, the data messages to be processed are arranged in the message linked list according to the processing sequence, the data message to be processed stored in the head storage node of the ordered message linked list is the data message which is the most processed data message in all the data messages to be processed, whether the target data message with the first sequence identifier corresponding to the current second sequence identifier according to the first corresponding rule exists in the ordered message linked list can be judged only by judging the third sequence identifier of the head storage node, if the third sequence identifier of the head storage node corresponds to the current second sequence rule according to the first corresponding rule and the second corresponding rule, the data message to be processed of the head storage node is the target data message, and the ordered message linked list has a target data message, otherwise, the data message to be processed of the header storage node is not the target data message, and the ordered message linked list does not have the target data message.
According to the inter-process multi-request management method provided by the embodiment of the invention, only the third sequence identification of the head storage node is judged, whether the target data message exists in the ordered message linked list can be judged, all data messages to be processed are not subjected to traversal detection or processing, the judgment times of the storage node can be reduced, the data processing efficiency is further improved, and the data transmission efficiency is improved; and the processed target data message is deleted in the message linked list, so that the waste of system resources can be reduced.
Example two
Referring to fig. 6, a flowchart of an inter-process multi-request management method according to a second embodiment of the present invention is shown.
Preferably, after the processing the request data of the current data packet and updating the current second sequence identifier according to a preset update rule, the method further includes:
s500, judging whether the message linked list is empty or not;
s600, when the message linked list is not empty, judging whether a target data message corresponding to a first sequence identifier and a current second sequence identifier according to the first corresponding rule exists in the message linked list or not;
s700, if the target data message exists in the message linked list, processing the request data of the target data message, and updating the current second sequence identifier according to the updating rule.
Specifically, after the request data of the current data message is processed and the current second sequence identifier is updated according to a preset updating rule, whether the message linked list is empty is judged, if the message linked list is not empty, the message linked list is indicated to store the data message to be processed, and whether the target data message exists in the message linked list is judged; and if the target data message exists in the message linked list, processing the request data of the target data message, and updating the current second sequence identifier according to the updating rule.
It should be noted that the current second sequence identifier is not a fixed second sequence identifier of a certain data packet, the data packet processed by the second process currently changes continuously, and the current second sequence identifier also changes continuously according to the update rule. For example, assuming that the first sequence identifiers 1, 2, and 3 correspond to the second sequence identifiers 1, 2, and 3, respectively, and the second sequence identifier is updated to 2 according to the update rule update sequence 1, and then updated to 3 from 2, the first sequence identifier carried by the current data packet data1 received by the second process is 1, and the current second sequence identifier is 1, then the request data of the current data packet data1 is processed, and the current second sequence identifier is updated to 2 according to the update rule; and if the carried target data message with the first sequence identifier of 2 exists in the message linked list, processing the target data message, and updating the current second sequence identifier to 3.
It should be noted that steps S500 to S700 may also be executed after processing the request data of the target data packet and updating the current second sequence identifier according to the update rule, that is, steps S500 to S700 may be executed after processing the data packet corresponding to the first sequence identifier and the current second sequence identifier according to the first corresponding rule each time.
In the inter-process multi-request management method provided by the embodiment of the invention, the data message sent by the first process is monitored continuously after all the target data messages stored in the message linked list are preferentially used, so that the target data messages stored in the message linked list can be preferentially used, and the data message currently required to be processed by the second process is obtained from the step S100 to the step S200 without storing the target data messages, thereby further reducing the time for obtaining the current data message and improving the data processing efficiency.
Preferably, the first rule is that the first sequence identifier is the same as the second sequence identifier.
Specifically, the first correspondence rule is that the first sequence identifier is the same as the second sequence identifier, so that the complexity of correspondence between the first sequence identifier and the second sequence identifier can be reduced, and the judgment procedure of the data packet can be simplified.
It should be noted that, if the packet linked list is an ordered packet linked list and the storage node is assigned with a corresponding third sequence identifier, the second corresponding rule specifies a corresponding relationship between the third sequence identifier and the first sequence identifier, and similarly, the second corresponding rule may be set such that the third sequence identifier is the same as the first sequence identifier. If a third rule is additionally set to directly specify the correspondence between the third sequence identifier and the second sequence identifier, the third rule may be set to have the same third sequence identifier as the second sequence identifier.
Preferably, the first sequence identifier and the second sequence identifier are both digital serial numbers, the first corresponding rule is that the first sequence identifier is equal to the second sequence identifier, and the update rule is that 1 is added to the current second sequence identifier.
The inter-process multi-request management method provided by the embodiment of the invention can conveniently embody the sequence represented by the first sequence identifier and the second sequence identifier, is beneficial to technical personnel to maintain operation related programs, has a simple algorithm, does not need the technical personnel to set each first sequence identifier and each second sequence identifier one by one, and can reduce the research and development cost.
Optionally, infinite number values do not exist in the computer storage, that is, when the first sequence identifier and the second sequence identifier are number numbers, an upper limit value and a lower limit value exist, and when the first sequence identifier and the second sequence identifier exceed the upper limit value, the first sequence identifier and the second sequence identifier are turned into a lower limit value to be updated and changed circularly.
Optionally, when determining the insertion position of the current data packet, first determining whether the first sequence identifier of the current data packet is smaller than the current second sequence identifier, if the first sequence identifier of the current data packet is smaller than the current second sequence identifier, not directly discarding the current data packet or determining the insertion position of the current data packet according to the size of the first sequence identifier, but determining whether a to-be-processed data packet whose first sequence identifier is smaller than the current second sequence identifier exists in the ordered packet chain table, and if the to-be-processed data packet whose first sequence identifier is smaller than the current second sequence identifier does not exist in the ordered packet chain table, inserting the current data packet into the end of the ordered chain table; if the data message to be processed with the first sequence identifier smaller than the current second sequence identifier exists in the ordered message linked list, the insertion position of the current data message is determined in all the data messages to be processed with the first sequence identifier smaller than the current second sequence identifier according to the size of the first sequence identifier. For example, setting the upper limit value of the number sequence number to be 100, the lower limit value to be 1, storing the to-be-processed data packets with the first sequence identifiers of 88, 90, 95, 96, 97, 98, 99, and 100 in the ordered packet chain table, setting the current second sequence identifier to be 87, setting the first sequence identifier of the received current data packet to be 2, indicating that the first sequence identifier of the current data packet is the number sequence after the numerical value is reversed, and inserting the current data packet into the end of the ordered packet chain table when the to-be-processed data packet with the first sequence identifier of 88, 90, 95, 96, 97, 98, 99, 100, and 2 does not exist in the ordered packet chain table; if the current data message sent by the first process is continuously received, the first sequence identifier of the current data message is 3 and is smaller than the current second sequence identifier 87, and the to-be-processed data message of which the first sequence identifier is smaller than the current second sequence identifier exists in the ordered message linked list, determining the insertion position of the current data message in all the to-be-processed data messages of which the first sequence identifier is smaller than the current second sequence identifier according to the size of the first sequence identifier, namely the to-be-processed data message of which the first sequence identifier 3 is larger than the first sequence identifier 2 of the current data message is inserted behind the to-be-processed data message of which the first sequence identifier is 2.
In specific implementation, the second process receives the current data message sent by the first process; judging whether a first sequence identifier of the current data message corresponds to a current second sequence identifier according to a preset first corresponding rule or not; if the first sequence identification of the current data message corresponds to the current second sequence identification according to the first corresponding rule, processing the request data of the current data message, and updating the current second sequence identification according to a preset updating rule; and if the first sequence identification of the current data message does not correspond to the second sequence identification of the current data message according to the first corresponding rule, storing the current data message into a preset message linked list, and processing the data message to be processed stored in the message linked list.
The inter-process multi-request management method provided by the embodiment of the invention can manage the received data message, not blindly process the request data of the current received data message, but process the request data of the data message currently required to be processed by the second process, can realize the processing of the data according to the normal sequence, ensures the correctness of the data processing, and further improves the efficiency of data transmission.
EXAMPLE III
Fig. 7 is a schematic structural diagram of an inter-process multi-request management apparatus according to a third embodiment of the present invention.
The second embodiment of the present invention further provides an inter-process multi-request management apparatus, which includes,
a receiving module 11, configured to receive a current data packet sent by a first process; the current data message is generated by the first process responding to a request message sent by a second process correspondingly; the current data message carries a first sequence identifier and request data;
a judging module 12, configured to judge whether the first sequence identifier of the current data packet corresponds to the current second sequence identifier according to a preset first corresponding rule;
a first processing module 13, configured to process the request data of the current data packet and update the current second sequence identifier according to a preset update rule if the first sequence identifier of the current data packet corresponds to the current second sequence identifier according to the first corresponding rule;
the second processing module 14 is configured to store the current data packet in a preset packet chain table and process the to-be-processed data packet stored in the packet chain table if the first sequence identifier of the current data packet does not correspond to the current second sequence identifier according to the first correspondence rule.
Preferably, the second processing module 14 further comprises:
a first judging unit, configured to judge whether a target data packet exists in the packet chain table, where the target data packet includes a first sequence identifier and a current second sequence identifier, and the first sequence identifier corresponds to the current second sequence identifier according to the first corresponding rule;
and the first processing unit is used for processing the request data of the target data message and updating the current second sequence identifier according to the updating rule if the target data message exists in the message linked list.
Preferably, the message linked list is an ordered message linked list;
then, the second processing module 14 further includes:
the inserting unit is used for inserting the current data message into the ordered message linked list according to the first sequence identifier of the current data message;
the distribution unit is used for distributing a third sequence identifier to the storage node corresponding to the current data message; and the third sequence identifier corresponds to the first sequence identifier of the current data message according to a preset second corresponding rule.
Preferably, the apparatus further comprises:
and the deleting module is used for deleting the target data message from the ordered message linked list after the request data of the target data message is processed and the current second sequence identifier is updated according to the updating rule.
Preferably, the second processing module 14 further comprises:
a second judging unit, configured to judge, according to a third sequence identifier of a header storage node of the ordered packet linked list, whether a target data packet corresponding to the first sequence identifier and the current second sequence identifier according to the first correspondence rule exists in the ordered packet linked list;
and the second processing unit is used for processing the request data of the target data message and updating the current second sequence identifier according to the updating rule if the target data message exists in the ordered message linked list.
Preferably, the apparatus further comprises:
a third judging unit, configured to judge whether the message linked list is empty;
the third processing unit is used for judging whether a target data message corresponding to the first sequence identifier and the current second sequence identifier according to the first corresponding rule exists in the message linked list or not when the message linked list is not empty;
and the fourth processing unit is used for processing the request data of the target data message and updating the current second sequence identifier according to the updating rule if the target data message exists in the message linked list.
Preferably, the first rule is that the first sequence identifier is the same as the second sequence identifier.
Preferably, the first sequence identifier and the second sequence identifier are both digital serial numbers, the first corresponding rule is that the first sequence identifier is equal to the second sequence identifier, and the update rule is that 1 is added to the current second sequence identifier.
The inter-process multi-request management device provided by the embodiment of the invention receives the current data message sent by the first process through the receiving module 11; judging whether the first sequence identifier of the current data message corresponds to the current second sequence identifier according to a preset first corresponding rule through a judging module 12; if the first sequence identifier of the current data message corresponds to the current second sequence identifier according to the first corresponding rule, processing the request data of the current data message through the first processing module 13, and updating the current second sequence identifier according to a preset updating rule; if the first sequence identifier of the current data packet does not correspond to the second sequence identifier of the current data packet according to the first corresponding rule, the current data packet is stored in a preset packet chain table through the second processing module 14, and the data packet to be processed stored in the packet chain table is processed.
The inter-process multi-request management device provided by the embodiment of the invention can manage the received data message, not blindly process the request data of the current received data message, but process the request data of the data message currently required to be processed by the second process, can process the data according to a normal sequence, ensures the correctness of data processing, and further improves the efficiency of data transmission.
It should be noted that the inter-process multi-request management apparatus provided in the second embodiment of the present invention is configured to execute the steps of the inter-process request management method described in the foregoing embodiment, and working principles and beneficial effects of the two are in one-to-one correspondence, so that details are not described again.
It will be understood by those skilled in the art that the schematic diagram of the interprocess multiple request management apparatus is merely an example of the interprocess multiple request management apparatus, and does not constitute a limitation of the interprocess multiple request management apparatus, and may include more or less components than those shown, or combine some components, or different components, for example, the interprocess multiple request management apparatus may further include an input/output device, a network access device, a bus, etc.
Example four
Please refer to fig. 8, which is a schematic structural diagram of a terminal device according to a fourth embodiment of the present invention.
The fourth embodiment of the present invention further provides a terminal device, which includes a processor 10, a memory 20, and a computer program stored in the memory and configured to be executed by the processor, where the processor implements the inter-process multi-request management method according to the foregoing embodiment when executing the computer program.
Specifically, all can be one or more for processor, the memory among this terminal equipment, and electronic equipment can be computer, cell-phone, flat board, server, mutual APP, high in the clouds equipment etc..
The electronic device of the embodiment includes: a processor, a memory, and a computer program stored in the memory and executable on the processor. When executing the computer program, the processor implements the steps in the inter-process multi-request management method provided in the above embodiment, for example, step S100 shown in fig. 2, and receives a current data packet sent by a first process. Or, the processor, when executing the computer program, implements the functions of the modules in the foregoing device embodiments, for example, implements the receiving module 11, configured to receive the current data packet sent by the first process.
Illustratively, the computer program can be divided into one or more modules/units (e.g., computer program 1, computer program 2, FIG. 8), which are stored in the memory and executed by the processor to carry out the invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used for describing the execution process of the computer program in the terminal device. For example, the computer program may be divided into the receiving module 11, the determining module 12, the first processing module 13, and the second processing module 14, and the specific functions of each module are as follows:
a receiving module 11, configured to receive a current data packet sent by a first process; the current data message is generated by the first process responding to a request message sent by a second process correspondingly; the current data message carries a first sequence identifier and request data;
a judging module 12, configured to judge whether the first sequence identifier of the current data packet corresponds to the current second sequence identifier according to a preset first corresponding rule;
a first processing module 13, configured to process the request data of the current data packet and update the current second sequence identifier according to a preset update rule if the first sequence identifier of the current data packet corresponds to the current second sequence identifier according to the first corresponding rule;
a second processing module 14, configured to store the current data packet in a preset packet chain table and process the to-be-processed data packet stored in the packet chain table if the first sequence identifier of the current data packet does not correspond to the current second sequence identifier according to the first corresponding rule
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like that is the control center for the electronic device and that connects the various parts of the overall electronic device using various interfaces and wires.
The memory may be used to store the computer programs and/or modules, and the processor may implement various functions of the electronic device by running or executing the computer programs and/or modules stored in the memory and calling data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
Wherein, the terminal device integrated module/unit can be stored in a computer readable storage medium if it is implemented in the form of software functional unit and sold or used as a stand-alone product. Based on such understanding, all or part of the flow in the inter-process multi-request management method provided by the above embodiments may be implemented by a computer program, which may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the steps of the inter-process multi-request management method provided by any of the above embodiments may be implemented. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, and the like. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
It should be noted that the terminal device may include, but is not limited to, a processor and a memory, and those skilled in the art will understand that the structural diagram of fig. 8 is only an example of the terminal device and does not constitute a limitation to the terminal device, and may include more or less components than those shown, or combine some components, or different components.
EXAMPLE five
The fifth embodiment of the present invention further provides a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, and when the computer program runs, the device where the computer-readable storage medium is located is controlled to execute the inter-process multi-request management method.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention.

Claims (10)

1. An inter-process multi-request management method, the method comprising:
receiving a current data message sent by a first process; the current data message is generated by the first process responding to a request message sent by a second process correspondingly; the current data message carries a first sequence identifier and request data;
judging whether the first sequence identification of the current data message corresponds to the current second sequence identification according to a preset first corresponding rule or not; the first sequence identifier represents the sequence of analyzing the request data of the corresponding data message from the source data, and the second sequence identifier represents the sequence of correctly processing a plurality of request data by the second process;
if the first sequence identification of the current data message corresponds to the current second sequence identification according to the first corresponding rule, processing the request data of the current data message, and updating the current second sequence identification according to a preset updating rule;
and if the first sequence identification of the current data message does not correspond to the second sequence identification of the current data message according to the first corresponding rule, storing the current data message into a preset message linked list, and processing the data message to be processed stored in the message linked list.
2. The inter-process multi-request management method according to claim 1, wherein the processing the to-be-processed data packet stored in the packet chain table specifically comprises:
judging whether a target data message corresponding to a first sequence identifier and a current second sequence identifier according to the first corresponding rule exists in the message linked list;
and if the target data message exists in the message linked list, processing the request data of the target data message, and updating the current second sequence identifier according to the updating rule.
3. The inter-process multi-request management method of claim 1, wherein the message linked list is an ordered message linked list;
then, the storing the current data packet into a preset packet chain table specifically includes:
inserting the current data message into the ordered message linked list according to the first sequence identifier of the current data message;
distributing a third sequence identifier to the storage node corresponding to the current data message; and the third sequence identifier corresponds to the first sequence identifier of the current data message according to a preset second corresponding rule.
4. The inter-process multi-request management method according to claim 3, wherein the processing the to-be-processed data packet stored in the packet chain table specifically comprises:
judging whether a target data message corresponding to the first sequence identifier and the current second sequence identifier according to the first corresponding rule exists in the ordered message linked list or not according to a third sequence identifier of a header storage node of the ordered message linked list;
if the target data message exists in the ordered message linked list, processing the request data of the target data message, and updating the current second sequence identifier according to the updating rule;
and deleting the target data message from the ordered message linked list.
5. The inter-process multi-request management method according to claim 1, wherein after the processing the request data of the current data packet and updating the current second sequence identifier according to a preset update rule, the method further comprises:
judging whether the message linked list is empty or not;
when the message linked list is not empty, judging whether a target data message corresponding to a first sequence identifier and a current second sequence identifier according to the first corresponding rule exists in the message linked list;
and if the target data message exists in the message linked list, processing the request data of the target data message, and updating the current second sequence identifier according to the updating rule.
6. The method according to any of claims 1 to 5, wherein the first rule is that the first sequence identifier is the same as the second sequence identifier.
7. The method according to any of claims 1 to 5, wherein the first sequence identifier and the second sequence identifier are both numerical sequence numbers, the first rule is that the first sequence identifier is equal to the second sequence identifier, and the update rule is that 1 is added to the current second sequence identifier.
8. An inter-process multi-request management apparatus, the apparatus comprising:
the receiving module is used for receiving the current data message sent by the first process; the current data message is generated by the first process responding to a request message sent by a second process correspondingly; the current data message carries a first sequence identifier and request data;
the judging module is used for judging whether the first sequence identification of the current data message corresponds to the current second sequence identification according to a preset first corresponding rule; the first sequence identifier represents the sequence of analyzing the request data of the corresponding data message from the source data, and the second sequence identifier represents the sequence of correctly processing a plurality of request data by the second process;
the first processing module is used for processing the request data of the current data message and updating the current second sequence identifier according to a preset updating rule if the first sequence identifier of the current data message corresponds to the current second sequence identifier according to the first corresponding rule;
and the second processing module is used for storing the current data message into a preset message linked list and processing the data message to be processed stored in the message linked list if the first sequence identifier of the current data message does not correspond to the current second sequence identifier according to the first corresponding rule.
9. A terminal device comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, the processor implementing the inter-process multi-request management method of any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, comprising a stored computer program, wherein the computer program, when executed, controls an apparatus in which the computer-readable storage medium is located to perform the method of inter-process multi-request management according to any one of claims 1 to 7.
CN201910061991.7A 2019-01-22 2019-01-22 Inter-process multi-request management method and device, terminal equipment and readable storage medium Expired - Fee Related CN109871277B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910061991.7A CN109871277B (en) 2019-01-22 2019-01-22 Inter-process multi-request management method and device, terminal equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910061991.7A CN109871277B (en) 2019-01-22 2019-01-22 Inter-process multi-request management method and device, terminal equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN109871277A CN109871277A (en) 2019-06-11
CN109871277B true CN109871277B (en) 2021-03-16

Family

ID=66917912

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910061991.7A Expired - Fee Related CN109871277B (en) 2019-01-22 2019-01-22 Inter-process multi-request management method and device, terminal equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN109871277B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116405443A (en) * 2023-03-28 2023-07-07 中科驭数(北京)科技有限公司 Message forwarding method, device, equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101699797B (en) * 2009-11-13 2012-07-11 珠海网博信息科技有限公司 Method for performing data transmission by using UDP protocol
CN102685000B (en) * 2012-04-24 2017-12-19 中兴通讯股份有限公司 A kind of MP fragments sequence number synchronization realizing method, equipment and system
CN103036904B (en) * 2012-12-27 2015-10-21 东方通信股份有限公司 A kind of udp protocol that uses in a communication network carries out the method for reliable data transmission
CN106330414B (en) * 2016-08-16 2021-03-26 新华三技术有限公司 Message transmission method and device
CN108234084A (en) * 2017-12-21 2018-06-29 深圳市欣博跃电子有限公司 A kind of receiving/transmission method of data, device and equipment
CN109150684B (en) * 2018-07-20 2021-04-06 新华三技术有限公司 Message processing method and device, communication equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN109871277A (en) 2019-06-11

Similar Documents

Publication Publication Date Title
CN108776934B (en) Distributed data calculation method and device, computer equipment and readable storage medium
CN108494771B (en) Electronic device, firewall opening verification method and storage medium
CN110677462B (en) Access processing method, system, device and storage medium for multi-block chain network
WO2020248375A1 (en) Method and system for synchronizing data between databases, computer device and storage medium
CN110875850B (en) Firmware upgrading method and system, readable storage medium and terminal equipment
CN111400041A (en) Server configuration file management method and device and computer readable storage medium
CN109348434B (en) Scene information sending method, sending device and terminal equipment
CN117238433B (en) Method for automatically isolating document data based on Libreoffice
US10205813B2 (en) Method and system for detecting abnormal contact information and server
CN109871277B (en) Inter-process multi-request management method and device, terminal equipment and readable storage medium
CN111405059A (en) Data transmission method of cloud equipment, electronic equipment and Internet of things system
CN106790380A (en) Data reporting method and device
CN111049913B (en) Data file transmission method and device, storage medium and electronic equipment
CN112422485B (en) Communication method and device of transmission control protocol
CN112380411B (en) Sensitive word processing method, device, electronic equipment, system and storage medium
CN114827967A (en) Software updating method, Bluetooth device and storage medium
CN113726885A (en) Method and device for adjusting flow quota
CN108566293B (en) Electronic device, zk node information notification method, and storage medium
CN108874560B (en) Method and communication device for communication
CN112291212A (en) Static rule management method and device, electronic equipment and storage medium
CN111538651A (en) Interface testing method, device, server and storage medium
CN112055058A (en) Data storage method and device and computer readable storage medium
CN112559233A (en) Method, device, equipment and computer readable medium for identifying fault type
CN116886463B (en) Cascade communication method, device, equipment and medium
CN113626295A (en) Pressure measurement data processing method and system and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20210316