Broadcast message processing method and device, electronic equipment, vehicle and storage medium
By distinguishing key and ordinary broadcast queues according to the source process type in broadcast message processing and using specific thread processing, the problems of queue congestion and resource imbalance are solved, and faster message processing and system flexibility are achieved.
Patent Information
- Application Number
- CN202510556528.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-01
AI Technical Summary
The existing broadcast message processing methods are prone to queue congestion when high frequency and large number of broadcast messages are broadcast, affecting the system response speed and user experience, and cannot effectively distinguish broadcast priority of different processes, resulting in delayed processing of key broadcast messages, unbalanced system resource usage, and lack of flexibility.
After receiving the broadcast message, determine the type of the source process and determine whether it is a critical broadcast message, store the corresponding target critical broadcast queue from the preset critical broadcast queue, process these messages using a specific thread, and store non-critical broadcast messages into the ordinary broadcast queue, and process different types of broadcast messages respectively.
It reduces the number of processing of each broadcast queue, avoids data congestion and delays, ensures timely processing of key broadcast messages, improves the balance and flexibility of system resource use, and supports the scalability of the system.
Smart Images

Figure CN120407236A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a method, apparatus, electronic device, vehicle, and storage medium for processing broadcast messages. Background Art
[0002] In an operating system, the broadcast mechanism is an important way of message passing. The broadcast message mechanism is usually used to notify multiple components within the system of the occurrence of a specific event. Existing broadcast processing methods usually use one or two broadcast queues, for example, a foreground broadcast queue and a background broadcast queue, to process all broadcast messages from various applications. However, this method may cause some problems when facing high-frequency and large amounts of broadcast messages.
[0003] For example, all types of broadcast messages are processed in the same one or two queues, which is likely to cause congestion in the queues during the peak period of broadcast messages, resulting in delays in message processing and affecting the system response speed and user experience. Background broadcasts may be frequently interrupted by high-priority foreground broadcasts, resulting in uneven use of system resources. In addition, existing broadcast processing methods cannot effectively distinguish the priorities of broadcasts sent by different processes (such as the broadcast priorities of system applications and third-party applications), resulting in key broadcast messages may be delayed in processing. In the existing architecture, adding new broadcast types or adjusting broadcast processing strategies requires major modifications to the system, lacking flexibility. Summary of the Invention
[0004] In view of this, to solve some or all of the above technical problems, embodiments of this application provide a method, apparatus, electronic device, vehicle, and storage medium for processing broadcast messages.
[0005] In a first aspect, embodiments of this application provide a method for processing broadcast messages. The method includes: receiving a broadcast message; determining the type of the source process that sends the broadcast message, and determining whether the broadcast message belongs to a preset key broadcast message; if the broadcast message belongs to a key broadcast message, determining a target key broadcast queue corresponding to the type of the source process from at least one preset key broadcast queue, and storing the broadcast message in the target key broadcast queue; in response to triggering an extraction operation for the broadcast message, extracting the broadcast message from the target key broadcast queue, and processing the broadcast message.
[0006] In a possible implementation, extracting the broadcast message from the target key broadcast queue includes: determining a target thread corresponding to the target key broadcast queue from at least one preset first thread, where each first thread in the at least one first thread corresponds one-to-one to each key broadcast queue in the at least one key broadcast queue; using the target thread to extract the broadcast message from the target key broadcast queue, and processing the broadcast message.
[0007] In a possible implementation, determining a target critical broadcast queue corresponding to the type of the source process from at least one preset critical broadcast queue includes: if the type is a system application foreground process, determining the preset first critical broadcast queue as the target critical broadcast queue; if the type is a system application background process, determining the preset second critical broadcast queue as the target critical broadcast queue; if the type is a third-party application foreground process, determining the preset third critical broadcast queue as the target critical broadcast queue; if the type is a third-party application background process, determining the preset fourth critical broadcast queue as the target critical broadcast queue.
[0008] In a possible implementation, after determining the type of the source process that sends a broadcast message and determining whether the broadcast message belongs to a preset critical broadcast message, the method further includes: if the broadcast message does not belong to the critical broadcast message, determining a target general broadcast queue corresponding to the type of the source process from at least one preset general broadcast queue; in response to triggering an extraction operation on the broadcast message, extracting the broadcast message from the target general broadcast queue and processing the broadcast message.
[0009] In a possible implementation, extracting the broadcast message from the target general broadcast queue and processing the broadcast message includes: using a preset second thread to extract the broadcast message from the target general broadcast queue and process the broadcast message.
[0010] In a possible implementation, determining a target general broadcast queue corresponding to the type of the source process from at least one preset general broadcast queue includes: if the type of the source process is a foreground process, determining the preset fifth broadcast queue as the target general broadcast queue; if the type of the source process is a background process, determining the preset sixth broadcast queue as the target general broadcast queue; if the type of the source process is an offline process, determining the preset seventh broadcast queue as the target general broadcast queue.
[0011] In a possible implementation, before determining the type of the source process that sends a broadcast message and determining whether the broadcast message belongs to a preset critical broadcast message, the method further includes: running at least one preset process set, where each process set in the at least one process set corresponds to a process type; for each process set in the at least one process set, counting the resource occupancy of each process in the process set to obtain the resource occupancy of each process; based on the resource occupancy of each process, determining a process that meets the preset resource occupancy condition from the process set as a critical process; determining the broadcast message sent by the critical process as a critical broadcast message.
[0012] In a second aspect, an embodiment of the present application provides a broadcast message processing device, which includes: a receiving module, configured to receive a broadcast message; a first determination module, configured to determine the type of the source process that sends the broadcast message, and determine whether the broadcast message belongs to a preset critical broadcast message; a second determination module, configured to, if the broadcast message belongs to a critical broadcast message, determine a target critical broadcast queue corresponding to the type of the source process from at least one preset critical broadcast queue, and store the broadcast message in the target critical broadcast queue; a first extraction module, configured to, in response to triggering an extraction operation on the broadcast message, extract the broadcast message from the target critical broadcast queue and process the broadcast message.
[0013] In a third aspect, an embodiment of the present application provides an electronic device, including: a memory, configured to store a computer program; a processor, configured to execute the computer program stored in the memory, and when the computer program is executed, implement the method of any one of the embodiments of the broadcast message processing method in the first aspect of the present application.
[0014] In a fourth aspect, an embodiment of the present application provides a vehicle, which includes the electronic device described in the third aspect above.
[0015] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements the method of any one of the embodiments of the broadcast message processing method in the first aspect above.
[0016] In a sixth aspect, an embodiment of the present application provides a computer program, which includes computer-readable code, and when the computer-readable code runs on a device, it causes the processor in the device to implement the method of any one of the embodiments of the broadcast message processing method in the first aspect above.
[0017] The broadcast message processing method, device, electronic device, vehicle, and storage medium provided by the embodiments of the present application determine the type of the source process that sends the broadcast message when receiving the broadcast message, and when determining that the broadcast message is a critical broadcast message, determine the target critical broadcast queue corresponding to the type of the source process from at least one preset critical broadcast queue, and in response to triggering the extraction operation of the broadcast message, extract the broadcast message from the target critical broadcast queue and process the broadcast message. The embodiments of the present application implement setting critical broadcast messages, classifying the source processes of broadcast messages, and setting separate broadcast queues for specific types of critical broadcast messages, thereby reducing the number of broadcast messages processed by each broadcast queue, avoiding data congestion and delay, and avoiding the processing delay of critical broadcast messages. Moreover, since the types of source processes in the same broadcast queue are the same, the broadcast messages will not be frequently interrupted due to different priorities of the broadcast messages, which helps to improve the balance of system resource utilization. In addition, the embodiments of the present application can also classify different source processes and set corresponding broadcast queues, which helps to flexibly modify and expand the system. Description of the Drawings
[0018] The drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.
[0019] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0020] One or more embodiments are exemplarily illustrated by the pictures in the corresponding drawings. These exemplary illustrations do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements, unless otherwise stated, and the drawings in the drawings do not constitute a proportional limitation.
[0021] Figure 1 It is a schematic flowchart of a broadcast message processing method provided by the embodiments of the present application;
[0022] Figure 2 It is a schematic flowchart of the second broadcast message processing method provided by the embodiments of the present application;
[0023] Figure 3 It is a schematic flowchart of the third broadcast message processing method provided by the embodiments of the present application;
[0024] Figure 4 It is a schematic flowchart of the fourth broadcast message processing method provided by the embodiments of the present application;
[0025] Figure 5 It is a schematic flowchart of the fifth method for processing broadcast messages provided by an embodiment of the present application;
[0026] Figure 6 It is a schematic flowchart of the sixth method for processing broadcast messages provided by an embodiment of the present application;
[0027] Figure 7 It is a schematic structural diagram of a broadcast message processing device provided by an embodiment of the present application;
[0028] Figure 8 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
[0029] Figure 9 It is a schematic structural diagram of a vehicle provided by an embodiment of the present application. Detailed implementation manners
[0030] Now, various exemplary embodiments of the present application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. It should be noted that: unless otherwise specifically stated, the relative arrangements of components and steps, numerical expressions and values set forth in these embodiments do not limit the scope of the present application.
[0031] Those skilled in the art can understand that terms such as "first", "second", etc. in the embodiments of the present application are only used to distinguish different steps, devices or modules, etc., without representing any specific technical meaning, nor indicating their logical order.
[0032] It should also be understood that in this embodiment, "a plurality" may refer to two or more, and "at least one" may refer to one, two or more.
[0033] It should also be understood that for any component, data or structure mentioned in the embodiments of the present application, without clear definition or contrary indication in the context, it can generally be understood as one or more.
[0034] In addition, the term "and / or" in the present application is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in the present application generally represents an "or" relationship between the associated objects before and after.
[0035] It should also be understood that the description of each embodiment of the present application emphasizes the differences between the embodiments, and their similarities or similarities can be referred to each other. For the sake of brevity, they will not be repeated one by one.
[0036] The following description of at least one exemplary embodiment is merely illustrative and in no way limiting of the present application, its application, or its use.
[0037] Techniques, methods, and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, the above techniques, methods, and devices should be considered as part of the specification.
[0038] It should be noted that like reference numerals and letters denote like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
[0039] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other. For the convenience of understanding the embodiments of the present application, the present application will be described in detail below with reference to the drawings and in combination with the embodiments. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts fall within the scope of protection of the present application.
[0040] To solve the technical problems of large processing delay of broadcast messages, poor balance in the use of system resources, and poor system scalability in the prior art, the present application provides a method for processing broadcast messages, which can reduce the number of broadcast messages processed by each broadcast queue, avoid the processing delay of critical broadcast messages, improve the balance in the use of system resources, and improve the flexibility for modifying and expanding the system.
[0041] Figure 1 It is a schematic flowchart of a method for processing broadcast messages provided by an embodiment of the present application. This method can be applied to one or more electronic devices such as vehicles (e.g., intelligent driving vehicles), smartphones, laptops, desktop computers, portable computers, servers, etc. In addition, the execution subject of this method can be hardware or software. When the above execution subject is hardware, the execution subject can be one or more of the above electronic devices. For example, a single electronic device can execute this method, or multiple electronic devices can cooperate with each other to execute this method. When the above execution subject is software, this method can be implemented as multiple software or software modules, or can be implemented as a single software or software module. No specific limitation is made here.
[0042] As Figure 1 shown, the method specifically includes:
[0043] Step 101, receiving a broadcast message.
[0044] In some embodiments, the broadcast message can be a message sent by processes of different applications in the operating system to different components in the system. This type of message is used to indicate the occurrence of a specific event, and the corresponding component responds to the event. Optionally, the electronic device executing this method can implement the processing steps of this method by modifying the registered broadcast distribution method (broadcastIntentLocked method) in the operating system.
[0045] Step 102, determine the type of the source process that sends the broadcast message, and determine whether the broadcast message belongs to a preset critical broadcast message.
[0046] In some embodiments, the type of the source process of the broadcast message can be preset, and multiple critical broadcast messages can be preset. As an example, the type of the source process can include, but is not limited to, at least one of the following: the foreground process of the system application, the background process of the system application, the foreground process of the third-party application, the background process of the third-party application, etc.
[0047] The above critical broadcast messages are the broadcast messages that need to be processed preferentially in the operating system. For example, for the foreground process of the system application, the critical broadcast messages can include broadcast messages sent by high-priority processes such as system_server and com.android.systemui. For another example, for the background process of the third-party application, the critical broadcast messages can include third-party application processes with relatively low resource occupancy rates.
[0048] The above electronic device can parse the broadcast message to determine the type of the source process and whether it belongs to a critical broadcast message. For example, by setting the identifier of the critical broadcast message and the type identifier of the source process, the above identifiers can be recognized from the parsed critical broadcast message, thereby implementing this step.
[0049] Step 103, if the broadcast message belongs to a critical broadcast message, determine the target critical broadcast queue corresponding to the type of the source process from at least one preset critical broadcast queue, and store the broadcast message in the target critical broadcast queue.
[0050] In some embodiments, at least one critical broadcast queue can be a message queue preset for different types of source processes. Each queue in the critical broadcast queue can correspond to a type of source process, and this queue stores critical broadcast messages. This queue is specifically used for receiving and sending broadcast messages sent by source processes of the corresponding type.
[0051] Step 104, in response to triggering the extraction operation of the broadcast message, extract the broadcast message from the target critical broadcast queue and process the broadcast message.
[0052] In some embodiments, the broadcast messages in the target critical broadcast queue are sequentially extracted. After the stored broadcast message is extracted, the broadcast message can be processed. For example, the broadcast message is sent to the corresponding component, and the component responds to the broadcast message.
[0053] The broadcast message processing method provided by the embodiments of the present application determines the type of the source process that sends the broadcast message when receiving the broadcast message, and determines the target critical broadcast queue corresponding to the type of the source process from at least one preset critical broadcast queue when determining that the broadcast message is a critical broadcast message. In response to triggering the extraction operation of the broadcast message, the broadcast message is extracted from the target critical broadcast queue, and the broadcast message is processed. The embodiments of the present application implement setting critical broadcast messages, classifying the source processes of broadcast messages, and setting separate broadcast queues for specific types of critical broadcast messages, thereby reducing the number of broadcast messages processed by each broadcast queue, avoiding data congestion and delay, and avoiding the processing delay of critical broadcast messages. Moreover, since the types of source processes in the same broadcast queue are the same, the broadcast messages will not be frequently interrupted due to different priorities of the broadcast messages, which helps to improve the balance of system resource utilization. In addition, the embodiments of the present application can also classify different source processes and set corresponding broadcast queues, which helps to flexibly modify and expand the system.
[0054] In some optional implementation manners of this embodiment, as Figure 2 shown, step 104 includes:
[0055] Step 1041, determine the target thread corresponding to the target critical broadcast queue from at least one preset first thread.
[0056] Among them, each first thread in the at least one first thread corresponds to each critical broadcast queue in the at least one critical broadcast queue one by one. Each first thread in the at least one first thread is a thread preset for the corresponding critical broadcast queue, and the first threads can execute in parallel to control the corresponding critical broadcast queues respectively.
[0057] As an example, for the foreground process of the system application, the broadcast message sent by it can be stored in the corresponding first critical broadcast queue, and the broadcast message is processed by the thread corresponding to the first critical broadcast queue; for the background process of the system application, the broadcast message sent by it can be stored in the corresponding second critical broadcast queue, and the broadcast message is processed by the thread corresponding to the second critical broadcast queue.
[0058] Step 1042, use the target thread to extract the broadcast message from the target critical broadcast queue and process the broadcast message.
[0059] The target thread can sequentially extract and process the broadcast queues in the target critical broadcast queue. When the extraction operation of the stored broadcast message is triggered, the target thread can execute the extraction and processing steps of the broadcast message.
[0060] In this embodiment, by setting threads corresponding to different critical broadcast queues, each thread can process multiple critical broadcast queues in parallel, thereby avoiding queue congestion and delay, reducing the overall broadcast message processing time, and improving the system response speed. In addition, by flexibly adjusting the threads of different critical broadcast queues, it can help improve the scalability of the system for processing broadcast messages.
[0061] In some optional implementation manners of this embodiment, as Figure 3 shown, step 103 includes:
[0062] Step 1031, if the type is the foreground process of the system application, determine the preset first critical broadcast queue as the target critical broadcast queue.
[0063] Step 1032, if the type is the background process of the system application, determine the preset second critical broadcast queue as the target critical broadcast queue.
[0064] Step 1033, if the type is the foreground process of the third-party application, determine the preset third critical broadcast queue as the target critical broadcast queue.
[0065] Step 1034, if the type is the background process of the third-party application, determine the preset fourth critical broadcast queue as the target critical broadcast queue.
[0066] The above first critical broadcast queue is mainly used for the broadcast processing of the foreground critical processes of the system application to ensure the high responsiveness of the system core functions. For example, the broadcast messages sent by the following foreground processes of the system application can be used as the broadcast messages processed by the first critical broadcast queue: system_server, com.android.systemui, etc.
[0067] The above second critical broadcast queue is mainly used for the broadcast processing of the background tasks of the system application, and its priority is usually lower than that of the first critical broadcast queue of the foreground application, and is suitable for system processes with relatively low resource occupancy.
[0068] The above third critical broadcast queue is mainly used for the foreground broadcast processing of the third-party application to ensure the timely response to user operations. For example, the foreground processes of the third-party applications commonly used by users are processed by the third critical broadcast queue.
[0069] The above-mentioned fourth key broadcast queue is mainly used for background broadcast processing of third-party applications and usually processes low-priority tasks. This queue is suitable for third-party application processes with low resource occupancy or running in the background.
[0070] In this embodiment, by separately setting key broadcast queues corresponding to background and foreground processes for the system and third-party applications, the priorities of different types of application processes are implemented, and the corresponding broadcast queues are separately set to process broadcast messages, achieving more refined priority control and avoiding mutual interference caused by broadcast messages with different priorities in the same queue. For example, foreground broadcasts usually require quick responses because they may directly affect the user experience; while background broadcasts can reduce the response speed to avoid interfering with foreground tasks.
[0071] In some alternative implementation manners of this embodiment, as Figure 4 shown, after step 102, the method further includes:
[0072] Step 105, if the broadcast message does not belong to a key broadcast message, determine a target general broadcast queue corresponding to the type of the source process from at least one preset general broadcast queue.
[0073] The above-mentioned at least one general broadcast queue can be a message queue set in advance for different types of source processes, and each queue therein is used to process general broadcast messages other than the above-mentioned key broadcast messages. For example, for the foreground process of a system application, the general broadcast messages sent by it can include broadcast messages sent by other processes except for high-priority processes such as system_server and com.android.systemui.
[0074] The type of source process corresponding to a single general broadcast queue can be the same as or different from the type of source process corresponding to a single key broadcast queue. For example, for the foreground process, regardless of whether the general broadcast message is sent by a system process or a third-party application process, the same foreground broadcast queue is used to process the general broadcast message; for the background process, regardless of whether the general broadcast message is sent by a system process or a third-party application process, the same background broadcast queue is used to process the general broadcast message.
[0075] Step 106, in response to triggering the extraction operation of the broadcast message, extract the broadcast message from the target general broadcast queue and process the broadcast message.
[0076] The broadcast messages in the target general broadcast queue will be extracted in sequence. When the stored broadcast message is extracted, the broadcast message can be processed. For example, the broadcast message is sent to the corresponding component, and the component responds to the broadcast message.
[0077] In this embodiment, by setting a default general broadcast queue for other broadcast messages that are not critical broadcast messages, all broadcast messages can be distributed to the corresponding broadcast queues for processing, thereby further reducing the number of messages processed by each broadcast queue, further reducing the competition for the same resource during broadcast distribution, and reducing the probability of lock contention.
[0078] In some alternative implementation manners of this embodiment, step 106 may be executed as follows:
[0079] Use a preset second thread to extract broadcast messages from the target general broadcast queue and process the broadcast messages.
[0080] Among them, the second thread is used to process all general broadcast queues, that is, the read and write operations on any general broadcast queue are executed by the same thread.
[0081] Since the general broadcast queue does not need to respond quickly compared to the critical broadcast queue, therefore, in this embodiment, by setting a second thread to process multiple general broadcast queues, system thread resources can be saved, which helps to make the processing of message broadcasting more compatible with system performance. In the traditional single-queue single-thread mode, the processing of all broadcast messages needs to compete for the same processing resource, and performance bottlenecks are likely to occur. By combining this embodiment with the above embodiments, multiple independent queues and threads can be used to process different types of broadcast messages, and message processing can be faster and more efficient.
[0082] In some alternative implementation manners of this embodiment, as Figure 5 shown, step 105 includes:
[0083] Step 1051, if the type of the source process is a foreground process, determine the preset fifth broadcast queue as the target general broadcast queue.
[0084] Step 1052, if the type of the source process is a background process, determine the preset sixth broadcast queue as the target general broadcast queue.
[0085] Step 1053, if the type of the source process is an offline process, determine the preset seventh broadcast queue as the target general broadcast queue.
[0086] The above foreground process may include a system application foreground process and a third-party application foreground process, and the fifth broadcast queue is a general foreground broadcast queue. The above background process may include a system application background process and a third-party application background process, and the sixth broadcast queue is a general background broadcast queue. The above offline process may be a process executed by the electronic device in an idle state, and the seventh broadcast queue is an offline broadcast queue.
[0087] In this embodiment, by setting up three ordinary broadcast queues, namely the background queue, the foreground queue, and the offline queue, corresponding broadcast queues are set for different types of application processes to handle broadcast messages, further avoiding the mutual interference caused by broadcast messages with different priorities in the same queue.
[0088] In some alternative implementation manners of this embodiment, as Figure 6 shown, before step 102, the method further includes:
[0089] Step 107, running at least one preset process set.
[0090] Each process set in the at least one process set corresponds to a process type. For example, the process types can be divided into system application foreground processes, system application background processes, third-party application foreground processes, third-party application background processes, etc.
[0091] Step 108, for each process set in the at least one process set, statistically analyze the resource occupancy of each process in the process set to obtain the resource occupancy of each process.
[0092] It should be noted that steps 108 - 110 are executed for each process set, that is, steps 108 - 110 are executed multiple times, and each time a process set is processed. That is, the "process set" therein is the currently processed process set.
[0093] The above resource occupancy can be obtained based on data such as the CPU occupancy rate of the process, the memory usage, and the I / O (input / output) operation frequency. As an example, system monitoring tools (such as top, htop, vmstat, etc.) can be used to collect the resource occupancy data of the process in different scenarios. Then, various resource occupancy data can be calculated (such as weighted summation, etc.) to obtain the resource occupancy. Step 109, based on the resource occupancy of each process, determine the processes that meet the preset resource occupancy conditions from the process set as key processes.
[0094] Among them, the resource occupancy condition is the condition for screening key processes. For example, a resource occupancy threshold can be set. If the resource occupancy of a certain process exceeds the threshold, determine that process as a key process. The key processes can be represented by establishing a process whitelist, that is, the broadcast messages sent by the processes in the whitelist are key broadcast messages.
[0095] Step 110, determine the broadcast messages sent by the key processes as key broadcast messages.
[0096] In this embodiment, by pre-statistically analyzing the resource occupancy of various types of processes and determining critical processes and critical broadcast messages based on the statistical results, it is helpful to more accurately screen out critical broadcast messages and improve the pertinence of broadcast message processing.
[0097] Figure 7 FIG. is a schematic structural diagram of a broadcast message processing apparatus provided by an embodiment of the present application. Specifically, it includes:
[0098] A receiving module 701, configured to receive a broadcast message;
[0099] A first determination module 702, configured to determine the type of the source process that sends the broadcast message and determine whether the broadcast message belongs to a preset critical broadcast message;
[0100] A second determination module 703, configured to, if the broadcast message belongs to a critical broadcast message, determine a target critical broadcast queue corresponding to the type of the source process from at least one preset critical broadcast queue, and store the broadcast message in the target critical broadcast queue;
[0101] A first extraction module 704, configured to, in response to a trigger for an extraction operation of the broadcast message, extract the broadcast message from the target critical broadcast queue and process the broadcast message.
[0102] In a possible implementation manner, the first extraction module includes: a first determination unit, configured to determine a target thread corresponding to the target critical broadcast queue from at least one preset first thread, where each first thread in the at least one first thread corresponds to each critical broadcast queue in the at least one critical broadcast queue; an extraction unit, configured to use the target thread to extract the broadcast message from the target critical broadcast queue and process the broadcast message.
[0103] In a possible implementation manner, the second determination module includes: a second determination unit, configured to, if the type is a system application foreground process, determine a preset first critical broadcast queue as the target critical broadcast queue; a third determination unit, configured to, if the type is a system application background process, determine a preset second critical broadcast queue as the target critical broadcast queue; a fourth determination unit, configured to, if the type is a third-party application foreground process, determine a preset third critical broadcast queue as the target critical broadcast queue; a fifth determination unit, configured to, if the type is a third-party application background process, determine a preset fourth critical broadcast queue as the target critical broadcast queue.
[0104] In a possible implementation, the apparatus further includes: a second determination module, configured to determine a target general broadcast queue corresponding to the type of the source process from at least one preset general broadcast queue if the broadcast message does not belong to a critical broadcast message; a second extraction module, configured to extract the broadcast message from the target general broadcast queue and process the broadcast message in response to a trigger for an extraction operation of the broadcast message.
[0105] In a possible implementation, the second extraction module is further configured to: use a preset second thread to extract the broadcast message from the target general broadcast queue and process the broadcast message.
[0106] In a possible implementation, the second determination module includes: a sixth determination unit, configured to determine a preset fifth broadcast queue as the target general broadcast queue if the type of the source process is a foreground process; a seventh determination unit, configured to determine a preset sixth broadcast queue as the target general broadcast queue if the type of the source process is a background process; an eighth determination unit, configured to determine a preset seventh broadcast queue as the target general broadcast queue if the type of the source process is an offline process.
[0107] In a possible implementation, the apparatus further includes: an operation module, configured to operate at least one preset process set, where each process set in the at least one process set corresponds to a process type; a statistics module, configured to, for each process set in the at least one process set, statistically analyze the resource occupancy of each process in the process set to obtain the resource occupancy of each process; and determine, based on the resource occupancy of each process, a process that meets a preset resource occupancy condition in the process set as a critical process; a third determination module, configured to determine a broadcast message sent by the critical process as a critical broadcast message.
[0108] The broadcast message processing apparatus provided in this embodiment may be the broadcast message processing apparatus as Figure 7 shown, and can execute all steps of the above broadcast message processing methods, and thus achieve the technical effects of the above broadcast message processing methods. For specific reference, please refer to the above relevant descriptions. For the sake of brief description, details are not described herein.
[0109] Figure 8 FIG. is a schematic structural diagram of an electronic device provided in an embodiment of the present application. Figure 8 As shown, the electronic device 800 includes: at least one processor 801, a memory 802, at least one network interface 804, and other user interfaces 803. Each component in the electronic device 800 is coupled together through a bus system 805. It can be understood that the bus system 805 is used to implement connection communication between these components. In addition to a data bus, the bus system 805 further includes a power bus, a control bus, and a status signal bus. However, for the sake of clear description, inFigure 8 Various buses are labeled as bus system 805.
[0110] Among them, the user interface 803 may include a display, a keyboard, or a pointing device (for example, a mouse, a trackball, a touchpad, or a touch screen, etc.).
[0111] It can be understood that the memory 802 in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synch link dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM). The memory 802 described herein is intended to include but not be limited to these and any other suitable types of memory.
[0112] In some embodiments, the memory 802 stores the following elements, executable units, or data structures, or subsets thereof, or extended sets thereof: an operating system 8021 and application programs 8022.
[0113] Among them, the operating system 8021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., and is used to implement various basic services and process hardware-based tasks. The application programs 8022 include various application programs, such as a media player and a browser, etc., and are used to implement various application services. The program for implementing the method of the embodiments of the present application may be included in the application programs 8022.
[0114] In this embodiment, by invoking the programs or instructions stored in the memory 802, specifically, the programs or instructions stored in the application program 8022, the processor 801 is used to execute the method steps provided in each method embodiment, for example, including:
[0115] Receive a broadcast message; determine the type of the source process that sends the broadcast message, and determine whether the broadcast message belongs to a preset critical broadcast message; if the broadcast message belongs to a critical broadcast message, determine a target critical broadcast queue corresponding to the type of the source process from at least one preset critical broadcast queue, and store the broadcast message in the target critical broadcast queue; in response to triggering an extraction operation on the broadcast message, extract the broadcast message from the target critical broadcast queue, and process the broadcast message.
[0116] The method disclosed in the embodiments of the present application above can be applied to the processor 801 or implemented by the processor 801. The processor 801 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in the hardware of the processor 801 or the instructions in software form. The above processor 801 may be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of the hardware and software units in the decoding processor. The software unit may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 802, and the processor 801 reads the information in the memory 802 and combines its hardware to complete the steps of the above method.
[0117] It can be understood that the embodiments described herein can be implemented by hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general purpose processors, controllers, microcontrollers, microprocessors, or other electronic units for performing the above functions of this application, or a combination thereof.
[0118] For software implementation, the above technologies herein can be implemented by units that execute the above functions herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented inside or outside the processor.
[0119] The electronic device provided in this embodiment can be an electronic device as shown in Figure 8 and can execute all steps of the above-described broadcast message processing methods, thereby achieving the technical effects of the above-described broadcast message processing methods. For specific details, please refer to the above relevant descriptions. For the sake of brevity, it will not be elaborated here.
[0120] Figure 9 This is a schematic structural diagram of a vehicle 900 provided in an embodiment of this application. Specifically, it includes: the above Figure 8 shown electronic device 800.
[0121] The embodiment of this application also provides a storage medium (computer-readable storage medium). The storage medium stores one or more programs. Among them, the storage medium can include volatile memory, such as random access memory; the memory can also include non-volatile memory, such as read-only memory, flash memory, hard disk, or solid-state drive; the memory can also include a combination of the above types of memory.
[0122] When one or more programs in the storage medium can be executed by one or more processors to implement the above-described broadcast message processing method executed on the electronic device side.
[0123] The above processor is used to execute the program stored in the memory to implement the following steps of the broadcast message processing method executed on the electronic device side:
[0124] Receive a broadcast message; determine the type of the source process that sent the broadcast message, and determine whether the broadcast message belongs to a preset critical broadcast message; if the broadcast message belongs to a critical broadcast message, determine a target critical broadcast queue corresponding to the type of the source process from at least one preset critical broadcast queue, and store the broadcast message in the target critical broadcast queue; in response to triggering an extraction operation for the broadcast message, extract the broadcast message from the target critical broadcast queue, and process the broadcast message.
[0125] Those skilled in the art should also be able to further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Skilled professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0126] The steps of the methods or algorithms described in combination with the embodiments disclosed herein can be implemented by hardware, software modules executed by a processor, or a combination of the two. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.
[0127] It should be understood that the terms used herein are for the purpose of describing specific example embodiments only and are not intended to be limiting. Unless the context clearly indicates otherwise, as used herein, the singular forms "a", "an", and "the" may also include the plural forms. The terms "including", "comprising", "containing", and "having" are inclusive and thus specify the presence of the stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring them to be executed in the particular order described or illustrated, unless the execution order is explicitly stated. It should also be understood that additional or alternative steps may be used.
[0128] The above are only specific embodiments of the present application, enabling those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be obvious to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown herein, but rather will be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A method for processing broadcast messages, characterized in that, The method includes: Receiving a broadcast message; Determining the type of the source process that sent the broadcast message, and determining whether the broadcast message belongs to a preset critical broadcast message; If the broadcast message belongs to the critical broadcast message, determining a target critical broadcast queue corresponding to the type of the source process from at least one preset critical broadcast queue, and storing the broadcast message in the target critical broadcast queue; In response to triggering an extraction operation for the broadcast message, extracting the broadcast message from the target critical broadcast queue, and processing the broadcast message.
2. The method according to claim 1, wherein The extracting the broadcast message from the target critical broadcast queue includes: Determining a target thread corresponding to the target critical broadcast queue from at least one preset first thread, where each first thread in the at least one first thread corresponds one-to-one to each critical broadcast queue in the at least one critical broadcast queue; Using the target thread to extract the broadcast message from the target critical broadcast queue, and processing the broadcast message.
3. The method according to claim 1, characterized in that, The determining a target critical broadcast queue corresponding to the type of the source process from at least one preset critical broadcast queue includes: If the type is a system application foreground process, determining a preset first critical broadcast queue as the target critical broadcast queue; If the type is a system application background process, determining a preset second critical broadcast queue as the target critical broadcast queue; If the type is a third-party application foreground process, determining a preset third critical broadcast queue as the target critical broadcast queue; If the type is a third-party application background process, determining a preset fourth critical broadcast queue as the target critical broadcast queue.
4. The method according to claim 1, wherein After determining the type of the source process that sent the broadcast message and determining whether the broadcast message belongs to a preset critical broadcast message, the method further includes: If the broadcast message does not belong to the critical broadcast message, determining a target ordinary broadcast queue corresponding to the type of the source process from at least one preset ordinary broadcast queue; In response to triggering an extraction operation for the broadcast message, extracting the broadcast message from the target ordinary broadcast queue, and processing the broadcast message.
5. The method according to claim 4, characterized in that, The extracting the broadcast message from the target ordinary broadcast queue and processing the broadcast message includes: Using a preset second thread to extract the broadcast message from the target ordinary broadcast queue, and processing the broadcast message.
6. The method according to claim 4, wherein The determining a target ordinary broadcast queue corresponding to the type of the source process from at least one preset ordinary broadcast queue includes: If the type of the source process is a foreground process, determining a preset fifth broadcast queue as the target ordinary broadcast queue; If the type of the source process is a background process, determining a preset sixth broadcast queue as the target ordinary broadcast queue; If the type of the source process is an offline process, determining a preset seventh broadcast queue as the target ordinary broadcast queue.
7. The method according to any one of claims 1 to 6, characterized in that Before determining the type of the source process that sent the broadcast message and determining whether the broadcast message belongs to a preset critical broadcast message, the method further includes: Run at least one preset process set, where each process set in the at least one process set corresponds to a process type; For each process set in the at least one process set, statistically analyze the resource occupancy of each process in the process set to obtain the resource occupancy of each process; based on the resource occupancy of each process, determine a process that meets the preset resource occupancy condition in the process set as a critical process; Determine the broadcast message sent by the critical process as a critical broadcast message.
8. A broadcast message processing device, characterized in that, The device includes: A receiving module, configured to receive a broadcast message; A first determination module, configured to determine the type of the source process that sends the broadcast message, and determine whether the broadcast message belongs to a preset critical broadcast message; A second determination module, configured to, if the broadcast message belongs to the critical broadcast message, determine a target critical broadcast queue corresponding to the type of the source process from at least one preset critical broadcast queue, and store the broadcast message in the target critical broadcast queue; A first extraction module, configured to, in response to triggering an extraction operation of the broadcast message, extract the broadcast message from the target critical broadcast queue and process the broadcast message.
9. An electronic device, characterized in that, Includes: A memory, configured to store a computer program; A processor, configured to execute the computer program stored in the memory, and when the computer program is executed, implement the broadcast message processing method according to any one of claims 1-7 above.
10. A vehicle, characterized in that, The vehicle includes the electronic device according to claim 9 above.