A process communication method, terminal, storage medium and program product
By monitoring the information sequence number and the sequence number reset indicator, the information sending process can suspend or resume information sending in asynchronous communication, which solves the problem of the information receiving process crashing due to excessive load and improves the stability and efficiency of process communication.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2023-12-15
- Publication Date
- 2026-05-15
AI Technical Summary
In asynchronous communication scenarios between processes, the information receiving process may become overloaded and prone to crashing due to receiving too much information.
The information sending process monitors the information sequence number to determine whether it exceeds the warning threshold, and suspends or resumes information sending if necessary. Upon receiving a sequence number reset instruction, the sequence number is renumbered to ensure that the information receiving process can process the information in a timely manner.
It reduces the probability of the information receiving process crashing, improves the stability and efficiency of process communication, and prevents the information receiving process from crashing due to excessive load.
Smart Images

Figure CN120196453B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and more particularly to a process communication method, terminal, storage medium, and program product. Background Technology
[0002] Mobile phones, tablets, and other mobile devices have operating systems deployed on them. When various applications installed on these devices run, the operating system creates independent processes for each application. Processes generally do not share memory, and therefore do not share information within their respective memory. Consequently, processes need to communicate with each other to exchange information.
[0003] Inter-process communication includes synchronous and asynchronous communication. In asynchronous communication scenarios, after sending information to the receiving process, the sending process can send subsequent information without receiving any return information from the receiving process. Therefore, in this scenario, the sending process does not pay attention to the receiving process's information reception status or load, and will continuously send information to the receiving process.
[0004] Thus, when the information receiving process receives too much information in a short period of time, it will cause the information receiving process to be overloaded, which may lead to the information receiving process crashing. Summary of the Invention
[0005] In view of this, this application provides a process communication method, terminal, storage medium, and program product to reduce the probability of process crashes during inter-process communication.
[0006] In a first aspect, embodiments of this application provide a process communication method applied to an information sending process, the method comprising:
[0007] Determine the sequence number of the first message to be sent;
[0008] If the first information sequence number is greater than or equal to the first warning threshold, the transmission of the first information to be sent to the information receiving process shall be temporarily suspended.
[0009] In response to receiving a sequence number reset instruction from the information receiving process, a new second information sequence number for the information to be sent is set starting from the initial information sequence number, and the sending of the delayed information to be sent and the information sequence number of the information to be sent to the information receiving process is resumed.
[0010] It can be seen that, on the one hand, when the sequence number of the first message to be sent is greater than the first warning threshold, the information sending process will temporarily suspend sending the first message to be sent to the information receiving process. Since the information sending process sends messages to the information receiving process sequentially and assigns a number to each message, the sequence number of the message actually reflects the number of messages that the information sending process has already sent to the information receiving process. The larger the sequence number, the more messages the information sending process has sent to the information receiving process; conversely, the smaller the sequence number, the fewer messages the information sending process has sent to the information receiving process. Thus, when the sequence number of the first message to be sent is greater than the first warning threshold, it indicates that the information sending process has already sent a large number of messages to the information receiving process. Therefore, temporarily suspending the sending of the first message to be sent to the information receiving process can reduce the probability of sending too many messages to the information receiving process, making it difficult for the information receiving process to process the received information in a timely manner and causing a crash, thereby improving the stability of process communication.
[0011] On the other hand, the information receiving process sends a sequence number reset instruction to the information sending process. This sequence number reset instruction indicates that the information receiving process has acknowledged receiving the information sent by the information sending process. Therefore, upon receiving the sequence number reset instruction from the information receiving process, the information sending process can determine that it has received the information and can continue processing subsequent information. Thus, the information sending process can start numbering new information from the initial sequence number and resume sending the temporarily delayed information to the information sending process.
[0012] It is evident that the information sending process can not only postpone sending subsequent information when too many messages are sent to the information receiving process, but also resume sending the postponed information after the information receiving process confirms receipt of the information. This can reduce the probability of the information receiving process crashing while maximizing communication efficiency.
[0013] In one embodiment of this application, the method further includes:
[0014] If the first information sequence number is less than the first warning threshold, the first information to be sent and the first information sequence number are sent to the information receiving process.
[0015] When the sequence number of the first information is less than the first warning threshold, it indicates that the sequence number of the information sent by the information sending process is small. This means that the information sending process has recently received a sequence number reset instruction from the information receiving process. This indicates that the probability of a communication anomaly between the information sending process and the information receiving process is low. As a result, the information sending process can send the first information to be sent and the first information sequence number to the information receiving process normally, thus improving the information sending efficiency.
[0016] In one embodiment of this application, the step of temporarily delaying the transmission of the first information to be sent to the information receiving process includes:
[0017] The first message to be sent is cached directly.
[0018] In this case, all information to be sent and information sequence numbers greater than the first warning threshold are cached. Thus, when information transmission is resumed later, the information sending process can send all the cached complete information and information sequence numbers to the information receiving process, so that the information receiving process can receive the complete information and information sequence numbers.
[0019] In one embodiment of this application, the step of temporarily delaying the transmission of the first information to be sent to the information receiving process includes:
[0020] Update the cached information to be sent to the first information to be sent.
[0021] In this case, the information sending process can only cache the latest information to be sent and the information sequence number, reducing the amount of data that needs to be cached and reducing resource consumption during the communication process.
[0022] In one embodiment of this application, when directly caching the information to be sent, the step of resuming the transmission of the temporarily delayed information to be sent and the information sequence number of the information to be sent to the information receiving process includes:
[0023] The system can directly send all cached information to be sent and the information sequence number of the information to be sent to the information receiving process; or send the cached information to be sent with the largest information sequence number and the largest information sequence number to the information receiving process; or send the cached information to be sent and the information sequence number of the information to be sent to the information receiving process in batches.
[0024] As can be seen, the information sending process can use a variety of different methods to resend the information to be sent and the information sequence number to the information receiving process according to actual needs, which broadens the application scenarios of the solution and improves the flexibility of the solution.
[0025] In one embodiment of this application, the step of sending the cached information to be sent and the information sequence number of the information to be sent to the information receiving process in batches includes:
[0026] Based on the first warning threshold, determine the upper limit of the number of messages to be sent in batches;
[0027] The cached information to be sent and the information sequence number of the information to be sent are sent to the information receiving process in batches, wherein the number of information to be sent in each batch does not exceed the upper limit of the number of information.
[0028] This ensures that the number of messages sent in each batch by the information receiving process does not exceed the first warning threshold. As mentioned above, the first warning threshold is essentially the upper limit of the number of messages that the information sending process is allowed to send to the information receiving process before receiving the sequence number reset instruction. Therefore, it can ensure that the number of messages sent in each batch does not exceed the upper limit of the number of messages that is allowed to be sent to the information receiving process before receiving the sequence number reset instruction, thus reducing the probability that the information sending process will send too much information without receiving a response from the information receiving process.
[0029] In one embodiment of this application, the step of setting a new second information sequence number for the information to be sent, starting from the initial information sequence number, in response to receiving a sequence number reset instruction sent by the information receiving process includes:
[0030] Determine the first number of sequence number reset instructions that have been received consecutively;
[0031] If the first quantity is greater than the second quantity, a new second information sequence number for the information to be sent is set starting from the initial information sequence number, wherein the second quantity is the difference between the first warning threshold and the second warning threshold.
[0032] If the first number of consecutively received sequence number reset instructions is greater than the second number mentioned above, it indicates that the information receiving process has received all the information sequence numbers between the second warning threshold and the first warning threshold.
[0033] In this scenario, on one hand, the information receiving process sets a new second information sequence number for the information to be sent, starting from the initial information sequence number. This means that new information is only sent after the information receiving process has received all information sequences between the second and first warning thresholds. This prevents the simultaneous transmission of both information between the second and first warning thresholds and new information to the information receiving process. On the other hand, the information sending process resumes sending temporarily stored information to the information receiving process. Again, this is done only after the information receiving process has received all information sequences between the second and first warning thresholds. This prevents the simultaneous transmission of both information between the second and first warning thresholds and temporarily stored information to the information receiving process. As can be seen from these two aspects, in this embodiment, the information sending process only sends new information and temporarily stored information after confirming that the information receiving process has received all information sequences between the second and first warning thresholds. This further reduces the amount of information received by the information receiving process in a short period, thus reducing the probability of the information receiving process crashing.
[0034] In one embodiment of this application, determining the first information sequence number of the first information to be sent includes:
[0035] Obtain the previously identified information sequence number;
[0036] Based on the obtained previous information sequence number, determine the first information sequence number of the first information to be sent.
[0037] The sequence number indicates the order of the information to be sent. The first sequence number of the first information to be sent is determined based on the already determined sequence number of the previous information; that is, the order of the first information to be sent is determined based on the order of the previous information to be sent. Therefore, this method allows for accurate and convenient determination of the first sequence number of the first information to be sent.
[0038] In one embodiment of this application, determining the first information sequence number of the first information to be sent based on the obtained previous information sequence number includes:
[0039] The sequence number of the first message to be sent is determined as the sequence number of the previous message plus 1.
[0040] In this way, when the increment step of the sequence number is 1, the first information sequence number of the first information to be sent can be directly determined as the previous information sequence number plus 1, which can conveniently and efficiently determine the first information sequence number of the first information to be sent.
[0041] In one embodiment of this application, the first warning threshold is determined in the following manner:
[0042] Based on the thread pool capacity of the information receiving process and the preset average data volume of information, the maximum amount of information that the information receiving process can process synchronously is determined.
[0043] The first warning threshold is determined based on the maximum amount of information.
[0044] As can be seen, in this case, the determined first warning threshold is related to the maximum amount of information that the information receiving process can process synchronously. Therefore, determining whether to send the first message to be sent to the information receiving process based on the first warning threshold is equivalent to determining whether to send the first message to be sent to the information receiving process based on the maximum amount of information that the information receiving process can process synchronously. This can prevent the information receiving process from sending more than the maximum amount of information before receiving the sequence number reset instruction sent by the information receiving process. This reduces the probability that the information receiving process will be overloaded and crash due to receiving more than the maximum amount of information it can process synchronously in a short period of time.
[0045] Secondly, embodiments of this application provide a process communication method applied to an information receiving process, the method comprising:
[0046] Receive the information sent by the information sending process and the information sequence number of the information;
[0047] If the information sequence number is greater than or equal to the second warning threshold, a sequence number reset instruction is sent to the information sending process.
[0048] It can be seen that once the sequence number of the information received by the information receiving process is greater than or equal to the second warning threshold, a sequence number reset instruction will be sent to the information sending process. This will cause the information sending process to start from the initial sequence number and renumber the information. The aforementioned sequence number reset instruction is also used to inform the information sending process that it has confirmed that it has received the information. Thus, after receiving the sequence number reset instruction, the information sending process can know that the information receiving process has confirmed that it has received the information. This allows it to reasonably determine the strategy for sending information to the information receiving process in the future. This can prevent the information receiving process from continuing to send too much information without confirming that it has received the information, reducing the probability that the information receiving process will receive a large amount of information in a short period of time, and thus reducing the probability of the information receiving process crashing.
[0049] In one embodiment of this application, the step of sending a sequence number reset instruction to the information sending process when the information sequence number is greater than or equal to the second warning threshold includes:
[0050] If the information sequence number is greater than or equal to the second warning threshold, monitor whether new information is received from the information sending process within a preset time period;
[0051] If not, send a sequence number reset instruction to the information sending process.
[0052] Since the first warning threshold can be greater than the second warning threshold, and because the information sending process only temporarily stores information with sequence numbers greater than the first warning threshold, in the event of a communication anomaly, the information sending process will still normally send information with sequence numbers between the second and first warning thresholds. Therefore, for the information receiving process, when communication is restored, it will receive information with sequence numbers between the second and first warning thresholds, and will not receive information with sequence numbers greater than the first warning threshold that the information sending process has temporarily stored.
[0053] Therefore, if the information receiving process does not receive any new information from the information sending process within a preset time period, it indicates that it has received all information between the second and first warning thresholds. At this point, it sends a sequence number reset instruction to the information sending process to confirm that it has received the information, allowing the information sending process to resume sending information with a temporarily stored sequence number greater than the first warning threshold. This prevents the information sending process from simultaneously sending information with sequence numbers between the second and first warning thresholds, as well as temporarily stored information, to the information receiving process, further reducing the amount of information received by the information receiving process in a short period and lowering the probability of the information receiving process crashing.
[0054] In one embodiment of this application, the second warning threshold is determined in the following manner:
[0055] Based on the thread pool capacity of the information receiving process and the preset average data volume of information, the maximum amount of information that the information receiving process can process synchronously is determined.
[0056] The second warning threshold is determined based on the maximum amount of information.
[0057] As can be seen, in this case, the determined second warning threshold is related to the maximum amount of information that the information receiving process can process synchronously. Therefore, the information receiving process determines whether to send a sequence number reset instruction to the information sending process based on the second warning threshold. This is equivalent to determining whether to send a sequence number reset instruction to the information sending process based on the maximum amount of information that the information receiving process can process synchronously. This allows the information receiving process to send a sequence number reset instruction to the information sending process in a timely manner before the number of continuously received information reaches the aforementioned maximum amount of information. This enables the information sending process to renumber and send information in a timely manner.
[0058] Thirdly, embodiments of this application provide a terminal, including:
[0059] One or more processors and memory;
[0060] The memory is coupled to the one or more processors and is used to store computer program code, the computer program code including computer instructions, which the one or more processors invoke to cause the terminal to perform the method as described in the first or second aspect.
[0061] Fourthly, embodiments of this application provide a computer-readable storage medium including a computer program that, when run on a terminal, causes the terminal to perform the method described in the first or second aspect.
[0062] Fifthly, embodiments of this application provide a computer program product comprising executable instructions that, when executed on a terminal, cause the terminal to perform the method described in the first or second aspect.
[0063] In a sixth aspect, embodiments of this application provide a chip system applied to a terminal. The chip system includes one or more processors, which are used to invoke computer instructions to cause the terminal to input data into the chip system and execute the method described in the first or second aspect for inter-process communication.
[0064] The beneficial effects of the solutions provided in the embodiments of the third, fourth, fifth and sixth aspects above can be found in the beneficial effects of the solutions provided in the embodiments of the first and second aspects above. Attached Figure Description
[0065] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0066] Figure 1 This is a schematic diagram of the structure of a terminal provided in an embodiment of this application;
[0067] Figure 2 A software structure block diagram of a terminal provided in an embodiment of this application;
[0068] Figure 3a A schematic diagram illustrating an inter-process synchronous communication scenario provided in an embodiment of this application;
[0069] Figure 3b A schematic diagram illustrating an asynchronous inter-process communication scenario provided in an embodiment of this application;
[0070] Figure 3c A schematic diagram illustrating a first thread scheduling scenario provided in an embodiment of this application;
[0071] Figure 3d A schematic diagram illustrating a Binder information receiving scenario provided in an embodiment of this application;
[0072] Figure 3e A schematic diagram illustrating a second thread scheduling scenario provided in an embodiment of this application;
[0073] Figure 4 A flowchart illustrating the first process communication method provided in this application embodiment;
[0074] Figure 5 A flowchart illustrating the second process communication method provided in this application embodiment;
[0075] Figure 6a A schematic diagram illustrating a first information sending scenario provided in an embodiment of this application;
[0076] Figure 6b A schematic diagram illustrating a second information sending scenario provided in an embodiment of this application;
[0077] Figure 6c A schematic diagram illustrating a third information sending scenario provided in an embodiment of this application;
[0078] Figure 7 A signaling diagram of a process communication flow provided in an embodiment of this application;
[0079] Figure 8 This is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation
[0080] To better understand the technical solution of this application, the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0081] To facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with essentially the same function and effect. For example, "first instruction" and "second instruction" are used to distinguish different user instructions and do not limit their order. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.
[0082] It should be noted that, in this application, the words "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a specific manner.
[0083] The embodiments of this application can be applied to terminals with communication functions such as mobile phones, tablets, personal computers (PCs), personal digital assistants (PDAs), smartwatches, netbooks, wearable electronic devices, augmented reality (AR) devices, virtual reality (VR) devices, in-vehicle devices, smart cars, robots, smart glasses, and smart TVs.
[0084] The following section uses a mobile phone as an example to introduce the application scenarios of the solutions provided in the embodiments of this application.
[0085] Mobile phones have an operating system. When various applications installed on a phone run, the operating system creates independent processes for each application. Processes generally do not share memory, and therefore do not share information within their respective memory. Thus, processes need to communicate with each other to exchange information.
[0086] Furthermore, in many scenarios, processes communicate asynchronously. In asynchronous communication scenarios, one of the communicating processes only needs to send information to the other without needing to check whether the other process has received the information before sending subsequent information.
[0087] For example, the operating system creates processes T1 and T2 for a camera application (App1) and a gallery application (App2), respectively. Communication between processes T1 and T2 enables information exchange between App1 and App2. For instance, after a user takes a picture using the camera application (App1), process T1 can send image information such as the image filename and shooting time to process T2. The gallery application (App2) can then obtain this image information, retrieve the image from storage, and display it. In this scenario, as the user continuously takes pictures using the camera application (App1), process T1 can continuously send image information to process T2.
[0088] For example, the operating system creates processes T3 and T4 for the status monitoring application App3 and the status bar application App4, respectively. Communication between processes T3 and T4 enables information exchange between App1 and App2. For instance, process T3 can periodically detect status information such as the phone's mobile signal strength, current battery level, and ringing mode, and send this information to process T4. The status bar application App4 can then obtain this information and update the status display in its status bar accordingly. In this scenario, as the status monitoring application App3 continuously detects status information periodically, process T3 continuously sends the detected status information to process T4.
[0089] The following describes one possible structure of the aforementioned terminal.
[0090] For example, Figure 1 A schematic diagram of the terminal 100 is shown. The terminal 100 may include a processor 110, a display screen 120, a camera 130, internal memory 140, a SIM (Subscriber Identification Module) card interface 150, a USB (Universal Serial Bus) interface 160, a charging management module 170, a battery management module 171, a battery 172, a sensor module 180, a mobile communication module 190, a wireless communication module 200, antenna 1, and antenna 2, etc. The sensor module 180 may include a pressure sensor 180A, a fingerprint sensor 180B, a touch sensor 180C, an ambient light sensor 180D, etc.
[0091] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the terminal 100. In other embodiments of this application, the terminal 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0092] Processor 110 may include one or more processing units, such as a Central Processing Unit (CPU), an Application Processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Different processing units may be independent components or integrated into one or more processors. In some embodiments, terminal 100 may also include one or more processors 110. The controller can generate operation control signals based on instruction opcodes and timing signals to control instruction fetching and execution. In other embodiments, processor 110 may also include a memory for storing instructions and data. For example, the memory in processor 110 may be a cache memory. This memory can store instructions or data that processor 110 has just used or is repeatedly used. If processor 110 needs to reuse the instruction or data, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the terminal 100 in processing data or executing instructions.
[0093] In some embodiments, the processor 110 may include one or more interfaces. These interfaces may include an Inter-Integrated Circuit (I2C) interface, an Inter-Integrated Circuit Sound (I2S) interface, a Pulse Code Modulation (PCM) interface, a Universal Asynchronous Receiver / Transmitter (UART) interface, a Mobile Industry Processor Interface (MIPI) interface, a General-Purpose Input / Output (GPIO) interface, a SIM card interface, and / or a USB interface, etc. The USB interface 160 is a USB standard-compliant interface, specifically a Mini USB interface, a Micro USB interface, a USB Type-C interface, etc. The USB interface 160 can be used to connect a charger to charge the terminal 100, and can also be used for data transfer between the terminal 100 and peripheral devices. The USB interface 160 can also be used to connect headphones for audio playback.
[0094] It is understood that the interface connection relationships between the modules illustrated in the embodiments of this application are for illustrative purposes only and do not constitute a structural limitation on the terminal 100. In other embodiments of this application, the terminal 100 may also adopt different interface connection methods or a combination of multiple interface connection methods as described in the above embodiments.
[0095] The wireless communication function of terminal 100 can be implemented through antenna 1, antenna 2, mobile communication module 190, wireless communication module 200, modem processor and baseband processor.
[0096] Antennas 1 and 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.
[0097] Terminal 100 implements display functions through a GPU, display screen 120, and application processor. The GPU is a microprocessor for image processing, connected to the display screen 120 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0098] The display screen 120 is used to display images, videos, etc. The display screen 120 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the terminal 100 may include one or more display screens 120.
[0099] In some embodiments of this application, when the display panel uses materials such as OLED, AMOLED, and FLED, the above-mentioned Figure 1 The display screen 120 can be bent. Here, "the display screen 120 can be bent" means that the display screen can be bent to any angle at any part and can maintain that angle. For example, the display screen 120 can be folded from the middle left to right. It can also be folded from the middle up and down.
[0100] The display screen 120 of terminal 100 can be a flexible screen. Currently, flexible screens are attracting much attention due to their unique characteristics and enormous potential. Compared to traditional screens, flexible screens are highly flexible and bendable, providing users with new interaction methods based on their bendability and meeting more user needs for terminals. For terminals equipped with foldable displays, the foldable display can switch between a small screen in folded mode and a large screen in unfolded mode at any time. Therefore, users are increasingly using split-screen functionality on terminals equipped with foldable displays.
[0101] Terminal 100 can perform shooting functions through ISP, camera 130, video codec, GPU, display 120 and application processor, wherein camera 130 includes a front camera and a rear camera.
[0102] The ISP is used to process data fed back from the camera 130. For example, during shooting, when the shutter is opened, light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can perform algorithmic optimization of image noise, brightness, and color. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 130.
[0103] Camera 130 is used to capture photos or videos. An object is projected onto a photosensitive element through a lens, generating an optical image. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then transmitted to an ISP (Internet Service Provider) for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP (Digital Signal Processor) for processing. The DSP converts the digital image signal into standard red-green-blue (RGB), YUV, or other image signals. In some embodiments, terminal 100 may include one or N cameras 130, where N is a positive integer greater than 1.
[0104] A digital signal processor (DSP) is used to process digital signals. Besides digital image signals, it can also process other digital signals. For example, when terminal 100 selects a frequency point, the DSP can perform Fourier transforms on the frequency energy.
[0105] Video codecs are used to compress or decompress digital video. Terminal 100 may support one or more video codecs. Thus, terminal 100 can play or record video in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG 2, MPEG 3, and MPEG 4.
[0106] NPU stands for Neural Network (NN) computing processor. By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs can enable intelligent cognitive applications in terminals, such as image recognition, facial recognition, speech recognition, and text understanding.
[0107] The internal memory 140 can be used to store one or more computer programs, which include instructions. The processor 110 can execute the instructions stored in the internal memory 140, thereby causing the terminal 100 to perform the process communication methods, various applications, and data processing provided in some embodiments of this application. The internal memory 140 may include a program storage area and a data storage area. The program storage area may store the operating system; it may also store one or more applications (such as camera, gallery, contacts, status bar, etc.). The data storage area may store data created by the terminal 100 during use (such as photos, contacts, status information, etc.). Furthermore, the internal memory 140 may include high-speed random access memory and non-volatile memory, such as one or more disk storage components, flash memory components, Universal Flash Storage (UFS), etc. In some embodiments, the processor 110 can execute instructions stored in the internal memory 140 and / or instructions stored in memory disposed in the processor 110, thereby causing the terminal 100 to perform the process communication methods, other applications, and data processing provided in the embodiments of this application.
[0108] The internal memory 140 can be used to store the relevant programs of the process communication method provided in the embodiments of this application. The processor 110 can be used to call the relevant programs of the process communication method stored in the internal memory 140 (that is, the application that needs to communicate) when displaying information, and execute the process communication method of the embodiments of this application.
[0109] The sensor module 180 may include a pressure sensor 180A, a fingerprint sensor 180B, a touch sensor 180C, an ambient light sensor 180D, etc.
[0110] Pressure sensor 180A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 120. Pressure sensor 180A can be of many types, such as resistive pressure sensor, inductive pressure sensor, or capacitive pressure sensor. A capacitive pressure sensor can include at least two parallel plates with conductive material. When force is applied to pressure sensor 180A, the capacitance between the electrodes changes, and terminal 100 determines the pressure intensity based on the change in capacitance. When a touch operation is applied to display screen 120, terminal 100 detects the touch operation based on pressure sensor 180A. Terminal 100 can also calculate the touch position based on the detection signal from pressure sensor 180A. In some embodiments, touch operations applied to the same touch position but with different touch operation intensities can correspond to different operation commands. For example, when a touch operation with an intensity less than a first pressure threshold is applied to the SMS application icon, a command to view an SMS is executed; when a touch operation with an intensity greater than or equal to the first pressure threshold is applied to the SMS application icon, a command to create a new SMS is executed.
[0111] The fingerprint sensor 180B is used to collect fingerprints. The terminal 100 can use the collected fingerprint characteristics to perform functions such as unlocking, accessing the app lock, taking photos, and answering calls.
[0112] Touch sensor 180C, also known as a touch device, can be disposed on display screen 120. The touch sensor 180C and display screen 120 together form a touchscreen, also known as a touch display. Touch sensor 180C is used to detect touch operations applied to or near it. Touch sensor 180C can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through display screen 120. In other embodiments, touch sensor 180C may also be disposed on the surface of terminal 100, and in a different location from display screen 120.
[0113] The ambient light sensor 180D is used to sense the ambient light intensity. The terminal 100 can adaptively adjust the brightness of the display screen 120 based on the sensed ambient light intensity. The ambient light sensor 180D can also be used to automatically adjust the white balance during shooting. The ambient light sensor 180D can also transmit environmental information about the device's location to the GPU.
[0114] The ambient light sensor 180D is also used to acquire the brightness, light ratio, color temperature, and other parameters of the environment in which the camera 130 captures images.
[0115] Figure 2This is a software architecture block diagram for a terminal to which this application embodiment applies. The terminal's software system can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture.
[0116] A layered architecture divides the terminal's software system into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the software system can be divided into five layers: applications, application framework, system libraries, hardware abstraction layer (HAL), and kernel.
[0117] The application layer can include a series of application packages. The application layer runs applications by calling the Application Programming Interface (API) provided by the application framework layer. For example... Figure 2 As shown, the application package may include applications such as camera, browser, gallery, status bar, music, and video. Understandably, the port of each of these applications can be used to receive data.
[0118] In this solution, the operating system deployed on the terminal can run various applications by calling the application programming interfaces provided by the application framework layer, and create independent processes for each application.
[0119] The application framework layer provides APIs and a programming framework for applications within the application layer. The application framework layer includes predefined functions. For example... Figure 2 As shown, the application framework layer may include a window manager, content provider, view system, resource manager, notification manager, and DHCP (Dynamic Host Configuration Protocol) module, etc.
[0120] The system library can include multiple functional modules, such as a surface manager, a 3D graphics processing library, a 2D graphics engine, and a file library.
[0121] The hardware abstraction layer can contain multiple library modules, such as display library modules and motor library modules. The terminal system can load the corresponding library modules for the device hardware, thereby enabling the application framework layer to access the device hardware. For example, the terminal system can load the corresponding library module for the camera, enabling the camera application to access the camera.
[0122] The kernel layer is the layer between hardware and software. It drives the hardware, enabling it to function. The kernel layer includes at least display drivers, camera drivers, audio drivers, sensor drivers, and motor drivers, though this embodiment does not limit this. It is understood that display drivers, camera drivers, audio drivers, sensor drivers, and motor drivers can all be considered as driver nodes. Each of these driver nodes includes an interface for receiving data.
[0123] First, we will introduce the methods of inter-process communication.
[0124] Processes can communicate with each other using various methods such as shared memory, pipes, signal handling, sockets, and Binder.
[0125] From the perspective of communication types, inter-process communication includes synchronous communication and asynchronous communication.
[0126] In the scenario of synchronous communication between processes, after the information sending process sends information to the information receiving process, it needs to receive the confirmation information returned by the information receiving process before sending subsequent information.
[0127] See Figure 3a This is a schematic diagram of an inter-process synchronous communication scenario provided in an embodiment of this application.
[0128] The horizontal arrows in the diagram represent the timeline. It can be seen that after the information sending process sends information 1 to the information receiving process, it needs to wait for the information receiving process to send confirmation of receipt of information 1 before sending information 2.
[0129] Similarly, after the information sending process sends information 2 to the information receiving process, it needs to wait for the information receiving process to send back confirmation of receipt of information 2 before sending information 3 to the information receiving process, and so on.
[0130] In asynchronous communication scenarios between processes, after the information sending process sends information to the information receiving process, it can send subsequent information without receiving any information returned by the information receiving process.
[0131] See Figure 3b This is a schematic diagram of an asynchronous communication scenario between processes provided in an embodiment of this application.
[0132] The horizontal arrows in the diagram represent the timeline. It can be seen that after the information sending process sends information 1 to the information receiving process, it can send information 2, information 3, and so on to the information receiving process without waiting for any feedback.
[0133] As can be seen from the above, in asynchronous communication, the information sending process does not need to receive any return value from the information receiving process to send subsequent information. That is, the information sending process does not need to know the information receiving status and load situation to send subsequent information. This can lead to the information receiving process receiving too much information in a short period of time, causing the information receiving process to crash.
[0134] The following example of asynchronous inter-process communication using the Binder method will be used to explain the above issues in detail.
[0135] The information receiving process has a pre-set thread pool containing multiple threads. The information receiving process can call a thread in the thread pool to receive and process the Binder information sent by the information sending process. After the thread has finished processing the Binder information, it will change to an idle state that can be called again. When it is called again, it will receive and process new Binder information.
[0136] The information sending process continuously sends Binder information to the information receiving process, which in turn can continuously call threads in the thread pool to receive and process the received Binder information.
[0137] See Figure 3c This is a schematic diagram of the first thread scheduling scenario provided in the embodiments of this application.
[0138] Figure 3c In the thread pool, dark rectangles represent threads that are in a working state, and white rectangles represent threads that are in an idle state.
[0139] As can be seen, at time 1, threads T1, T3, and T5 in the thread pool are in a working state, while T2, T4, and T6 are in an idle state. Therefore, the information receiving process can call thread T2 to receive and process information I1. At time 2, thread T2 in the thread pool becomes a working state because it processes information I1, and thread T1 becomes an idle state after processing the information. Therefore, the information receiving process can call thread T1 to receive and process information I2.
[0140] Under normal communication conditions, the threads in the thread pool of the information receiving process can achieve a dynamic balance with the received Binder information. That is, there are often idle threads in the thread pool that can be used to receive and process Binder information, so the information receiving process can achieve normal communication with the information sending process by calling the idle threads.
[0141] However, when communication delays or blockages occur between the sending and receiving processes, the receiving process may struggle to promptly call threads to receive and process Binder messages, causing a backlog of unreceived Binder messages in the operating system's cache. When communication resumes, if the backlog is large, the receiving process may need to utilize all idle threads in the thread pool to receive and process these messages. This results in the thread pool being full, leaving no available threads for receiving messages. Consequently, the receiving process may struggle to receive subsequent messages from the sending process in a timely manner, potentially leading to a crash.
[0142] See Figure 3d This is a schematic diagram of a Binder information receiving scenario provided in an embodiment of this application.
[0143] It can be seen that because the information sending process and the information receiving process experienced a communication failure at time t1, the information receiving process was unable to call the thread to receive the Binder information in time. Therefore, the Binder information sent by the information sending process was received by the information receiving process after a delay.
[0144] As shown in the figure, the reception times of Binder information 1, Binder information 2, and Binder information 3 in the information receiving process are all later than the sending times of Binder information 1, Binder information 2, and Binder information 3 in the information sending process. At communication recovery time t2, the information sending process has already sent Binder information 1-50, where the sending times of Binder information 4 to Binder information 50 are shown in the figure; while the information receiving process has only received Binder information 1-3.
[0145] After communication recovery time t2, the information receiving process receives a large number of Binder messages in a short period of time. Specifically, the information receiving process calls threads in the thread pool to receive the previously unreceived Binder messages 4-50. The time between receiving Binder message 4 and receiving Binder message 50 is shown in the figure. At this time, the unreceived Binder messages 4-50 flood into the thread pool of the information receiving process in a short period of time, so there are no idle threads in the thread pool that can be used to receive other Binder messages. That is, the thread pool is full. As a result, the information receiving process has difficulty receiving subsequent Binder messages sent by the information sending process in a timely manner, which may lead to the information receiving process crashing.
[0146] See also Figure 3e This is a schematic diagram of a second thread scheduling scenario provided in the embodiments of this application.
[0147] Due to excessive system load, the receiving process may be in the Runnable state (waiting to run) or the D state (sleeping state). In this case, communication blockage occurs between the sending process and the receiving process, and the information sent by the sending process (I1-I10) cannot be transmitted to the receiving process. As a result, threads T1-T6 in the thread pool are all in an idle state.
[0148] If communication between the information sending process and the information receiving process is restored at time t3, the unreceived information I1-I10 will be transmitted to the information receiving process. As a result, the information receiving process needs to call all threads T1-T6 to receive and process information I1-I6. At time t4, all threads T1-T6 in the thread pool have been called, that is, the thread pool is full.
[0149] In this way, the information receiving process cannot receive subsequent messages sent by the information sending process in a timely manner, causing the information receiving process to crash.
[0150] In view of the above, embodiments of this application provide a process communication scheme to reduce the probability of process crashes during asynchronous communication between processes.
[0151] The process communication scheme provided in this application will be described in detail below through specific embodiments.
[0152] See Figure 4 This is a flowchart illustrating the first process communication method provided in this application embodiment. The method is applied to an information sending process and includes the following steps S401-S403.
[0153] Step S401: Determine the first information sequence number of the first information to be sent.
[0154] This application embodiment does not limit the type and source of the first information to be sent.
[0155] For example, from the perspective of information type, the first information to be sent can be various types of information such as notification information and command information; from the perspective of information source, the first information to be sent can be information generated by the information sending process itself, or information sent by other processes to the information sending process, etc.
[0156] The first information sequence number represents the sending order of the first information to be sent, and can be determined in the following ways.
[0157] You can first obtain the sequence number of the previous information, and then determine the first information sequence number of the first information to be sent based on the obtained sequence number of the previous information.
[0158] The previously determined sequence number is actually the sequence number of the previous message to be sent.
[0159] Regardless of whether the information to be sent is generated by the information sending process itself or forwarded by other processes, the information to be sent will have a generation order or a reception order. The above order can be used as the order in which the information sending process sends the information to be sent, and the information sending process can determine the information sequence number for the information to be sent in the above order.
[0160] In this process, the sequence number of the first message to be sent can be set as the initial sequence number. For example, the initial sequence number can be 0, 1, etc.
[0161] The information sending process can increase the step size based on the determined sequence number of the previous information and the preset sequence number to determine the first information sequence number of the first information to be sent.
[0162] Specifically, the information sending process can calculate the sum of the previous information sequence number and the preset sequence number by a step, and determine the resulting sum as the first information sequence number of the first information to be sent.
[0163] The increment of the above serial number can be flexibly set by the staff according to actual needs, such as 1, 2, etc.
[0164] For example, if the previous information sequence number is 3 and the sequence number increment step is 2, then the sum of the previous information sequence number and the sequence number increment step is 3 + 2 = 5, so the first information sequence number of the first information to be sent is 5.
[0165] If the increment step of the above sequence number is 1, then the first information sequence number of the first information to be sent is the previously determined information sequence number plus 1.
[0166] That is, the sequence number of the first message to be sent is directly determined as the sequence number of the previous message plus 1.
[0167] In this way, when the increment step of the sequence number is 1, the first information sequence number of the first information to be sent can be directly determined as the previous information sequence number plus 1, which can conveniently and efficiently determine the first information sequence number of the first information to be sent.
[0168] The sequence number indicates the order of the information to be sent. The first sequence number of the first information to be sent is determined based on the already determined sequence number of the previous information; that is, the order of the first information to be sent is determined based on the order of the previous information to be sent. Therefore, this method allows for accurate and convenient determination of the first sequence number of the first information to be sent.
[0169] Step S402: If the first information sequence number is greater than the first warning threshold, temporarily suspend sending the first information to be sent to the information receiving process.
[0170] Step S403: In response to receiving the sequence number reset instruction sent by the information receiving process, set the second information sequence number of the new information to be sent starting from the initial information sequence number, and resume sending the information to be sent that was temporarily suspended and the information sequence number of the information to be sent to the information receiving process.
[0171] It can be seen that, on the one hand, when the sequence number of the first message to be sent is greater than the first warning threshold, the information sending process will temporarily suspend sending the first message to be sent to the information receiving process. Since the information sending process sends messages to the information receiving process sequentially and assigns a number to each message, the sequence number of the message actually reflects the number of messages that the information sending process has already sent to the information receiving process. The larger the sequence number, the more messages the information sending process has sent to the information receiving process; conversely, the smaller the sequence number, the fewer messages the information sending process has sent to the information receiving process. Thus, when the sequence number of the first message to be sent is greater than the first warning threshold, it indicates that the information sending process has already sent a large number of messages to the information receiving process. Therefore, temporarily suspending the sending of the first message to be sent to the information receiving process can reduce the probability of sending too many messages to the information receiving process, making it difficult for the information receiving process to process the received information in a timely manner and causing a crash, thereby improving the stability of process communication.
[0172] On the other hand, the information receiving process sends a sequence number reset instruction to the information sending process. This sequence number reset instruction indicates that the information receiving process has acknowledged receiving the information sent by the information sending process. Therefore, upon receiving the sequence number reset instruction from the information receiving process, the information sending process can determine that it has received the information and can continue processing subsequent information. Thus, the information sending process can start numbering new information from the initial sequence number and resume sending the temporarily delayed information to the information sending process.
[0173] It is evident that the information sending process can not only postpone sending subsequent information when too many messages are sent to the information receiving process, but also resume sending the postponed information after the information receiving process confirms receipt of the information. This can reduce the probability of the information receiving process crashing while maximizing communication efficiency.
[0174] In one embodiment of this application, when the first information sequence number is less than the first warning threshold, the information sending process can send the first information to be sent and the first information sequence number to the information receiving process.
[0175] When the sequence number of the first information is less than the first warning threshold, it indicates that the sequence number of the information sent by the information sending process is small. This means that the information sending process has recently received a sequence number reset instruction from the information receiving process. This indicates that the probability of a communication anomaly between the information sending process and the information receiving process is low. As a result, the information sending process can send the first information to be sent and the first information sequence number to the information receiving process normally, thus improving the information sending efficiency.
[0176] See Figure 5 This is a flowchart illustrating the second process communication method provided in this application embodiment. The method is applied to an information receiving process and includes the following steps S501-S502.
[0177] Step S501: Receive the information sent by the information sending process and the information sequence number of the information.
[0178] Step S502: If the information sequence number is greater than or equal to the second warning threshold, send a sequence number reset instruction to the information sending process.
[0179] The aforementioned sequence number reset instruction is used to instruct the information sending process to renumber the information from the initial sequence number, and in fact, it is also used to inform the information sending process that it has confirmed that it has received the information.
[0180] It can be seen that once the sequence number of the information received by the information receiving process is greater than or equal to the second warning threshold, a sequence number reset instruction will be sent to the information sending process. This will cause the information sending process to renumber the information from the initial sequence number. The aforementioned sequence number reset instruction is also used to inform the information sending process that it has confirmed that it has received a batch of information. After receiving the sequence number reset instruction, the information sending process knows that the information receiving process has confirmed that it has received a batch of information. This allows it to reasonably determine the strategy for sending information to the information receiving process in the future. This can prevent the information receiving process from continuing to send too much information when it has not confirmed that it has received the information. This reduces the probability that the information receiving process will receive a large amount of information in a short period of time, and thus reduces the probability of the information receiving process crashing.
[0181] The solution provided in this application is a process communication scheme, which focuses on the communication process between the information sending process and the information receiving process. Therefore, for ease of understanding, the solution provided in this application will be specifically described below from the perspective of information interaction between the information sending process and the information receiving process.
[0182] The following is a brief overview of the interaction process between the information sending and receiving processes.
[0183] First, the information sending process sequentially sends information to the information receiving process. For example, if the information sending process is a process created by the operating system for a status monitoring application, it will continuously send detected status information to the information receiving process. Furthermore, the information sending process sequentially determines the sequence number of each piece of information to be sent and sends the information along with its sequence number. Therefore, the sequence number of the information actually reflects the number of pieces of information that the information sending process has already sent to the information receiving process.
[0184] Therefore, if the information sending process determines that the sequence number of the first information to be sent is greater than the first warning threshold, it indicates that the information sending process has already sent a large number of messages to the information receiving process. Consequently, the information sending process will temporarily postpone sending the first information to be sent. Conversely, if the information sending process determines that the sequence number of the first information to be sent is less than or equal to the first warning threshold, it indicates that the information sending process has already sent a small number of messages to the information receiving process. Therefore, the information sending process will directly send the first information to be sent and its sequence number. The specific method for setting the first warning threshold is detailed below.
[0185] For example, if the first warning threshold is 50 and the first information sequence number is 20≤50, the information sending process will directly send the first information to be sent and the first information sequence number; if the first warning threshold is 50 and the first information sequence number is 51>50, the information sending process will postpone sending the first information to be sent.
[0186] For the information receiving process, it needs to continuously call threads in the thread pool to receive and process information sent by the information sending process. For example, if the information receiving process is a process created by the operating system for the status bar application, it needs to call threads in the thread pool to receive status information sent by the information sending process and update the status display information in the status bar based on the received status information. Furthermore, the information receiving process compares the received information sequence number with the second warning threshold. If the information sequence number is greater than or equal to the second warning threshold, it means that the number of recently received messages has reached the number required to send a confirmation message. In this case, it sends a sequence number reset instruction to the information sending process to notify it to renumber the messages and confirm that a batch of messages has been received.
[0187] The second warning threshold is less than or equal to the first warning threshold. Details on how the second warning threshold is set are provided below.
[0188] For example, if the second warning threshold is 25 and the received information sequence number is 20 < 25, the information receiving process can do nothing; if the second warning threshold is 25 and the received information sequence number is 25, which is equal to the second warning threshold of 25, the information receiving process will send a sequence number reset instruction to the information sending process.
[0189] After receiving the sequence number reset instruction, the information sending process can confirm that the information receiving process has received a batch of information. Therefore, it will set the second sequence number of the new information to be sent, starting from the initial sequence number. In other words, it sequentially sets the second sequence number of the new information to be sent, starting from the initial sequence number; this can be simply referred to as re-numbering.
[0190] Furthermore, the information sending process will resume sending the delayed information to the information receiving process, along with the information sequence number of the information to be sent.
[0191] For example, after receiving a sequence number reset instruction, if the information sending process confirms that the information to be sent with sequence numbers 50-60 has been temporarily suspended, it will send the aforementioned information to be sent and the corresponding information sequence number to the information receiving process.
[0192] It can be seen that when the communication between the information sending process and the information receiving process is good, the information receiving process will send a reset message to the information sending process when it receives a message with a sequence number greater than the second warning threshold, causing the information sending process to renumber the messages. Therefore, the messages generated by the information sending process will not exceed the second warning threshold. The following will combine... Figure 6a To provide a more intuitive explanation.
[0193] See Figure 6a This is a schematic diagram of the first information sending scenario provided in the embodiments of this application.
[0194] Figure 6a The white rectangles represent information, and the numbers within them represent information sequence numbers. It can be seen that when the second warning threshold is 25, the initial information sequence number is 1, and the sequence number increment is 1, the information sending process can start numbering information from 1 and send the information and its sequence number sequentially to the information receiving process.
[0195] After receiving information sequence numbers 1-24, the information receiving process determines that information sequence numbers 1-24 do not exceed the second warning threshold; when receiving information sequence number 25, it determines that information sequence number 25 is equal to the second warning threshold, and then sends a sequence number reset instruction to the information sending process.
[0196] In this way, after the information sending process receives the sequence number reset instruction, it will start from 1 again to number the new information. That is, the information sequence number of the information that should have been 26 will be determined as 1.
[0197] It is evident that, under good communication conditions, the number of messages generated by the information transmission process will not exceed the second warning threshold.
[0198] Therefore, if the sequence number of the message generated by the information sending process is greater than the second warning threshold, it means:
[0199] 1. The information receiving process fails to receive information with a sequence number equal to the second warning threshold in a timely manner, and therefore fails to send a sequence number reset instruction in a timely manner; or 2. The information receiving process sends a sequence number reset instruction in a timely manner, but the information sending process itself fails to receive the sequence number reset instruction in a timely manner.
[0200] In either case, it can be assumed that a communication anomaly has occurred between the information receiving process and the information sending process.
[0201] In other words, if the sequence number of a message generated by the information sending process is greater than the second warning threshold, it indicates that a communication anomaly may occur between the information sending process and the information receiving process.
[0202] Since the second warning threshold is less than or equal to the first warning threshold, if the sequence number of the message generated by the information sending process is greater than the first warning threshold, it will naturally also be greater than the second warning threshold. Therefore, if the sequence number of the message generated by the information sending process is greater than the first warning threshold, it also indicates that a communication anomaly may occur between the information sending process and the information receiving process.
[0203] Therefore, when the sequence number of the first message to be sent is greater than the first warning threshold, the information sending process can assume that there may be a communication anomaly between the information sending process and the information receiving process, and temporarily suspend the sending of messages and sequence numbers to the information receiving process.
[0204] In addition, when the information sending process receives the sequence number reset instruction, it means that the information receiving process has received the information, which means that communication may have returned to normal. Therefore, the information sending process will resume sending the delayed information and information sequence number to the information receiving process.
[0205] As can be seen, when using the solution provided in this application for inter-process communication, if a communication anomaly occurs between the information sending process and the information receiving process, the information sending process will temporarily suspend sending information and information sequence numbers to the information receiving process; when communication may be restored, the information sending process will resume sending the suspended information and information sequence numbers to the information receiving process. This effectively avoids the information sending process sending too much information to the information receiving process when a communication anomaly is possible, and reduces the probability of the information receiving process receiving too much information in a short period of time when communication is restored, leading to excessive load and process crash.
[0206] The following explains the setting method and magnitude relationship of the first and second warning thresholds mentioned above.
[0207] Regarding the first warning threshold:
[0208] As described above, the information sending process will temporarily suspend sending information with sequence numbers greater than the first warning threshold to the information receiving process until it receives a sequence number reset instruction, at which point it will resume sending the temporarily stored information. Therefore, the first warning threshold is essentially the upper limit on the number of messages that the information sending process is allowed to send to the information receiving process before receiving the sequence number reset instruction.
[0209] In one scenario, the aforementioned first warning threshold can be determined based on the maximum number of messages that the information receiving process can process simultaneously.
[0210] For example, the first warning threshold can be directly set as the maximum number of messages mentioned above, or it can be set as the integer value of the product of the maximum number of messages and the first preset ratio. The first preset ratio can be 90%, 80%, 70%, etc.
[0211] The maximum number of messages that the aforementioned information receiving process can process synchronously can be determined based on the thread pool capacity of the information receiving process and the preset average data volume of the information.
[0212] Specifically, the ratio of thread pool capacity to average data volume can be calculated, and the result after rounding the ratio can be determined as the maximum number of messages that the information receiving process can process synchronously.
[0213] For example, if the thread pool capacity is 512kb and the average data size of the message is 10kb, then 512kb / 10kb = 51.2, which is rounded up to 51. Therefore, the maximum number of messages that the message receiving process can process synchronously is 51.
[0214] As can be seen, in this case, the determined first warning threshold is related to the maximum number of messages that the information receiving process can process synchronously. Therefore, determining whether to send the first message to be sent to the information receiving process based on the first warning threshold is equivalent to determining whether to send the first message to be sent to the information receiving process based on the maximum number of messages that the information receiving process can process synchronously. This can prevent the information receiving process from sending more than the maximum number of messages before receiving the sequence number reset instruction sent by the information receiving process. This reduces the probability that the information receiving process will be overloaded due to receiving more than the maximum number of messages that it can process synchronously in a short period of time, and thus crash.
[0215] In another scenario, the aforementioned first warning threshold can be set by staff based on experience or actual needs, and this application embodiment does not limit this.
[0216] Regarding the second warning threshold:
[0217] As described above, once the information receiving process determines that the sequence number of the received information is greater than the second warning threshold, it will send a sequence number reset instruction to the information sending process. One function of this sequence number reset instruction is to inform the information sending process that the information has been received. In other words, the information receiving process will send an acknowledgment message to the information sending process every time it receives the second warning threshold of consecutive messages. For example, if the second threshold is 25, the information receiving process will send an acknowledgment message to the information sending process every 25 messages received.
[0218] It is evident that the second warning threshold is essentially the upper limit of the number of unconfirmed messages that the information receiving process is allowed to receive continuously.
[0219] In one scenario, the aforementioned second warning threshold can be determined based on the maximum number of messages that the information receiving process can process simultaneously.
[0220] For example, the second warning threshold can be determined as the integer part of the product of the maximum number of messages and a second preset ratio. This second preset ratio could be 40%, 50%, etc.
[0221] As can be seen, in this case, the determined second warning threshold is related to the maximum number of messages that the information receiving process can process synchronously. Therefore, the information receiving process determines whether to send a sequence number reset instruction to the information sending process based on the second warning threshold. This is equivalent to determining whether to send a sequence number reset instruction to the information sending process based on the maximum number of messages that the information receiving process can process synchronously. This allows the information receiving process to send a sequence number reset instruction to the information sending process in a timely manner before the number of continuously received messages reaches the maximum number of messages mentioned above. This enables the information sending process to renumber and send the information in a timely manner.
[0222] In another scenario, the aforementioned second warning threshold can be set by staff based on experience or actual needs, and this application embodiment does not limit this.
[0223] Regarding the relationship between the first and second warning thresholds:
[0224] In one scenario, the first warning threshold can be equal to the second warning threshold.
[0225] As described above, under normal communication conditions, the number of messages generated by the information sending process will not exceed the second warning threshold. Therefore, the second warning threshold can be used to determine whether communication anomalies have occurred between processes.
[0226] For ease of description, the equal first and second warning thresholds will be collectively referred to as the unified warning threshold.
[0227] See Figure 6b This is a schematic diagram of a second information sending scenario provided in the embodiments of this application.
[0228] If the unified warning threshold is 25, and a communication blockage occurs when the information sending process sends information 24, the information sending process will continue to send information 25 whose sequence number is not greater than the warning threshold. When the information sending process determines information sequence number 26, since 26 > the unified warning threshold 25, it indicates that a communication anomaly may occur. The information sending process will temporarily store information with a sequence number greater than 25 and postpone sending it, hereinafter referred to as temporarily stored information. After communication is restored, the information receiving process receives information 25 and sends a sequence number reset instruction to the information sending process. At this time, the information sending process confirms that the temporarily stored information is information 26-41, and can send the temporarily stored information 26-41 to the information receiving process, and renumber the information from 1.
[0229] As can be seen, in this situation, once a communication anomaly is determined to be possible based on a unified early warning threshold, the information transmission process will temporarily suspend the transmission of information with a sequence number greater than the unified early warning threshold.
[0230] The situation where the first warning threshold equals the second warning threshold applies to scenarios where the information receiving process has low real-time requirements for receiving information.
[0231] In another scenario, the first warning threshold is greater than the second warning threshold.
[0232] See Figure 6c This is a schematic diagram of the third information sending scenario provided in the embodiments of this application.
[0233] If the first warning threshold is 50 and the second warning threshold is 25, and a communication blockage occurs when the information sending process sends information 24, the information sending process will continue to send information 25 whose sequence number is not greater than the second warning threshold. When the information sending process determines information sequence number 26, since 26 > the second warning threshold 25, it indicates that a communication anomaly may have occurred. However, the information sending process still continues to send information 26-information 50 whose sequence numbers are between the second and first warning thresholds. It can be seen that the information sending process will normally send information with sequence numbers 25-50. When the information sequence number 51 is determined, since 51 > the first warning threshold 50, the information sending process will temporarily store information with sequence numbers greater than 50 and postpone sending it. This will be referred to as temporarily stored information. After communication is restored, the information receiving process receives information 25 and sends a sequence number reset instruction to the information sending process. At this time, the information sending process confirms that the temporarily stored information is information 51-70, sends the temporarily stored information 51-70 to the information receiving process, and renumbers the information from 1.
[0234] As can be seen, in this case, when it is determined that a communication anomaly may occur based on the second warning threshold, the information sending process does not immediately suspend the sending of information with a sequence number greater than the second warning threshold. Instead, it normally sends information between the second warning threshold and the first warning threshold, and only suspends the sending of information with a sequence number greater than the first warning threshold.
[0235] In some cases, after the information receiving process receives a sequence number greater than the second warning threshold and sends a sequence number reset instruction to the information sending process, the information sending process may experience a delay in receiving the sequence number reset instruction due to communication latency. Thus, because the information sending process does not receive the sequence number reset instruction in time, it will determine that the sequence number is greater than the second warning threshold. However, the information receiving process has already completed its information processing and can continue processing other information. Immediately suspending the sending of information to the information receiving process in this situation would waste the information receiving process's computing resources.
[0236] Therefore, the information receiving process can continue to send information with sequence numbers greater than the second warning threshold to reduce the probability of the above situation and improve the resource utilization of the information receiving process. When the determined information sequence number is greater than the first warning threshold, the sequence number that has not been received for a long time is reset, indicating that the probability of communication abnormality is high. Only then will the sending of information with sequence numbers greater than the first warning threshold be temporarily suspended.
[0237] This is equivalent to reserving a delay buffer space between the information sending process and the information receiving process. This not only prevents the information sending process from sending too much information to the information receiving process in the event of communication abnormalities, but also takes into account the resource utilization of the information receiving process.
[0238] The situation where the first warning threshold is greater than the second warning threshold is applicable to scenarios where the information receiving process has a high requirement for real-time information reception.
[0239] The following section uses a signaling diagram to describe the process communication scheme provided in the embodiments of this application.
[0240] See Figure 7 This is a signaling diagram of a process communication flow provided in an embodiment of this application. The flow includes the following steps.
[0241] Step S701: The information sending process determines the first information sequence number of the first information to be sent.
[0242] Step S702: The information sending process determines whether the sequence number of the first information is greater than the first warning threshold. If yes, proceed to step S703; if no, proceed to step S704.
[0243] As can be seen from the foregoing, if the first information sequence number is greater than the first warning threshold, it indicates that there is a high probability of a communication anomaly between the information sending process and the information receiving process. Therefore, step S703 can be executed to temporarily suspend the sending of the first information to be sent to the information receiving process. Otherwise, it indicates that there is a low probability of a communication anomaly between the information sending process and the information receiving process. Therefore, step S704 can be executed to send the first information to be sent and the first information sequence number normally.
[0244] Step S703: The information sending process temporarily suspends sending the first message to be sent to the information receiving process.
[0245] Specifically, the information sending process can temporarily suspend sending the first message to be sent to the information receiving process in the following ways.
[0246] In one implementation, the information sending process can directly cache the first information to be sent and the first information sequence number.
[0247] In this case, all information to be sent and information sequence numbers greater than the first warning threshold are cached. Thus, when information transmission is resumed later, the information sending process can send all the cached complete information and information sequence numbers to the information receiving process, so that the information receiving process can receive the complete information and information sequence numbers.
[0248] In another implementation, the information sending process can update the cached information to be sent and information sequence number to the first information to be sent and the first information sequence number.
[0249] In this case, the information sending process can only cache the latest information to be sent and the information sequence number, reducing the amount of data that needs to be cached and reducing resource consumption during the communication process.
[0250] It should be noted that the above two implementation methods can be flexibly selected according to actual needs.
[0251] Specifically, if the information receiving process only needs to obtain the latest information, the latter implementation method can be adopted.
[0252] For example, if the information sending process is the SurfaceFlinger (window ejection) process and the information receiving process is the system-server (system service) process, the SurfaceFlinger process will send information about the visible windows on the current screen to the system-server process. The system-server process can then perform subsequent operations based on this information. However, after a communication blockage occurs and is resolved, the historical visible window information during the blockage period is meaningless. The system-server process only needs to know the latest visible window information. Therefore, the SurfaceFlinger process can send only the latest visible window information to the system-server process.
[0253] If the information receiving process needs to obtain complete historical information, the former implementation method can be used.
[0254] For example, if information sending process A is a process that provides resource consumption information, and information receiving process B is a process that plans a resource scheduling scheme based on the above resource consumption information, after a communication blockage occurs and is restored, information receiving process B needs to know the complete historical resource consumption information in order to correctly perform subsequent resource scheduling. Therefore, process A can send all the complete resource consumption information and information sequence number cached by the process.
[0255] Step S704: The information sending process sends the first information to be sent and the first information sequence number to the information receiving process.
[0256] As can be seen from the aforementioned step S703, the information sending process can temporarily store information in different ways. Correspondingly, in this step, the information sending process can also send the first information to be sent and the first information sequence number to the information receiving process in different ways.
[0257] In one scenario, if the information sending process only caches the latest information to be sent and the information sequence number, then the information sending process can directly send the cached latest information to be sent and the information sequence number to the information receiving process.
[0258] In another scenario, if the information sending process has cached all pending messages and their sequence numbers greater than the first warning threshold, the information can be sent in the following ways:
[0259] The first method involves directly sending all cached information to be sent and the sequence number of the information to be sent to the information receiving process.
[0260] The second method involves sending the cached message with the largest sequence number, along with the largest sequence number, to the message receiving process.
[0261] The third method involves sending the cached information to be sent and the sequence number of the information to be sent to the information receiving process in batches.
[0262] Specifically, if the number of cached messages to be sent is greater than the first warning threshold, the information receiving process can send the cached messages to be sent and their sequence numbers in batches to the information receiving process.
[0263] The number of messages sent in each batch during the information receiving process shall not exceed the upper limit of the number of messages.
[0264] The following section explains how the upper limit for the amount of information can be determined.
[0265] In one implementation, the information receiving process can determine the upper limit of the number of information to be sent in batches based on a first warning threshold.
[0266] For example, the upper limit of the information quantity can be directly set as the first warning threshold, or the upper limit of the information quantity can be set as the integer value of the product of the first warning threshold and the third preset ratio. The aforementioned first preset ratio can be 90%, 80%, etc.
[0267] This ensures that the number of messages sent in each batch by the information receiving process does not exceed the first warning threshold. As mentioned above, the first warning threshold is essentially the upper limit of the number of messages that the information sending process is allowed to send to the information receiving process before receiving the sequence number reset instruction. Therefore, it can ensure that the number of messages sent in each batch does not exceed the upper limit of the number of messages that is allowed to be sent to the information receiving process before receiving the sequence number reset instruction, thus reducing the probability that the information sending process will send too much information without receiving a response from the information receiving process.
[0268] In another implementation, the upper limit of the above-mentioned amount of information can be set by staff based on experience or actual needs, and this application embodiment does not limit this.
[0269] Similarly, the above three methods can be flexibly selected according to actual needs.
[0270] For example, if the information receiving process needs to know the complete historical information, the first method can be used; if the information receiving process only needs to know the latest information, the second method can be used; if the information sending process determines that there is a lot of cached information, the third method can be used, and so on.
[0271] As can be seen, the information sending process can use a variety of different methods to resend the information to be sent and the information sequence number to the information receiving process according to actual needs, which broadens the application scenarios of the solution and improves the flexibility of the solution.
[0272] Step S705: The information receiving process receives the information sent by the information sending process and the information sequence number of the information.
[0273] Step S706: If the information sequence number is greater than or equal to the second warning threshold, the information receiving process sends a sequence number reset instruction to the information sending process.
[0274] In one implementation, if the received information sequence number is greater than or equal to the second warning threshold, the information receiving process can monitor whether it receives new information from the information sending process within a preset time period. If not, it sends a sequence number reset instruction to the information sending process.
[0275] Since the first warning threshold can be greater than the second warning threshold, and because the information sending process only temporarily stores information with sequence numbers greater than the first warning threshold, even in the event of a communication anomaly between the information sending and receiving processes, the information sending process will still normally send information with sequence numbers between the second and first warning thresholds. Therefore, when communication is restored, the information receiving process will receive information with sequence numbers between the second and first warning thresholds, and will not receive information with sequence numbers greater than the first warning threshold that the information sending process has temporarily stored.
[0276] Therefore, if the information receiving process does not receive any new information from the information sending process within a preset time period, it indicates that it has received all information between the second and first warning thresholds. At this point, it sends a sequence number reset instruction to the information sending process to confirm that it has received the information, allowing the information sending process to resume sending information with a temporarily stored sequence number greater than the first warning threshold. This prevents the information sending process from simultaneously sending information with sequence numbers between the second and first warning thresholds, as well as temporarily stored information, to the information receiving process, further reducing the amount of information received by the information receiving process in a short period and lowering the probability of the information receiving process crashing.
[0277] Step S707: In response to receiving the sequence number reset instruction sent by the information receiving process, the information sending process sets the second information sequence number of the new information to be sent, starting from the initial information sequence number.
[0278] Step S708: The information sending process resumes sending the delayed information to be sent and the information sequence number of the information to be sent to the information receiving process.
[0279] As can be seen, when using the solution provided in this application for inter-process communication, if a communication anomaly occurs between the information sending process and the information receiving process, the information sending process can temporarily suspend sending information and information sequence numbers to the information receiving process; when communication may be restored, the information sending process can resume sending the suspended information and information sequence numbers to the information receiving process. This effectively avoids the information sending process sending too much information to the information receiving process when a communication anomaly is possible, and reduces the probability of the information receiving process receiving too much information in a short period of time when communication is restored, leading to excessive load and process crash.
[0280] In one embodiment of this application, steps S707 and S708 described above can be implemented in the following manner:
[0281] The information sending process can determine the first number of sequence number reset instructions that have been received consecutively. If the first number is greater than the second number, a new second information sequence number for the information to be sent is set starting from the initial information sequence number, and the information to be sent to the information receiving process that was temporarily suspended is resumed, along with the information sequence number of the information to be sent.
[0282] The second quantity is the difference between the first warning threshold and the second warning threshold.
[0283] As can be seen from step S706, in the event of a communication anomaly, the information sending process will normally send information with a sequence number between the second warning threshold and the first warning threshold.
[0284] In addition, the information receiving process sends a sequence number reset instruction every time it receives one of the above-mentioned messages. Therefore, if the first number of consecutively received sequence number reset instructions is greater than the second number mentioned above, it means that the information receiving process has received all the messages whose sequence numbers are between the second warning threshold and the first warning threshold.
[0285] In this scenario, on one hand, the information receiving process sets a new second information sequence number for the information to be sent, starting from the initial information sequence number. This means that new information is only sent after the information receiving process has received all information sequences between the second and first warning thresholds. This prevents the simultaneous transmission of both information between the second and first warning thresholds and new information to the information receiving process. On the other hand, the information sending process resumes sending temporarily stored information to the information receiving process. Again, this is done only after the information receiving process has received all information sequences between the second and first warning thresholds. This prevents the simultaneous transmission of both information between the second and first warning thresholds and temporarily stored information to the information receiving process. As can be seen from these two aspects, in this embodiment, the information sending process only sends new information and temporarily stored information after confirming that the information receiving process has received all information sequences between the second and first warning thresholds. This further reduces the amount of information received by the information receiving process in a short period, thus reducing the probability of the information receiving process crashing.
[0286] The user information involved in the embodiments of this application is all information authorized by the user. The acquisition, storage, use, processing, transmission, provision and disclosure of user information all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0287] In a specific implementation, this application also provides a computer storage medium, wherein the computer storage medium may store a program, wherein when the program runs, it controls the device where the computer-readable storage medium is located to execute some or all of the steps in the above embodiments. The storage medium may be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0288] In a specific implementation, this application also provides a computer program product, which includes executable instructions. When the executable instructions are executed on a terminal, the terminal performs some or all of the steps in the above method embodiments.
[0289] In a specific implementation, this application embodiment also provides a terminal, including:
[0290] One or more processors, an image sensor, and memory;
[0291] The memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the terminal to execute the aforementioned process communication method applied to the information sending process and the process communication method applied to the information sending process.
[0292] like Figure 8 As shown, this application also provides a chip system applied to a terminal 100. The chip system includes one or more processors 801. The processors 801 are used to call computer instructions to cause the terminal 100 to input data to be processed into the chip system. The chip system performs inter-process communication based on the process communication method provided in the embodiments of this application.
[0293] In one possible implementation, the chip system also includes input and output interfaces for inputting and outputting data.
[0294] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0295] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a Digital Signal Processor (DSP), a microcontroller, an Application Specific Integrated Circuit (ASIC), or a microprocessor.
[0296] The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used when needed. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.
[0297] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or through other computer-readable media. Therefore, machine-readable media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, compact disc read-only memory (CD-ROMs), magneto-optical disks, read-only memory, random access memory, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other forms of propagated signals. Therefore, machine-readable media includes any type of machine-readable medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.
[0298] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the accompanying drawings. Furthermore, including structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.
[0299] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.
[0300] It should be noted that in the examples and description of this patent, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0301] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art should understand that various changes in form and detail may be made thereto without departing from the spirit and scope of this application.
Claims
1. A process communication method, characterized in that, Applied to an information sending process, wherein the information sending process and the information receiving process are asynchronous communication processes, the method includes: Determine the sequence number of the first message to be sent; If the sequence number of the first information is greater than the first warning threshold, the transmission of the first information to be sent to the information receiving process shall be temporarily suspended. In response to receiving a sequence number reset instruction sent by the information receiving process, a new second information sequence number for the information to be sent is set starting from the initial information sequence number, and the information to be sent to the information receiving process that was temporarily suspended is resumed and the information sequence number of the information to be sent is resumed. The sequence number reset instruction is an instruction sent by the information receiving process after receiving information whose information sequence number is greater than or equal to the second warning threshold. The case where the first warning threshold is equal to the second warning threshold is applicable to scenarios where the information receiving process has low real-time requirements for receiving information, and the case where the first warning threshold is greater than the second warning threshold is applicable to scenarios where the information receiving process has high real-time requirements for receiving information.
2. The method according to claim 1, characterized in that, The method further includes: If the first information sequence number is less than the first warning threshold, the first information to be sent and the first information sequence number are sent to the information receiving process.
3. The method according to claim 1, characterized in that, The step of temporarily delaying the transmission of the first information to be sent to the information receiving process includes: The first message to be sent and the first message sequence number are directly cached. or Update the cached information to be sent and information sequence number to the first information to be sent and the first information sequence number.
4. The method according to claim 3, characterized in that, In the case of directly caching the information to be sent, the step of resuming the transmission of the temporarily delayed information to be sent and the sequence number of the information to be sent to the information receiving process includes: Directly send all cached information to be sent and the information sequence number of the information to be sent to the information receiving process; or Send the cached message with the largest sequence number to the information receiving process, along with the largest sequence number; or The cached information to be sent and the information sequence number of the information to be sent are sent to the information receiving process in batches.
5. The method according to claim 4, characterized in that, The step of sending the cached information to be sent and the information sequence number of the information to be sent to the information receiving process in batches includes: Based on the first warning threshold, determine the upper limit of the number of messages to be sent in batches; The cached information to be sent and the information sequence number of the information to be sent are sent to the information receiving process in batches, wherein the number of information to be sent in each batch does not exceed the upper limit of the number of information.
6. The method according to claim 1, characterized in that, The step of responding to receiving a sequence number reset instruction from the information receiving process, setting a new second information sequence number for the information to be sent starting from the initial information sequence number, and resuming the sending of the deferred information to be sent and the information sequence number of the information to be sent to the information receiving process, includes: Determine the first number of sequence number reset instructions that have been received consecutively; If the first quantity is greater than the second quantity, a new second information sequence number for the information to be sent is set starting from the initial information sequence number, and the information to be sent to the information receiving process is resumed after the information is delayed. The second quantity is the difference between the first warning threshold and the second warning threshold.
7. The method according to any one of claims 1-6, characterized in that, The determination of the first information sequence number of the first information to be sent includes: Obtain the previously identified information sequence number; Based on the obtained previous information sequence number, determine the first information sequence number of the first information to be sent.
8. The method according to claim 7, characterized in that, The step of determining the first information sequence number of the first information to be sent based on the obtained previous information sequence number includes: The sequence number of the first message to be sent is determined as the sequence number of the previous message plus 1.
9. The method according to any one of claims 1-6, characterized in that, The first warning threshold is determined in the following manner: Based on the thread pool capacity of the information receiving process and the preset average data volume of information, the maximum amount of information that the information receiving process can process synchronously is determined. The first warning threshold is determined based on the maximum amount of information.
10. A process communication method, characterized in that, Applied to an information receiving process, wherein the information receiving process and the information sending process are asynchronous communication processes, the method includes: The information sent by the information sending process and the information sequence number of the information are received. The information is: the information sent by the information sending process when the information sequence number is not greater than the first warning threshold. If the information sequence number is greater than or equal to the second warning threshold, a sequence number reset instruction is sent to the information sending process; Wherein, the information sending process temporarily suspends sending information to the information receiving process when the first information sequence number of the information to be sent is greater than the first warning threshold. The case where the first warning threshold is equal to the second warning threshold is applicable to scenarios where the information receiving process has low real-time requirements for receiving information, and the case where the first warning threshold is greater than the second warning threshold is applicable to scenarios where the information receiving process has high real-time requirements for receiving information.
11. The method according to claim 10, characterized in that, When the information sequence number is greater than or equal to the second warning threshold, sending a sequence number reset instruction to the information sending process includes: If the information sequence number is greater than or equal to the second warning threshold, monitor whether new information is received from the information sending process within a preset time period; If not, send a sequence number reset instruction to the information sending process.
12. The method according to claim 10, characterized in that, The second warning threshold shall be determined in the following manner: Based on the thread pool capacity of the information receiving process and the preset average data volume of information, the maximum amount of information that the information receiving process can process synchronously is determined. The second warning threshold is determined based on the maximum amount of information.
13. A terminal, characterized in that, include: One or more processors and memory; The memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the terminal to perform the method as described in any one of claims 1 to 9 or 10 to 12.
14. A computer-readable storage medium, characterized in that, Includes a computer program that, when run on a terminal, causes the terminal to perform the method as described in any one of claims 1 to 9 or 10 to 12.
15. A computer program product, characterized in that, The computer program product includes executable instructions that, when executed on a terminal, cause the terminal to perform the method of any one of claims 1 to 9 or 10 to 12.
16. A chip system, characterized in that, The chip system is applied to a terminal, and the chip system includes one or more processors. The processors are used to invoke computer instructions to cause the terminal to input data into the chip system and to perform inter-process communication using the method of any one of claims 1 to 9 or 10 to 12.