Method, computer system and storage medium for display using multiple buffers
The method and system optimize data distribution across multiple buffers with varying capacities to improve data transmission efficiency and reduce resource usage in dynamic and static image displays.
Patent Information
- Application Number
- CN202410947486.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-16
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-07-16
AI Technical Summary
Existing data transmission methods do not optimize the distribution of cached data between buffers, leading to inefficiencies in dynamic and static image displays.
A method and system utilizing multiple buffers with varying capacities to cache and retrieve data for dynamic and static displays, employing first-in-first-out queues and ring buffers to manage message sets efficiently.
Enhances data transmission efficiency and reduces computing resource usage while maintaining image richness during dynamic and static displays by optimizing buffer utilization.
Smart Images

Figure CN118484158B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data transmission, and more specifically to a method, a computer system and a storage medium for caching data using multiple buffers. Background Art
[0002] A buffer acts as a temporary storage area for data between the processor and the memory, allowing the processor to read and write data directly from the buffer to improve efficiency. However, when using one or more buffers for data transmission, the problem of how to optimize the distribution of cached data between the buffers may not be considered.
[0003] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present application, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention
[0004] Embodiments of the present application provide a method, a computer system, and a storage medium for displaying using multiple buffers, which can help balance dynamic and static image displays.
[0005] According to one aspect of the present application, a method for displaying using multiple buffers is provided, the method comprising: caching a first message set into a first buffer, the first message set being used for dynamic display and static display; and caching part of the messages in the cached first message set from the first buffer to a second buffer, the capacity of the second buffer being smaller than the capacity of the first buffer, wherein when the dynamic display is performed on the display interface, one or more messages in the cached part of the messages are obtained from the second buffer; and when the static display is performed on the display interface, one or more messages in the cached first message set are obtained from the first buffer.
[0006] In one or more embodiments of the present application, optionally, the method further includes: caching a second message set used for the dynamic display and the static display into a third buffer, and selecting one of the first message set and the second message set that has been cached into the third buffer to cache into the first buffer.
[0007] In one or more embodiments of the present application, optionally, the method further includes: when switching between the first message set and the second message set for caching into the first buffer that has already cached the first message set or the second message set, clearing the first buffer and correspondingly caching the second message set or the first message set into the first buffer.
[0008] In one or more embodiments of the present application, optionally, the first message set and the second message set contain the same or different messages.
[0009] In one or more embodiments of the present application, optionally, each message in one or more of the first message set, the partial messages and the second message set is cached in accordance with a first-in-first-out rule to form a first-in-first-out message queue in the corresponding first buffer, the second buffer and the third buffer.
[0010] In one or more embodiments of the present application, optionally, the portion of messages is messages from the head position to the i-th position of a first-in-first-out queue formed by the first message set arranged in the first buffer, where i is a positive integer greater than 1 and less than n, and n is the total number of messages in the first-in-first-out queue formed by the first message set in the first buffer.
[0011] In one or more embodiments of the present application, optionally, one or more of the first buffer, the second buffer, and the third buffer include a ring buffer.
[0012] According to one aspect of the present application, a computer system is provided, comprising: at least one memory; at least one processor; and a computer program stored in the memory and executable on the processor, wherein the execution of the computer program on the processor results in the following operations: caching a first message set in a first buffer zone, wherein the first message set is used for dynamic display and static display; and caching a portion of the messages in the cached first message set from the first buffer zone to a second buffer zone, wherein the capacity of the second buffer zone is smaller than the capacity of the first buffer zone, wherein when the dynamic display is performed on the display interface, one or more messages in the cached portion of the messages are obtained from the second buffer zone; and when the static display is performed on the display interface, one or more messages in the cached first message set are obtained from the first buffer zone.
[0013] According to one aspect of the present application, a computer-readable storage medium is provided, in which instructions are stored, and it is characterized in that when the instructions are executed by a processor, any one of the methods described above is implemented.
[0014] According to one aspect of the present application, a computer program product is provided, the computer program product comprising computer instructions, wherein the computer instructions implement any one of the methods described above when executed by a processor. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and other features, aspects and advantages of the present application will become better understood when reading the following detailed description with reference to the accompanying drawings, in which the same or similar elements are represented by the same reference numerals. It should be noted that the drawings in the present application are only schematic and may not be drawn to scale or specific numbers. In the drawings:
[0016] Figure 1 An input-output model 100 of multiple buffers according to one or more embodiments of the present application is shown;
[0017] Figure 2 is a flowchart of a method for displaying using multiple buffers according to one or more embodiments of the present application;
[0018] Figure 3 A schematic block diagram of a computer system. DETAILED DESCRIPTION
[0019] The present application is described more fully below with reference to the accompanying drawings which illustrate illustrative embodiments of the present application. However, the present application may be implemented in different forms and should not be interpreted as being limited to the embodiments given herein. The following embodiments are given to make the disclosure herein comprehensive and complete, so as to more fully convey the scope of protection of the present application to those skilled in the art.
[0020] In this specification, terms such as "comprise" and "include" indicate that in addition to the units and steps directly and explicitly stated in the specification and claims, the technical solution of the present application does not exclude the situation where there are other units and steps that are not directly or explicitly stated.
[0021] Unless otherwise specified, terms such as "first" and "second" do not indicate the order of the units in terms of time, space, size, etc., but are merely used to distinguish the units.
[0022] In this specification, "display interface" refers to the viewable area displayed on a display, and the display may include but is not limited to a liquid crystal display (LCD), a liquid crystal on silicon (LCOS) display, an organic light-emitting diode (OLED) display, a digital light processing (DLP) display or a micro-electro-mechanical systems (MEMS) display, and a user can control the displayed objects (such as images, videos, texts, visual data, etc.) in the viewable interface, such as switching from a dynamic picture to a static picture.
[0023] In this specification, "dynamic display" and "static display" refer to displaying an object on a display interface using a continuously changing picture and a static picture, respectively. The dynamic display may include the scrolling display of multiple images, the playback of a video, the real-time change of visual data, etc. The static display may include the display of one or more images, the paused display of one or more frames in a video and the visual data, etc.
[0024] Figure 1 An input-output model 100 of multiple buffers according to one or more embodiments of the present application is shown.
[0025] like Figure 1 As shown in FIG. 1 , the input-output model 100 may include a first buffer 110 , a second buffer 120 , and may also include a third buffer 130 . Figure 1 The arrow in represents one direction in which the message is transmitted between these buffers. The first buffer 110, the second buffer 120 and the third buffer 130 may be integrated into one RAM memory or distributed in multiple RAM memories. The capacity of the first buffer 110 may be greater than the capacity of the second buffer 120.
[0026] Messages used for display (e.g., dynamic display or static display) may be cached in the first buffer 110, and as an alternative, the first buffer 110 may obtain the messages cached therein from the third buffer 130, and the capacity of the third buffer 130 may be equal to or greater than the capacity of the first buffer 110. Next, the cached messages may be cached from the first buffer 110 to the second buffer 120. When displaying, the cached messages may be obtained from the first buffer 110 or the second buffer 120 for display.
[0027] Figure 2 is a flowchart of a method for displaying using multiple buffers according to one or more embodiments of the present application.
[0028] exist Figure 2In step 210 of the method 200 shown in , a set of one or more messages (hereinafter referred to as a first message set) from a data source (e.g., a database stored in a memory such as a ROM, EPROM, or E2PROM) may be cached in a first buffer, and the first message set may include messages for recording images, texts, visual data, audio and video, etc. Next, one or more messages (e.g., all messages) in the cached first message set may be obtained from the first buffer for display on a display interface, such as for decoding by a video codec protocol, etc. In step 220, part of the messages in the first message set cached in the first buffer may be cached from the first buffer to a second buffer. Next, one or more messages in the part of the messages in the cached first message set may be obtained from the second buffer for display on a display interface.
[0029] In one or more embodiments, when performing dynamic display on the display interface, some messages in the cached first message set can be obtained from the second buffer (for example, all messages in the said part of messages), and when performing static display, one or more messages in the cached first message set can be obtained from the first buffer, for example, all messages in the first message set. In this way, when performing dynamic display, by reducing the amount of messages to be displayed, the occupation of computing resources (for example, computer memory) used for dynamic display can be reduced, and the jamming of dynamic pictures can be avoided or at least alleviated; on the other hand, when performing dynamic display, since each frame of the picture may usually have only a small change with the previous frame of the picture (the change is presented by the message used for dynamic display), the richness of the picture will not be significantly reduced due to the reduction of the amount of messages compared with the static display. Compared with the dynamic display of the picture that changes continuously over a period of time, the static display occupies less computing resources, so the richness of the picture can be increased by, for example, using all the messages in the first message set.
[0030] In one or more embodiments, a second message set (for example, which may come from the above data source or another data source) may be cached in a third buffer, and the second message set may also include messages for recording images, text, visual data, audio and video, etc. One or more messages (for example, all messages) in the second message set cached in the third buffer may be cached in the first buffer. A selection may be made between the first message set and the second message set already stored in the third buffer. Specifically, one of them may be selected to be cached in the first buffer based on the time expected to be spent in the process from caching the message into the buffer to displaying it on the display interface. Since the data transmission speed between buffers is faster than the transmission speed between, for example, a ROM memory and a buffer, it is expected that the time spent using the second message set already stored in the third buffer to cache it in the first buffer is shorter.
[0031] In one or more embodiments, a switch may be made between a first message set and a second message set for caching in a first buffer. When switching between a first message set and a second message set, the first buffer that has already cached the first message set may be cleared and the second message set may be cached in the first buffer, and correspondingly, the first buffer that has already cached the second message set may be cleared and the first message set may be cached in the first buffer. For example, when performing a static display, the first message set cached in the first buffer may be cleared and switched to the second message set for caching. Since the data transmission speed between buffers is faster than the transmission speed between, for example, a ROM memory and a buffer, the improved data transmission efficiency helps alleviate the jamming of, for example, dynamic images during switching.
[0032] In one or more embodiments, the same or different messages may exist in the first message set and the second message set. Since the first message set and the second message set may come from the same data source, there may be one or more identical messages or no identical messages in the first message set and the second message set. Further, the second message set may, for example, include the original data in the data source, and the first message set may, for example, include the original data in the data source and filtered data, such as data filtered by using Pandas.
[0033] In one or more embodiments, each message in the first message set may be cached in a first-in-first-out message queue formed in the first buffer according to the first-in-first-out (FIFO) rule. Similarly, each message in the second message set may be cached in a first-in-first-out message queue formed in the third buffer according to the first-in-first-out rule. Similarly, each message in the messages cached in the second buffer may be cached in a first-in-first-out message queue formed in the second buffer according to the first-in-first-out rule. The messages forming the second message set may be messages from the head position to the i-th position of the first-in-first-out queue formed by the first message set arranged in the first buffer, where i is a positive integer greater than 1 and less than n, and n is the total number of messages in the first-in-first-out queue formed by the first message set in the first buffer. For example, the second message set is formed by messages from the head position to the 5000th position of the first-in-first-out queue formed by the first message set, so that the second message set consists of 5000 messages.
[0034] In one or more embodiments, one or more of the first buffer, the second buffer, and the third buffer may be (e.g., may include) a ring buffer. Through the ring buffer, for example, computer memory may be efficiently utilized, and high read and write efficiency may be achieved because there is no need to frequently move the pointer.
[0035] Figure 3 is a schematic block diagram of a computer system. Figure 3 As shown, the computer system 300 includes at least one memory 310 (e.g., a non-volatile memory such as a flash memory, a ROM, a hard disk drive, a magnetic disk, an optical disk, etc.), at least one processor 320, and a computer program 330. The memory 310 stores the computer program 330 executable by the processor 320. The processor 330 is configured to run the computer program 330 stored on the memory 310. The above-mentioned method can be realized by running the computer program stored on one or more memories on one or more processors (e.g., a method in which multiple processors run the computer program in cooperation or a method in which a single processor runs the computer program alone). Figure 2 One or more steps or operations included in the method.
[0036] According to another aspect of the present application, a computer-readable storage medium is provided on which instructions are stored. When the instructions are executed by a processor, the above-mentioned Figure 2 One or more steps or operations included in the method.
[0037] According to another aspect of the present application, a computer program product is also provided, the computer program product comprising computer instructions, the computer instructions can be executed by a processor to achieve the above Figure 2One or more steps or operations included in the method.
[0038] The processor referred to in this application may be an integrated circuit chip having the ability to process signals. Figure 2 One or more steps or operations included in the method may be performed by an integrated logic circuit of hardware in a processor or by instructions in the form of software. 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. The general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0039] The computer-readable storage medium referred to in this application includes various types of computer storage media, which can be any available medium that a general or special-purpose computer can access. For example, a computer-readable storage medium may include RAM, ROM, EPROM, E2PROM, register, hard disk, removable disk, CD-ROM or other optical disk storage, disk storage or other magnetic storage device, or any other temporary or non-temporary medium that can be used to carry or store a desired program code unit in the form of an instruction or data structure and can be accessed by a general or special-purpose computer, or a general or special-purpose processor. The above combination should also be included in the protection scope of the computer-readable storage medium. The exemplary storage medium is coupled to the processor so that the processor can read and write information from / to the storage medium. In an alternative, the storage medium can be integrated into the processor. The processor and the storage medium can reside in an ASIC. The ASIC can reside in a user terminal. In an alternative, the processor and the storage medium can reside in a user terminal as discrete components.
[0040] It should be noted that the embodiments described in the present application are only exemplary, and are not intended to limit the scope of the claimed subject matter, and the technical solutions recorded in the present application can be implemented in different forms without departing from the spirit and scope of the present application. In the above detailed description of the embodiments, many specific details are set forth in order to provide a more thorough understanding of the disclosed content of the present application. However, in one or more embodiments, well-known features are not described in detail to avoid making the description unnecessarily complicated. Those skilled in the art will know that the above description and examples are provided only for the convenience of explanation and example, and the proposed description is not intended to cover the various aspects of the present application or limit the present application to the disclosed precise form.
Claims
1. A method for displaying using multiple buffers, wherein the multiple buffers include a first buffer, a second buffer, and a third buffer, the method comprising: Selecting one of a first message set and a second message set that has been cached in the third buffer to cache in the first buffer, wherein the first message set and the second message set are used for dynamic display and static display; as well as caching part of the cached first message set or the cached second message set from the first buffer to the second buffer, the capacity of the second buffer being smaller than the capacity of the first buffer, Wherein, when the dynamic display is performed on the display interface, one or more messages among the buffered part of the messages are obtained from the second buffer; as well as When the static display is performed on the display interface, one or more messages in the cached first message set or the cached second message set are obtained from the first buffer.
2. The method of claim 1, wherein: The method further comprises: When switching between the first message set and the second message set for caching in the first buffer that has cached the first message set or the second message set, the first buffer is cleared and the second message set or the first message set is cached in the first buffer accordingly.
3. The method of claim 1, wherein: The first message set and the second message set may contain the same or different messages.
4. The method of claim 1, wherein: Each message in one or more of the first message set, the partial messages and the second message set is cached in a first-in-first-out message queue formed in the corresponding first buffer, the second buffer and the third buffer according to a first-in-first-out rule.
5. The method of claim 4, wherein: The partial messages are messages from the head position to the i-th position of the first-in-first-out queue formed by the first message set arranged in the first buffer, where i is a positive integer greater than 1 and less than n, and n is the total number of messages in the first-in-first-out queue formed by the first message set in the first buffer.
6. The method of claim 1, wherein: One or more of the first buffer, the second buffer, and the third buffer include a ring buffer.
7. A computer system comprising: at least one memory; at least one processor; as well as A computer program stored on the memory and executable on the processor, the execution of the computer program on the processor causing the following operations: Selecting one of a first message set and a second message set that has been cached in a third buffer to cache in the first buffer, wherein the first message set and the second message set are used for dynamic display and static display; as well as caching part of the cached first message set or the cached second message set from the first buffer to a second buffer, wherein the capacity of the second buffer is smaller than the capacity of the first buffer, Wherein, when the dynamic display is performed on the display interface, one or more messages among the buffered part of the messages are obtained from the second buffer; as well as When the static display is performed on the display interface, one or more messages in the cached first message set or the cached second message set are obtained from the first buffer.
8. A computer-readable storage medium, wherein instructions are stored in the computer-readable storage medium, characterized in that: When the instructions are executed by a processor, the method according to any one of claims 1 to 6 is implemented.
9. A computer program product, comprising computer instructions, characterized in that: The computer instructions implement the method according to any one of claims 1 to 6 when executed by a processor.
