Methods for increasing cache and related products

By monitoring the timeout of the cache rotation process in BlastBufferQueue and increasing the cache, the problem of cache rotation is solved, the reliability of cache rotation is improved, and the terminal is prevented from freezing screens and unresponsive applications.

CN117687727BActive Publication Date: 2024-11-15HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310848341.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-11
Publication Date
2024-11-15
Estimated Expiration
2043-07-11

AI Technical Summary

Technical Problem

In BlastBufferQueue, blockage is prone to occur during the cache rotation, resulting in terminal screen freezing and application unresponsiveness. The existing technology is difficult to effectively solve this problem.

Method used

By monitoring whether each subprocess in the cache rotation process timed out in real time, if it timed out, a set number of caches are increased for cache rotation, thereby avoiding blockage and improving the reliability of cache rotation.

Benefits of technology

It effectively avoids cache rotation blockage, improves the reliability of cache rotation, ensures the smooth progress of the rendering process, and prevents the problem of terminal screen freezing and application unresponsiveness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117687727B_ABST
    Figure CN117687727B_ABST
Patent Text Reader

Abstract

The present application discloses a method for increasing cache and related products. The method comprises: monitoring whether the cache obtained in each cache wheel rotor process in the cache rotation process has timed out; if the cache obtained in any cache wheel rotor process in the cache rotation process has timed out, adding a set number of caches for cache rotation. The corresponding product is also disclosed. By adopting the scheme of the present application, by real-time monitoring whether the cache obtained in each cache wheel rotor process in the cache rotation process has timed out, if it has timed out, adding a set number of caches for cache rotation, it is possible to avoid cache rotation blocking and improve the reliability of cache rotation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method for dynamically increasing a cache (buffer) and related products. Background Art

[0002] BlastBufferQueue (BBQ for short) maintains a producer (Producer)-consumer (Consumer) model, in which the images rendered by the application program (APP) side (completed by the producer) are saved in the cache, and then the properties of the buffer and layer are submitted to SurfaceFlinger (SF) through a transaction (Transaction) for synthesis and display (the actual consumer). Among them, the rendering completed by the APP side includes the following steps: queue, dequeue, acquire, release, etc. The above steps need to be cached during the execution process, which is the cache rotation process, and the rotation process requires at least 3 caches to be successfully completed. If the cache is lost abnormally in a certain link, it will eventually lead to the entire cache rotation being stuck, the terminal (such as a mobile phone) freezing the screen, and the application not responding (Application Not Response, ANR) and other problems. Summary of the invention

[0003] The present application provides a method for increasing cache and related products to avoid cache rotation blocking and improve the reliability of cache rotation.

[0004] In a first aspect, a method for increasing cache is provided, the method being applied to an electronic device, the method comprising: monitoring whether the cache obtained in each cache round rotor process in a cache rotation process has timed out; and if the cache obtained in any cache round rotor process in the cache rotation process has timed out, adding a set number of caches for cache rotation. In this aspect, by real-time monitoring whether the cache obtained in each cache round rotor process in the cache rotation process has timed out, if it has timed out, adding a set number of caches for cache rotation, cache rotation blocking can be avoided, and the reliability of cache rotation is improved.

[0005] In a possible implementation, the method further includes: based on the increased set number of caches, resuming the cache rotation process. In this implementation, by increasing the set number of caches, cache rotation blocking can be avoided, so that the cache rotation process can be smoothly resumed.

[0006] In another possible implementation, the method further includes: when the cache rotation process ends, releasing the set number of caches. In this implementation, when the cache rotation process ends, releasing the set number of caches can improve the utilization rate of cache resources.

[0007] In another possible implementation, the method further includes: determining the amount of the increased buffer. Exemplarily, the increase or decrease of the buffer in the BBQ can be specifically implemented by controlling mMaxAcquiredBufferCount.

[0008] In another possible implementation, the cache rotation process includes a dequeue buffer process, and the monitoring of each cache rotation sub-process in the cache rotation process to obtain whether the cache has timed out includes: performing timeout monitoring in the dequeue buffer process, and monitoring whether the dequeue buffer process has timed out to obtain the cache.

[0009] In another possible implementation, the cache rotation process includes a queue buffer process, and the monitoring of whether the cache is timed out in each cache rotation sub-process in the cache rotation process includes: for a set application, monitoring whether the cache is timed out in the queue buffer process.

[0010] In another possible implementation, the method further includes: adding an identifier of the set application. In this implementation, considering the standardization and differences of a large number of APP rendering methods, in order to avoid the unknown risk of the scheme of increasing the cache in this application, the identifier of the set application (white list) can be added in BBQ to identify / control the applications in which the scheme is effective, and the applications that can be covered by the scheme are controlled through the white list.

[0011] In a second aspect, a device for increasing cache is provided, which can implement the method in the first aspect. The method can be implemented by software, hardware, or by hardware executing corresponding software.

[0012] In one possible implementation, the device includes: a monitoring unit, configured to monitor whether the cache obtained in each cache round rotor process in the cache rotation process has timed out; and an adding unit, configured to add a set number of caches for cache rotation if the monitoring unit detects that the cache has timed out in any cache round rotor process in the cache rotation process.

[0013] Optionally, the device further includes: a recovery unit, configured to recover the cache rotation process based on the increased set number of caches.

[0014] Optionally, the device further comprises: a releasing unit, configured to release the set amount of cache when the cache rotation process ends.

[0015] Optionally, the device further includes: a determining unit, configured to determine the amount of the cache to be increased.

[0016] Optionally, the cache rotation process includes a dequeue buffer process, and the monitoring unit is used to perform timeout monitoring in the dequeueBuffer process to monitor whether the dequeueBuffer process acquires the cache timeout.

[0017] Optionally, the cache rotation process includes a queue buffer process, and the monitoring unit is used to monitor whether the cache acquisition in the queue buffer process times out for a set application.

[0018] Optionally, the device further includes: an adding unit, configured to add an identifier of the set application.

[0019] In another possible implementation, the device includes a processor coupled to a memory; the processor is configured to support the device to perform the corresponding functions in the above method. The memory is used to couple with the processor, which stores the necessary programs (instructions) and / or data of the device. Optionally, the device may also include an interface to support the interaction between the device and other devices. Optionally, the memory may be located inside the device or outside the device. Optionally, the memory and the processor may be integrated together.

[0020] In a third aspect, an electronic device is provided, comprising an input device, an output device, a memory and a processor; wherein the processor is coupled to the input device, the output device and the memory, and the processor is used to execute a computer program or instruction to control the input device to receive information and to control the output device to send information; when the processor executes the computer program or instruction, the processor is also used to implement the above method through a logic circuit or execute code instructions. The input device and the output device may be an input / output interface, which is used to receive signals from other devices outside the device and transmit them to the processor or to send signals from the processor to other devices outside the device.

[0021] The processor is used to perform the following steps:

[0022] Monitor whether the cache is acquired in each cache round rotor process in the cache rotation process and whether it times out; and if the cache is acquired in any cache round rotor process in the cache rotation process and times out, increase a set number of caches for cache rotation.

[0023] In a possible implementation, the processor is further configured to execute the following step: based on the increased set number of caches, resuming the cache rotation process.

[0024] In another possible implementation, the processor is further configured to execute the following steps: when the cache rotation process ends, the set amount of cache is released.

[0025] In yet another possible implementation, the processor is further configured to execute the following step: determining an increased amount of the cache.

[0026] In another possible implementation, the cache rotation process includes a dequeue buffer process, and the processor executes the step of obtaining whether the cache has timed out in each cache round rotor process in the monitoring cache rotation process, including: performing timeout monitoring in the dequeue buffer process, and monitoring whether the dequeue buffer process obtains the cache timeout.

[0027] In another possible implementation, the cache rotation process includes a queue cache queueBuffer process, and the processor executes the step of monitoring each cache round rotor process in the cache rotation process to obtain whether the cache has timed out, including: for a set application, monitoring whether the cache has timed out in the queueBuffer process.

[0028] In yet another possible implementation, the processor is configured to execute the following step: adding an identifier of the setting application.

[0029] In a fourth aspect, a computer-readable storage medium is provided, in which a computer program or instructions are stored. When a computer executes the computer program or instructions, the method described in the first aspect or any one of the implementations of the first aspect is implemented.

[0030] In a fifth aspect, a computer program product comprising instructions is provided. When the instructions are executed on a device, the device executes the method described in the first aspect or any one implementation of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0032] Figure 1 A schematic diagram of a BlastBufferQueue producer-consumer model provided in an embodiment of the present application;

[0033] Figure 2 A schematic diagram of the buffer rotation process according to an example of an embodiment of the present application;

[0034] Figure 3 A flowchart of a method for increasing cache provided in an embodiment of the present application;

[0035] Figure 4 A schematic diagram of the structure of a device for increasing cache provided in an embodiment of the present application;

[0036] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0037] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application.

[0038] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0039] The term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present application. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0040] Hereinafter, if used, the terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Thus, a feature defined as "first", "second", etc. may explicitly or implicitly include one or more of the feature. In the description of this application, unless otherwise specified, "plurality" means two or more.

[0041] First, the relevant terms involved in the embodiments of the present application are introduced:

[0042] BlastBufferQueue:

[0043] like Figure 1As shown, a schematic diagram of a BlastBufferQueue producer-consumer model provided in an embodiment of the present application. In the Android 12 system, the initialization of BufferQueue-related components is completed in BlastBufferQueue. BufferQueue specifically includes the following components: Producer, BufferQueueCore, and Consumer (virtual consumer). Among them, BufferQueueCore is the actual implementation of BufferQueue. BufferQueueCore is the core of BufferQueue and defines some basic properties of the Buffer queue. Producer and Consumer hold the same BufferQueueCore object, so both Producer and Consumer can access the properties defined by BufferQueue. BufferSlot is used to store GraphicBuffer in BufferQueue, and arrays are used to store a series of BufferSlots. The default size of the array is 64, and one BufferSlot is bound to one GraphicBuffer.

[0044] The rendered image on the APP side (completed by the producer) is saved in the cache, and then the cache and layer attributes are submitted to SF through Transaction for synthesis and display (actual consumer). Among them, the rendering on the APP side includes the following steps: queueing, dequeuing, obtaining, releasing, etc. It can be seen that the entire producer-consumer model is on the APP side, and the operations of Graphic Buffer dequeuing, enqueuing, obtaining, etc. are all completed on the APP side, indicating that the producer model has changed from remote communication to local communication. The change brought about is that the APP side needs to submit the buffer and layer attributes to the SF side through transaction Transaction.

[0045] Caching is required during the execution of the above steps, which is the cache rotation process, and the rotation process requires at least 3 caches to complete successfully. If the cache is lost abnormally in a certain link, it will eventually lead to the entire cache rotation being stuck, the terminal (such as a mobile phone) freezing the screen, ANR and other problems.

[0046] Among them, Buffer has several states as shown in Table 1 below:

[0047] Table 1

[0048]

[0049] In the above states, acquireBuffer and releaseBuffer are often the causes of buffer rotation jam in BBQ. The acquireBuffer process is to submit the buffer from the APP side to the SF side, and the buffer state after this process is marked as active; releaseBuffer is to return the buffer to the APP side after SF consumption is completed, and the buffer state after this process will switch from active state to free state.

[0050] The timeout of dequeueBuffer and queueBuffer is often a direct manifestation of buffer rotation stuck in BBQ. DequeueBuffer is to apply for free buffer for rendering. When dequeueBuffer fails and the buffer cannot be applied continuously, it means that the producer cannot produce images normally and the display content of the terminal will no longer refresh. There is also a similar action of applying for free buffer in queueBuffer (queue is a branch of dequeue, and the buffer and layer submitted by dequeue are processed again). When the free buffer cannot be applied continuously, the buffer rotation in BBQ will also be stuck.

[0051] like Figure 2 FIG. 1 is a schematic diagram of a buffer rotation process according to an embodiment of the present application, which includes the following steps:

[0052] S201. Producer calls dequeueBuffer to request a buffer from BBQ. After receiving the request, BBQ searches for a free buffer in the BufferSlot queue and returns the index of the buffer.

[0053] S202. After the Producer has finished filling the data, it calls queueBuffer to return the buffer to BBQ. BBQ packages the specified buffer into a BufferItem object, sends it to mQueue and notifies the Consumer to consume it.

[0054] S203.Consumer calls acquireBuffer to obtain a buffer from BBQ.

[0055] S204. The APP side submits the cache and layer attributes to SF through Transaction for synthesis and display.

[0056] S205. On the SF side, latchBuffer obtains the target buffer from BufferTX for consumption.

[0057] S206. On the SF side, in PostComposition, after the composition is completed, a callback notification is sent to release the corresponding buffer.

[0058] S207. Call releaseBuffer to return the buffer to BBQ, and this buffer will continue to participate in the rotation later.

[0059] As can be seen from the above process, the buffer rotation in BBQ has encountered many problems. The root causes are different, but they all manifest in the timeout of dequeueBuffer or queueBuffer. For example, SF did not send a binder (a mechanism for inter-process communication) after consuming the buffer, or SF sent a binder but the binder was not executed, or the binder was successfully executed but still failed to trigger the releasebuffer action, resulting in a buffer leak (buffer lost on the SF side). Another example is that the APP side did not normally send the buffer to SF for consumption, resulting in an accumulation problem (buffer lost on the APP side). The above two types of situations will cause limited buffers to accumulate in the active state, and there will be no free state buffers for producers to use.

[0060] In order to solve the problem of cache rotation congestion that may occur in the above-mentioned cache rotation process, the present application provides a solution for increasing the cache, by real-time monitoring of each cache rotation sub-process in the cache rotation process to obtain whether the cache has timed out. If it times out, a set number of caches are added for cache rotation, which can avoid cache rotation congestion and improve the reliability of cache rotation.

[0061] like Figure 3 FIG. 1 is a flow chart of a method for increasing cache provided in an embodiment of the present application. Exemplarily, the method can be applied to electronic devices, such as mobile phones, tablets, etc. The method can include the following steps:

[0062] S301. Monitor whether the cache acquisition in each cache rotation process in the cache rotation process has timed out. If so, proceed to step S302; otherwise, continue monitoring.

[0063] In this embodiment, a cache rotation process includes multiple cache rotation sub-processes. For example, Figure 2As shown, the APP side uses the BBQ model to complete the rendering, including the following steps: queueing, dequeuing, acquiring, releasing, etc. Correspondingly, each of the above steps involves caching, including the following cache wheel rotor process (or cache acquisition interface): dequeueBuffer, queueBuffer, acquireBuffer and releaseBuffer, etc.

[0064] In each cache round, request the cache from BBQ. For example, Figure 2 In the process, Producer calls dequeueBuffer to request a buffer from BBQ. After receiving the request, BBQ searches for a free buffer in the BufferSlot queue. After Producer fills the data, it calls queueBuffer to return the buffer to BBQ. Consumer calls acquireBuffer to obtain a buffer from BBQ.

[0065] However, if the cache rotation is stuck, at least one cache rotation rotor process may fail to obtain the cache within a specified time, resulting in a cache rotation rotor process timeout for obtaining the cache.

[0066] In this embodiment, it is possible to monitor whether the cache is acquired in each cache rotation process in the cache rotation process for timeout.

[0067] In the specific implementation, as mentioned above, the timeout of dequeueBuffer and queueBuffer is often a direct manifestation of buffer rotation stuck in BBQ. Therefore:

[0068] If the cache rotation process includes a dequeueBuffer process, timeout monitoring may be performed in the dequeueBuffer process to monitor whether the dequeueBuffer process has timed out in acquiring the cache.

[0069] If the cache rotation process includes a queueBuffer process, it is possible to monitor whether the cache is acquired in the queueBuffer process and whether it times out.

[0070] Furthermore, considering the standardization and differences of a large number of APP rendering methods, in order to avoid the unknown risks of the scheme that increases the cache in this application, the identification (white list) of the set application can be added to BBQ to identify / control the applications in which the scheme takes effect, and the applications that can be covered by the scheme can be controlled through the white list. Therefore, the identification of the set application can be added at the beginning of the implementation of this scheme, such as the name and index of the set application. Thus, for the set application, it can be monitored whether the cache acquisition in the queueBuffer process has timed out.

[0071] S302: If the cache acquisition in any cache rotation process in the cache rotation process times out, a set number of caches are added for cache rotation.

[0072] If the cache is acquired in any cache rotation process (such as dequeueBuffer process and / or queueBuffer process) in the cache rotation process, the rotation may be stuck. Therefore, a set number of caches is added for cache rotation.

[0073] Exemplarily, the set number can be pre-burned into the terminal when it leaves the factory, or it can be configured. For example, when a cache timeout is detected in any cache rotation process in the cache rotation process, the number of caches to be added can be determined. As mentioned above, dequeueBuffer, queueBuffer and acquireBuffer all involve acquiring caches, so generally, at least 3 caches can be added.

[0074] Exemplarily, the increase or decrease of the buffer in the BBQ can be specifically achieved by controlling mMaxAcquiredBufferCount.

[0075] Among them, an interface increase() is provided for increasing the cache, which can be successfully triggered when there is still sufficient cache available in the BBQ. When triggered, the cache is increased by a set amount at one time; correspondingly, an interface decrease() is provided for releasing the newly added cache, which releases the newly added cache one by one when triggered.

[0076] Specifically, you can increase the above set number of caches for cache rotation at the following times:

[0077] Add timeout monitoring to the dequeueBuffer process. When it is detected that dequeueBuffer obtains the cache timeout, it triggers the call to increase() to add a new cache activation rotation in BBQ.

[0078] When queueBuffer is waiting for the free state of the cache, a child thread is started for the whitelist application to monitor the cache timeout (repeated creation of new temporary threads should be avoided, which can be achieved through a static variable). The implementation principle is as follows: signalStart is used to wake up the threadLoop loop to detect whether the queueBuffer has timed out, and a 2s timeout monitoring is started; when the original BBQ process successfully applies for the cache within 2s, the monitoring will be terminated through signalEnd, and the cache increase scheme will no longer be triggered; when the BBQ is still blocked and fails to apply for the cache after the timeout of 2s, it will trigger the call to increase(), thereby adding 3 caches to the BBQ queue, and sending a signal to reactivate the BBQ rotation.

[0079] It should be noted that when adding the above-mentioned monitoring and caching processes, it is necessary to prevent process deadlocks, prevent system memory from being used up, and ensure that the child thread does not block the main rendering thread when performing monitoring.

[0080] Furthermore, the process may also include the following steps (indicated by dotted lines in the figure):

[0081] S303. Based on the increased set number of caches, resume the cache rotation process.

[0082] This embodiment aims at the dequeueBuffer / queueBuffer timeout stuck problem caused by the above different root causes, and proposes the above dequeueBuffer / queueBuffer timeout monitoring and recovery mechanism. After detecting the cache acquisition timeout, a set number of caches are dynamically added to the BBQ to resume the cache rotation in the BBQ. The newly added caches can ensure that the BBQ rotation is not blocked on the one hand, and on the other hand, it is possible to activate the previously stuck process, for example, in this process, the lost cache is released, and the cache blocked on the APP side is sent to the SF side; after the entire BBQ rotation is reactivated, these newly added caches are released at the appropriate time to restore the original process without affecting the memory. Therefore, the cache rotation process can be finally restored.

[0083] For example, experiments have shown that the dequeueBuffer / queueBuffer rotation process can be restored after a 2s timeout, which improves the reliability of the cache rotation and ensures the execution of the main rendering thread.

[0084] S304. The cache rotation process ends and a set number of caches are released.

[0085] When the cache rotation process ends, the above-set amount of cache is released and can be used for the next cache rotation process, which can improve the utilization rate of cache resources.

[0086] According to a method for increasing cache provided in an embodiment of the present application, by real-time monitoring of each cache rotation process in the cache rotation process to obtain whether the cache has timed out, if it times out, adding a set number of caches for cache rotation, it can avoid cache rotation blockage and improve the reliability of cache rotation.

[0087] It can be understood that in each of the above embodiments, the methods and / or steps implemented by the electronic device may also be implemented by components (such as chips or circuits) that can be used in the electronic device.

[0088] The above mainly introduces the scheme provided by the embodiment of the present application from the perspective of the method flow. Accordingly, the embodiment of the present application also provides a device for increasing the cache, which is used to implement the above method. The device for increasing the cache can be an electronic device in the above method embodiment, or a component that can be used for an electronic device. It can be understood that in order to achieve the above functions, the device for increasing the cache includes a hardware structure and / or software module corresponding to each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiment disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel 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 the present application.

[0089] The embodiment of the present application can divide the functional modules of the device for increasing the cache according to the above method embodiment. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing unit. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical functional division. There may be other division methods in actual implementation.

[0090] Based on the same concept of the above method for increasing cache, the present application also provides the following device for increasing cache:

[0091] like Figure 4 , which is a schematic diagram of a device for increasing cache provided in an embodiment of the present application. The device 400 includes: a monitoring unit 401 and an increasing unit 402; and may also include (indicated by dotted lines in the figure): a recovery unit 403, a release unit 404, a determination unit 405 and an adding unit 406.

[0092] Among them, the monitoring unit 401 is used to monitor whether the cache is acquired in each cache round rotor process in the cache rotation process. The adding unit 402 is used to increase a set number of caches for cache rotation if the monitoring unit detects that the cache is acquired in any cache round rotor process in the cache rotation process.

[0093] In a possible implementation, the recovery unit 403 is configured to recover the cache rotation process based on the increased set number of caches.

[0094] In another possible implementation, the releasing unit 404 is configured to release the set amount of cache when the cache rotation process ends.

[0095] In yet another possible implementation, the determining unit 405 is configured to determine the amount of the cache to be increased.

[0096] In another possible implementation, the cache rotation process includes a dequeue buffer process, and the monitoring unit 401 is used to perform timeout monitoring in the dequeueBuffer process to monitor whether the dequeueBuffer process acquires the cache for timeout.

[0097] In another possible implementation, the cache rotation process includes a queue buffer process, and the monitoring unit 401 is used to monitor whether the cache acquisition in the queueBuffer process times out for a set application.

[0098] In yet another possible implementation, the adding unit 406 is configured to add an identifier of the set application.

[0099] For the specific implementation of the above units, please refer to Figure 3 The relevant description in the illustrated embodiment will not be repeated here.

[0100] According to a device for increasing cache provided in an embodiment of the present application, by real-time monitoring of each cache rotation process in the cache rotation process to obtain whether the cache has timed out, if it times out, a set number of caches are added for cache rotation, thereby avoiding cache rotation blockage and improving the reliability of cache rotation.

[0101] like Figure 5 FIG. 5 is a schematic diagram of a structure of an electronic device provided in an embodiment of the present application. The electronic device 500 may include:

[0102] An input device 501, an output device 502, a memory 503 and a processor 504 (the number of processors 504 in the electronic device may be one or more, Figure 5In some embodiments of the present application, the input device 501, the output device 502, the memory 503 and the processor 504 may be connected via a bus or other means, wherein: Figure 5 The example of connecting through bus is taken in the following.

[0103] The processor 504 is used to perform the following steps:

[0104] Monitor whether the cache is acquired in each cache round rotor process in the cache rotation process and whether it times out; and if the cache is acquired in any cache round rotor process in the cache rotation process and times out, increase a set number of caches for cache rotation.

[0105] In a possible implementation, the processor 504 is further configured to execute the following step: based on the increased set number of caches, resume the cache rotation process.

[0106] In another possible implementation, the processor 504 is further configured to execute the following steps: when the cache rotation process ends, the set amount of cache is released.

[0107] In yet another possible implementation, the processor 504 is further configured to execute the following step: determining an increased amount of the cache.

[0108] In another possible implementation, the cache rotation process includes a dequeue buffer process, and the processor 504 executes the step of obtaining whether the cache has timed out in each cache round rotor process in the monitoring cache rotation process, including: performing timeout monitoring in the dequeue buffer process, and monitoring whether the dequeue buffer process obtains the cache timeout.

[0109] In another possible implementation, the cache rotation process includes a queue cache queueBuffer process, and the processor 504 executes the step of monitoring each cache round rotor process in the cache rotation process to obtain whether the cache has timed out, including: for a set application, monitoring whether the cache has timed out in the queueBuffer process.

[0110] In yet another possible implementation, the processor 504 is configured to execute the following step: adding an identifier of the setting application.

[0111] According to an electronic device provided by an embodiment of the present application, by real-time monitoring of each cache round in the cache rotation process to obtain whether the cache has timed out, if it times out, adding a set number of caches for cache rotation, it can avoid cache rotation blockage and improve the reliability of cache rotation.

[0112] The division of modules in this application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional module in each example of this application may be integrated into one processor, or may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0113] It is understood that the processor in the embodiments of the present application may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.

[0114] The embodiment of the present application also provides a computer-readable storage medium (memory), in which a computer program or instruction is stored. When the computer program or instruction is executed, the method in the above embodiment is implemented. The computer storage medium is a memory device in the device, which is used to store programs and data. It can be understood that the computer storage medium here can include both the built-in storage medium in the device and the extended storage medium supported by the device. The computer storage medium provides a storage space, which stores the operating system of the device. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space. These instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.

[0115] The embodiments of the present application also provide a computer program product including instructions, which, when executed on a computer, enables the computer to execute the method in the above embodiments.

[0116] The embodiment of the present application also provides a circuit, which is coupled to a memory and is used to execute the method shown in the above embodiment. The circuit may include a chip circuit.

[0117] It should be noted that the above units or one or more of the units can be implemented by software, hardware or a combination of the two. When any of the above units or units is implemented by software, the software exists in the form of computer program instructions and is stored in a memory, and a processor can be used to execute the program instructions and implement the above method flow.

[0118] In this application, the processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in this application. A general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the method disclosed in this application may be directly embodied as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0119] When the above units or units are implemented in hardware, the hardware can be any one or any combination of a CPU, a microprocessor, a digital signal processing (DSP) chip, a microcontroller unit (MCU), an artificial intelligence processor, an ASIC, a SoC, an FPGA, a PLD, a dedicated digital circuit, a hardware accelerator or a non-integrated discrete device, which can run the necessary software or not rely on the software to execute the above method flow.

[0120] Optionally, the embodiment of the present application further provides a chip system, including: at least one processor and an interface, the at least one processor is coupled to a memory through the interface, and when the at least one processor runs a computer program or instruction in the memory, the chip system executes the method in the above method embodiment. Optionally, the chip system can be composed of a chip, or can include a chip and other discrete devices, which is not specifically limited in the embodiment of the present application.

[0121] The memory in the present application may also be a circuit or any other device capable of implementing a storage function, for storing program instructions and / or data. The memory is any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. For example, the memory may be a non-volatile memory, such as a digital versatile disc (DVD), a hard disk drive (HDD) or a solid-state drive (SSD), etc., or a volatile memory (volatile memory), such as a random-access memory (RAM).

[0122] It should be understood that in the description of the present application, unless otherwise specified, " / " indicates that the objects associated before and after are in an "or" relationship, for example, A / B can represent A or B; wherein A and B can be singular or plural. Also, in the description of the present application, unless otherwise specified, "multiple" refers to two or more than two. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, wherein a, b, c can be single or multiple. In addition, in order to facilitate the clear description of the technical solutions of the embodiments of the present application, in the embodiments of the present application, the words "first", "second", etc. are used to distinguish the same items or similar items with substantially the same functions and effects. Those skilled in the art can understand that the words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not limit them to be necessarily different. Meanwhile, in the embodiments of the present application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a concrete manner for ease of understanding.

[0123] The terms "including" and "having" and any variations thereof mentioned in the following description of this application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.

[0124] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center.

[0125] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in a claim. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0126] It is understood that the various numbers involved in the embodiments of the present application are only for the convenience of description and are not used to limit the scope of the embodiments of the present application. The size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic.

[0127] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0128] The components in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs. Those skilled in the art can combine or combine the different embodiments and features of the different embodiments described in this specification.

[0129] In the present application, under the premise of no logical contradiction, the examples may reference each other, for example, the methods and / or terms between method embodiments may reference each other, for example, the functions and / or terms between device embodiments may reference each other, for example, the functions and / or terms between device examples and method examples may reference each other.

[0130] The preferred embodiments of the present application disclosed above are only used to help explain the present application. The preferred embodiments do not describe all the details in detail, nor do they limit the present application to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of the present application. The present application selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present application, so that those skilled in the art can understand and use the present application well. The present application is only limited by the claims and their full scope and equivalents.

Claims

1. A method for increasing cache, characterized in that: The method is applied to an electronic device, and the method comprises: For the set application, if the cache rotation is stuck, monitor whether the cache is obtained in each cache rotation process in the cache rotation process. If the cache is acquired in any cache round-robin process in the cache rotation process, a set number of caches is added for cache rotation, and the set number of caches is associated with the number of cache round-robin processes included in the cache rotation process.

2. The method according to claim 1, characterized in that The method further comprises: Based on the increased set number of caches, the cache rotation process is resumed.

3. The method according to claim 2, characterized in that The method further comprises: The cache rotation process ends, and the set amount of cache is released.

4. The method according to any one of claims 1 to 3, characterized in that The method further comprises: An amount of the cache to increase is determined.

5. The method according to any one of claims 1 to 3, characterized in that: The cache rotation process includes a dequeue buffer process, and the monitoring of each cache rotation sub-process in the cache rotation process to obtain whether the cache is timed out includes: Timeout monitoring is performed in the dequeueBuffer process to monitor whether the dequeueBuffer process has timed out in obtaining the cache.

6. The method according to any one of claims 1 to 3, characterized in that The cache rotation process includes a queue buffer process, and the monitoring of each cache rotation sub-process in the cache rotation process to obtain whether the cache is timed out includes: For the specified application, monitor whether the cache acquisition in the queueBuffer process times out.

7. The method according to claim 6, characterized in that The method further comprises: Add the identifier of the setting application.

8. A device for increasing cache, characterized in that: The device comprises: A monitoring unit is used to monitor whether the cache is acquired in each cache rotation process in the cache rotation process for a set application, if a cache rotation jam occurs; An adding unit is used to add a set number of caches for cache rotation if the monitoring unit detects that a cache timeout is obtained in any cache round rotor process in the cache rotation process, and the set number of caches is associated with the number of cache round rotor processes included in the cache rotation process.

9. The device according to claim 8, characterized in that The device also includes: The recovery unit is used to recover the cache rotation process based on the increased set number of caches.

10. The device according to claim 9, characterized in that The device also includes: The release unit is used to release the set amount of cache when the cache rotation process ends.

11. The device according to any one of claims 8 to 10, characterized in that The device also includes: A determining unit is used to determine the amount of the cache to be increased.

12. The device according to any one of claims 8 to 10, characterized in that The cache rotation process includes a dequeue buffer process, and the monitoring unit is used to perform timeout monitoring in the dequeueBuffer process to monitor whether the dequeueBuffer process acquires the cache timeout.

13. The device according to any one of claims 8 to 10, characterized in that The cache rotation process includes a queue buffer process, and the monitoring unit is used to monitor whether the cache is acquired in the queue buffer process for a set application.

14. The device according to claim 13, characterized in that The device also includes: The adding unit is used to add the identifier of the setting application.

15. An electronic device, characterized in that: The device comprises an input device, an output device, a memory and a processor; wherein the processor is used to execute the method according to any one of claims 1 to 7.

16. A chip, characterized in that: The chip is used to execute the method according to any one of claims 1 to 7.

17. A chip module, characterized in that: The invention comprises an input-output component and a chip, wherein the chip is used to execute the method according to any one of claims 1 to 7.

18. A computer-readable storage medium, characterized in that: The storage medium stores a computer program or instruction. When the computer program or instruction is executed by the dynamically increasing cache device, the method according to any one of claims 1 to 7 is implemented.