Shared memory data calling method, device, equipment and readable storage medium

By creating a storage blockchain table and hash table in shared memory and dynamically managing storage blocks, the problem of insufficient memory during shared memory replacement is solved, achieving more efficient data processing performance and system stability.

CN119200968BActive Publication Date: 2025-09-26INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411211738.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2025-09-26
Estimated Expiration
2044-08-30

AI Technical Summary

Technical Problem

Existing shared memory replacement technology may cause insufficient memory when the virtual machine is overloaded, affecting system stability. It also relies on the memory management of the virtual machine operating system and cannot effectively utilize the shared memory space.

Method used

By creating a storage blockchain table and hash table in shared memory, the storage blocks are dynamically managed, and the storage blockchain table is used to find free blocks and replace them. Combined with the circular queue strategy of the access mark bit, the use of storage blocks is optimized.

Benefits of technology

Improves the data processing performance of shared memory, avoids virtual machine shutdown due to insufficient memory, and improves system stability and data access speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119200968B_ABST
    Figure CN119200968B_ABST
Patent Text Reader

Abstract

The present application discloses a shared memory data call method, apparatus, device, and readable storage medium, relating to the field of storage technology. The method includes: obtaining a data access request, determining a cache identifier of the accessed data based on the data access request; determining whether the accessed data exists in the shared memory based on the cache identifier; in response to the accessed data not existing in the shared memory, searching for a free storage block in the shared memory by storing a blockchain table; in response to the absence of a free storage block in the shared memory, determining a replacement storage block based on the storage block stored in the last called data; writing the accessed data into the replacement storage block, and responding to the data access request. By implementing the shared memory data call method, apparatus, device, and readable storage medium disclosed in the embodiments of the present application, it is possible to timely screen and obtain storage blocks for replacement in the shared memory, thereby improving the data processing performance of the shared memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of storage technology, and in particular to a method, apparatus, device, and readable storage medium for calling shared memory data. Background Art

[0002] In the era of big data, databases are widely used. Disks or disk arrays serve as storage media for data. Accordingly, data is stored at a physical address on the disk. When the central processing unit (CPU) needs to access data, reading and writing to disks is slow, while CPU access to memory is extremely fast. Writing frequently used data from physical storage addresses to shared memory can significantly improve CPU processing speed. Due to limited shared memory space, when shared memory is full, the original data must be replaced. Currently, a common approach is memory bubbles. While memory bubbles can improve physical memory utilization by squeezing memory from other virtual machines and freeing up memory for highly utilized virtual machines, this technology relies on the premise that the memory in the virtual machine's operating system cannot always be fully utilized. If over-allocation is excessive—that is, the total memory allocated to a virtual machine exceeds the actual available physical memory—and all guest machines experience high memory usage, virtual machines may be shut down due to insufficient memory. Summary of the Invention

[0003] In order to solve the defects existing in shared memory replacement, this application provides the following technical solutions:

[0004] In a first aspect, a shared memory data calling method is provided, comprising:

[0005] Obtaining a data access request, and determining a cache identifier of the accessed data according to the data access request;

[0006] Determine whether the accessed data exists in the shared memory according to the cache identifier;

[0007] In response to the accessed data not being present in the shared memory, searching for a free storage block in the shared memory by storing the blockchain table;

[0008] In response to the absence of a free storage block in the shared memory, determining a replacement storage block based on a storage block stored in the last called data;

[0009] Writes the accessed data into the replacement storage block and responds to data access requests.

[0010] Furthermore, before obtaining the data access request and determining the cache identifier of the accessed data according to the data access request, the method further includes:

[0011] Apply for several storage blocks from the memory as shared memory;

[0012] Creating a storage blockchain table associated with the requested storage blocks, wherein the storage blockchain table is used to store at least the numbers of the storage blocks and a mapping of physical storage addresses of data stored in the storage blocks corresponding to the numbers;

[0013] A hash table is created, wherein the hash table includes at least a cache identifier associated with the data stored in the storage block.

[0014] Furthermore, the shared memory data calling method further includes:

[0015] Traverse the hash table to determine whether the cache identifier exists in the hash table;

[0016] In response to the cache identifier being present in the hash table, the data access request is responded to with the storage block corresponding to the cache identifier.

[0017] Furthermore, in response to the absence of a free storage block in the shared memory, determining a replacement storage block according to the storage block stored in the last called data includes:

[0018] Sequentially number any storage block in the shared memory;

[0019] Setting an access flag bit for any storage block, wherein the access flag bit includes a first flag and a second flag, the first flag indicating that the corresponding storage block is in an access active state, and the second flag indicating that the corresponding storage block is in an access inactive state;

[0020] The sequentially numbered storage blocks in the shared memory are set as a circular queue according to the order of the numbers, and are used to poll and identify the access flag bits of the storage blocks;

[0021] Starting from the last memory block marked as the first tag in the shared memory, the memory blocks in the circular queue are polled and compared according to the cache identifier until a memory block whose first access tag bit is marked as the second tag is found;

[0022] Using the first memory block found to be marked with the second mark as the replacement memory block;

[0023] Clear the data stored in the replacement storage block;

[0024] The step of polling and comparing the storage blocks in the circular queue according to the cache identifier includes:

[0025] In response to the access flag bit of the storage block being marked as a first flag, comparing the cache identifier of the accessed data corresponding to the data access request with the cache identifier of the storage block;

[0026] In response to the cache identifier of the accessed data corresponding to the data access request being different from the cache identifier of the storage block, the access flag bit of the storage block is changed to a second flag.

[0027] Furthermore, the data access request includes at least a read request, and the accessed data is written into the replacement storage block, and responding to the data access request includes:

[0028] In response to the data access request being a read request, obtaining data from a physical storage address of the data corresponding to the read request;

[0029] Writing the acquired data into the replacement storage block to replace the data originally stored in the replacement storage block;

[0030] Determine, based on the acquired data, a cache identifier corresponding to the data;

[0031] Adds the cache identifier to the hash table.

[0032] Furthermore, the data access request also includes a write request to write the accessed data into the replacement storage block, and responding to the data access request also includes:

[0033] In response to the data access request being a write request, writing the data requested to be written into the replacement storage block to replace the data originally stored in the replacement storage block;

[0034] Determine, based on the data requested to be written, a cache identifier corresponding to the data requested to be written;

[0035] Add the cache identifier to the hash table;

[0036] The data requested to be written is written from the replacement storage block to the corresponding physical storage address.

[0037] Furthermore, the shared memory data calling method further includes:

[0038] In response to the data stored in any storage block no longer being used by any process, the data will be written back to the disk according to the physical storage address mapping of the data;

[0039] Set the memory block as a free memory block.

[0040] In a second aspect, a shared memory data calling device is provided, comprising:

[0041] an identifier determination module, configured to obtain a data access request and determine a cache identifier of the accessed data according to the data access request;

[0042] A data verification module, used to determine whether the accessed data exists in the shared memory based on the cache identifier;

[0043] a block search module, configured to search for a free storage block in the shared memory by storing the blockchain table in response to the accessed data not being present in the shared memory;

[0044] a block replacement module, configured to determine a replacement storage block based on a storage block stored in the last called data in response to the absence of a free storage block in the shared memory;

[0045] The data writing module is used to write the accessed data into the replacement storage block from the physical storage address and respond to the data access request with the accessed data.

[0046] In the third aspect, a shared memory data calling device is provided, comprising a memory, a processor, and a shared memory data calling program stored in the memory and runnable on the processor. When the processor executes the shared memory data calling program, the shared memory data calling method described in the first aspect is implemented.

[0047] In a fourth aspect, a computer-readable storage medium is provided, on which a shared memory data calling program is stored. When the shared memory data calling program is executed by a processor, the shared memory data calling method recorded in the first aspect is implemented.

[0048] In a fifth aspect, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the shared memory data calling method described in the first aspect.

[0049] The beneficial effect of the technical solution provided by the embodiments of the present application is: by implementing the shared memory data calling method, device, equipment and readable storage medium disclosed in the embodiments of the present application, it is possible to timely screen and obtain storage blocks for replacement in the shared memory, thereby improving the data processing performance of the shared memory. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0051] Figure 1 This is a schematic diagram of a shared memory data calling method provided in an embodiment of the present application;

[0052] Figure 2 This is a schematic diagram of a shared memory data calling device provided in an embodiment of the present application;

[0053] Figure 3This is a schematic diagram of a shared memory data calling device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0054] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0055] Unless otherwise defined, technical or scientific terms used in this disclosure should have the ordinary meaning understood by a person of ordinary skill in the art to which this disclosure belongs. The terms "first," "second," and similar expressions used in this disclosure do not indicate any order, quantity, or importance, but are simply used to distinguish different components. Similarly, terms such as "a," "an," or "the" do not indicate a quantitative limitation, but rather indicate the presence of at least one. The numbers in the drawings in this specification merely distinguish between various functional components or modules and do not indicate a logical relationship between the components or modules. Terms such as "include" or "comprising" mean that the element or object preceding the term includes the elements or objects listed after the term, and their equivalents, without excluding other elements or objects. Terms such as "connected" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0056] Hereinafter, various embodiments of the present disclosure will be described in detail with reference to the accompanying drawings. Note that, in the accompanying drawings, the same reference numerals are given to components having substantially the same or similar structures and functions, and repeated descriptions thereof will be omitted.

[0057] To address the defects in shared memory replacement, this application provides the following technical solutions:

[0058] In some embodiments, as Figure 1 As shown, a shared memory data calling method includes:

[0059] S100: Obtain a data access request, and determine a cache identifier of the accessed data according to the data access request;

[0060] S200: Determine whether the accessed data exists in the shared memory according to the cache identifier;

[0061] S300: In response to the accessed data not being present in the shared memory, searching for a free storage block in the shared memory by storing the blockchain table;

[0062] S400: In response to the absence of a free storage block in the shared memory, determining a replacement storage block based on the storage block where the last called data is stored;

[0063] S500: Writing the accessed data into the replacement storage block and responding to the data access request.

[0064] The cache identifier represents the corresponding identification of the data stored in the storage block and the physical storage address of the data. Optionally, the hash value of the corresponding data can be used as the cache identifier.

[0065] Preferably, a mapping relationship between data stored in a storage block and a physical storage address of the data is used as a cache identifier.

[0066] Replacing a storage block means that the storage block that originally stored data needs to be replaced by new data.

[0067] Specifically, S100: obtaining a data access request, and before determining the cache identifier of the accessed data according to the data access request, the process further includes:

[0068] S010: Request several storage blocks from the memory as shared memory;

[0069] S020: Creating a storage blockchain table associated with the requested storage blocks, wherein the storage blockchain table is used to store at least the numbers of the storage blocks and a mapping of physical storage addresses of data stored in the storage blocks corresponding to the numbers;

[0070] S030: Create a hash table, wherein the hash table at least includes a cache identifier associated with the data stored in the storage block.

[0071] Preferably, the central processing unit divides a portion of continuous storage blocks in the memory as shared memory.

[0072] Optionally, the storage blockchain table and hash table are initialized to initial values. In addition, parameters such as input and output locks can also be initialized.

[0073] The above process completes the initialization of the shared memory space.

[0074] Schematically, the following illustrates an initialization process:

[0075] typedefstruct BufDesc

[0076] {

[0077] BufTag tag;

[0078] int buf_id;

[0079] int state;

[0080] int wait_pid;

[0081] int nextFree;

[0082] LWLock content_lock;

[0083] }BufDesc;

[0084] Among them, the BufTag structure identifies the specific pages contained in the storage block; buf_id is used to identify the location of the storage block in shared memory; state is used to save the status of the storage block; wait_pid and content_lock control access to the storage block in a concurrent environment to ensure data consistency and integrity; nextFree is used to concatenate multiple BufferDesc into a linked list to maintain free storage blocks.

[0085] In some other embodiments, the shared memory data calling method further includes:

[0086] S210: traverse the hash table to determine whether the cache identifier exists in the hash table;

[0087] S300 ′: In response to the cache identifier being present in the hash table, responding to the data access request with the storage block corresponding to the cache identifier.

[0088] Through the above steps, the data access request can be responded to with the data originally existing in the shared memory, so as to improve the speed of data processing.

[0089] Specifically, in step S400 , in response to the absence of a free storage block in the shared memory, determining a replacement storage block based on a storage block stored in the last called data includes:

[0090] S410: Sequentially number any storage block in the shared memory;

[0091] S420: Setting an access flag bit for any storage block, wherein the access flag bit includes a first flag and a second flag, the first flag indicating that the corresponding storage block is in an access active state, and the second flag indicating that the corresponding storage block is in an access inactive state;

[0092] S430: sequentially numbered storage blocks in the shared memory are set as a circular queue according to the order of the numbers, for polling and identifying access flag bits of the storage blocks;

[0093] S440: Starting from the last memory block marked as the first tag in the shared memory, poll and compare the memory blocks in the circular queue according to the cache identifier until a memory block whose first access flag bit is marked as the second tag is found;

[0094] S450: Using the first discovered storage block marked with the second mark as a replacement storage block;

[0095] S460: Clearing the data stored in the replacement storage block;

[0096] The step of polling and comparing the storage blocks in the circular queue according to the cache identifier includes:

[0097] S441: In response to the access flag bit of the storage block being marked as the first flag, comparing the cache identifier of the accessed data corresponding to the data access request with the cache identifier of the storage block;

[0098] S442: In response to the cache identifier of the accessed data corresponding to the data access request being different from the cache identifier of the storage block, changing the access flag bit of the storage block to a second flag.

[0099] Through the above steps, a replacement storage block is obtained from the storage block in which data has been written to store new data.

[0100] The data access request includes at least a read request. Specifically, the accessed data is written into the replacement storage block, and responding to the data access request includes:

[0101] S510: In response to the data access request being a read request, obtaining data from a physical storage address of the data corresponding to the read request;

[0102] S520: writing the acquired data into the replacement storage block to replace the data originally stored in the replacement storage block;

[0103] S530: Determine a cache identifier corresponding to the data based on the acquired data;

[0104] S540: Add the cache identifier to the hash table.

[0105] Preferably, data is written from the physical storage address to the replacement storage area via a RelationFileNode. The tablespace where the data block resides is identified via a tbsNode. The database to which the data block belongs is identified via a databaseNode. The specific table or index is identified via a relationNode. The data is located at the physical storage address and written to the replacement storage area.

[0106] Schematically, using:

[0107] typedefstruct RelationFileNode

[0108] {

[0109] objectId tbsNode;

[0110] objectId databaseNode;

[0111] objectId relationNode;

[0112] }RelationFileNode; associates the replacement storage area and the physical storage address of the data.

[0113] At this point, for the read process, the data stored in the physical address is called to the shared content, so that when the running process needs to access the same data, it can be accessed directly from the shared memory to improve the data access speed.

[0114] The data access request also includes a write request, specifically, writing the accessed data into the replacement storage block, and responding to the data access request also includes:

[0115] S510′: In response to the data access request being a write request, writing the requested data into the replacement storage block to replace the data originally stored in the replacement storage block;

[0116] S520′: Determine, according to the data requested to be written, a cache identifier corresponding to the data requested to be written;

[0117] S530′: Add the cache identifier to the hash table;

[0118] S540′: Write the data requested to be written into the corresponding physical storage address from the replacement storage block.

[0119] At this point, for the write process, after writing data to shared memory, the corresponding process can perform other tasks. The data written to shared memory can be written asynchronously to the physical storage address to improve the efficiency of executing tasks.

[0120] In some other embodiments, the shared memory data calling method further includes:

[0121] S610: In response to the data stored in any storage block no longer being used by any process, the data is written back to the disk according to the physical storage address mapping of the data;

[0122] S620: Set the storage block as a free storage block.

[0123] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0124] In other embodiments, Figure 2 As shown, a shared memory data calling device includes:

[0125] an identifier determination module, configured to obtain a data access request and determine a cache identifier of the accessed data according to the data access request;

[0126] A data verification module, used to determine whether the accessed data exists in the shared memory based on the cache identifier;

[0127] a block search module, configured to search for a free storage block in the shared memory by storing the blockchain table in response to the accessed data not being present in the shared memory;

[0128] a block replacement module, configured to determine a replacement storage block based on a storage block stored in the last called data in response to the absence of a free storage block in the shared memory;

[0129] The data writing module is used to write the accessed data into the replacement storage block from the physical storage address and respond to the data access request with the accessed data.

[0130] For the specific limitations of the shared memory data calling device described above, please refer to the limitations of the shared memory data calling method described above, and will not be repeated here. Each module in the above-mentioned shared memory data calling device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0131] In other embodiments, Figure 3 As shown, a shared memory data calling device includes a memory, a processor and a shared memory data calling program stored in the memory and runnable on the processor. When the processor executes the shared memory data calling program, the shared memory data calling method described above is implemented.

[0132] In other embodiments, a computer-readable storage medium stores a shared memory data calling program, and when the shared memory data calling program is executed by a processor, the shared memory data calling method described above is implemented.

[0133] In other embodiments, a computer program product includes a computer program, which implements the shared memory data calling method described above when executed by a processor.

[0134] The beneficial effect of the technical solution provided by the embodiments of the present application is: by implementing the shared memory data calling method, device, equipment and readable storage medium disclosed in the embodiments of the present application, it is possible to timely screen and obtain storage blocks for replacement in the shared memory, thereby improving the data processing performance of the shared memory.

[0135] All of the above optional technical solutions can be combined in any way to form optional embodiments of the present application, and will not be described in detail here.

[0136] Example 1

[0137] Shared memory data calling method, such as Figure 1 As shown, including:

[0138] Obtaining a data access request, and determining a cache identifier of the accessed data according to the data access request;

[0139] Determine whether the accessed data exists in the shared memory according to the cache identifier;

[0140] In response to the accessed data not being present in the shared memory, searching for a free storage block in the shared memory by storing the blockchain table;

[0141] In response to the absence of a free storage block in the shared memory, determining a replacement storage block based on a storage block stored in the last called data;

[0142] Writes the accessed data into the replacement storage block and responds to data access requests.

[0143] Example 2

[0144] Based on the first embodiment, before obtaining a data access request and determining a cache identifier of the accessed data according to the data access request, the method further includes:

[0145] Apply for several storage blocks from the memory as shared memory;

[0146] Creating a storage blockchain table associated with the requested storage blocks, wherein the storage blockchain table is used to store at least the numbers of the storage blocks and a mapping of physical storage addresses of data stored in the storage blocks corresponding to the numbers;

[0147] A hash table is created, wherein the hash table includes at least a cache identifier associated with the data stored in the storage block.

[0148] The shared memory data calling method also includes:

[0149] Traverse the hash table to determine whether the cache identifier exists in the hash table;

[0150] In response to the cache identifier being present in the hash table, the data access request is responded to with the storage block corresponding to the cache identifier.

[0151] Specifically, in response to the absence of a free storage block in the shared memory, determining a replacement storage block according to a storage block stored in the last called data includes:

[0152] Sequentially number any storage block in the shared memory;

[0153] Setting an access flag bit for any storage block, wherein the access flag bit includes a first flag and a second flag, the first flag indicating that the corresponding storage block is in an access active state, and the second flag indicating that the corresponding storage block is in an access inactive state;

[0154] The sequentially numbered storage blocks in the shared memory are set as a circular queue according to the order of the numbers, and are used to poll and identify the access flag bits of the storage blocks;

[0155] Starting from the last memory block marked as the first tag in the shared memory, the memory blocks in the circular queue are polled and compared according to the cache identifier until a memory block whose first access tag bit is marked as the second tag is found;

[0156] Using the first memory block found to be marked with the second mark as the replacement memory block;

[0157] Clear the data stored in the replacement storage block;

[0158] The step of polling and comparing the storage blocks in the circular queue according to the cache identifier includes:

[0159] In response to the access flag bit of the storage block being marked as a first flag, comparing the cache identifier of the accessed data corresponding to the data access request with the cache identifier of the storage block;

[0160] In response to the cache identifier of the accessed data corresponding to the data access request being different from the cache identifier of the storage block, the access flag bit of the storage block is changed to a second flag.

[0161] Specifically, the data access request includes at least a read request, writing the accessed data into the replacement storage block, and responding to the data access request includes:

[0162] In response to the data access request being a read request, obtaining data from a physical storage address of the data corresponding to the read request;

[0163] Writing the acquired data into the replacement storage block to replace the data originally stored in the replacement storage block;

[0164] Determine, based on the acquired data, a cache identifier corresponding to the data;

[0165] Adds the cache identifier to the hash table.

[0166] Specifically, the data access request also includes a write request to write the accessed data into the replacement storage block, and responding to the data access request also includes:

[0167] In response to the data access request being a write request, writing the data requested to be written into the replacement storage block to replace the data originally stored in the replacement storage block;

[0168] Determine, based on the data requested to be written, a cache identifier corresponding to the data requested to be written;

[0169] Add the cache identifier to the hash table;

[0170] The data requested to be written is written from the replacement storage block to the corresponding physical storage address.

[0171] Specifically, the shared memory data calling method also includes:

[0172] In response to the data stored in any storage block no longer being used by any process, the data will be written back to the disk according to the physical storage address mapping of the data;

[0173] Set the memory block as a free memory block.

[0174] Example 3

[0175] Shared memory data calling device, such as Figure 2 Shown, including:

[0176] an identifier determination module, configured to obtain a data access request and determine a cache identifier of the accessed data according to the data access request;

[0177] A data verification module, used to determine whether the accessed data exists in the shared memory based on the cache identifier;

[0178] a block search module, configured to search for a free storage block in the shared memory by storing the blockchain table in response to the accessed data not being present in the shared memory;

[0179] a block replacement module, configured to determine a replacement storage block based on a storage block stored in the last called data in response to the absence of a free storage block in the shared memory;

[0180] The data writing module is used to write the accessed data into the replacement storage block from the physical storage address and respond to the data access request with the accessed data.

[0181] Example 4

[0182] Shared memory data call device, such as Figure 3 As shown, the invention includes a memory, a processor, and a shared memory data calling program stored in the memory and executable on the processor. When the processor executes the shared memory data calling program, the shared memory data calling method described in Example 1 or Example 2 is implemented. The contents described in Example 1 and Example 2 are not repeated here.

[0183] Example 5

[0184] A computer-readable storage medium stores a shared memory data calling program, which, when executed by a processor, implements the shared memory data calling method described in Example 1 or Example 2. The contents described in Example 1 and Example 2 are not repeated here.

[0185] Example 6

[0186] A computer program product includes a computer program, wherein when the computer program is executed by a processor, the shared memory data calling method described in Embodiment 1 or Embodiment 2 is implemented. The contents described in Embodiment 1 and Embodiment 2 are not repeated here.

[0187] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program loaded on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via a communication device, or installed from a memory, or installed from a ROM. When the computer program is executed by an external processor, the above-mentioned functions defined in the method of the embodiment of the present application are executed.

[0188] It should be noted that the computer-readable medium of the embodiments of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the embodiments of the present application, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, device or device. In the embodiments of the present application, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or convey a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0189] The computer-readable medium may be included in the server or may exist independently and not incorporated into the server. The computer-readable medium carries one or more programs that, when executed by the server, cause the server to: in response to detecting that the terminal's peripheral mode is inactive, obtain the frame rate of applications on the terminal; when the frame rate meets a screen-off condition, determine whether the user is currently accessing the terminal's screen information; and, in response to determining that the user is not accessing the terminal's screen information, control the screen to enter an immediate dimming mode.

[0190] Computer program code for performing the operations of embodiments of the present application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0191] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without expending creative work.

[0192] The above is a detailed introduction to the technical solutions provided by this application. Specific examples are used herein to illustrate the principles and implementation methods of this application. The description of the above embodiments is only intended to help understand the method and core concept of this application. At the same time, for those skilled in the art, based on the concept of this application, there may be changes in the specific implementation methods and application scope. In summary, the contents of this specification should not be understood as limiting this application.

[0193] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.

Claims

1. A shared memory data calling method, characterized in that: include: Obtaining a data access request, and determining a cache identifier of accessed data according to the data access request; determining, according to the cache identifier, whether the accessed data exists in the shared memory; In response to the accessed data not existing in the shared memory, searching for a free storage block in the shared memory by storing the blockchain table; In response to the absence of a free storage block in the shared memory, determining a replacement storage block based on a storage block stored in the last called data; The accessed data is written into the replacement storage block, and the data access request is responded to.

2. The shared memory data calling method according to claim 1, wherein: Before obtaining the data access request and determining the cache identifier of the accessed data according to the data access request, the method further includes: Applying a number of storage blocks from the memory as the shared memory; Creating a storage blockchain table associated with the requested storage blocks, wherein the storage blockchain table is used to store at least the numbers of the storage blocks and a mapping of physical storage addresses of data stored in the storage blocks corresponding to the numbers; A hash table is created, wherein the hash table includes at least a cache identifier associated with the data stored in the storage block.

3. The shared memory data calling method according to claim 1, wherein: The shared memory data calling method further includes: Traversing the hash table to determine whether the cache identifier exists in the hash table; In response to the cache identifier being present in the hash table, the data access request is responded to with the storage block corresponding to the cache identifier.

4. The shared memory data calling method according to claim 1, wherein: In response to the absence of a free storage block in the shared memory, determining a replacement storage block according to a storage block stored in the last called data includes: Sequentially number any storage block in the shared memory; Setting an access flag bit for any storage block, wherein the access flag bit includes a first flag and a second flag, the first flag indicating that the corresponding storage block is in an access active state, and the second flag indicating that the corresponding storage block is in an access inactive state; The sequentially numbered storage blocks in the shared memory are set as a circular queue according to the order of the numbers, so as to poll and identify the access flag bits of the storage blocks; Starting from the last storage block marked as the first mark in the shared memory, polling and comparing the storage blocks in the circular queue according to the cache identifier until the first storage block whose access flag bit is marked as the second mark is found; Using the first storage block marked with the second mark that is found as the replacement storage block; clearing the data stored in the replacement storage block; The step of polling and comparing the storage blocks in the circular queue according to the cache identifier includes: In response to the access flag bit of the storage block being marked as a first flag, comparing the cache identifier of the accessed data corresponding to the data access request with the cache identifier of the storage block; In response to the cache identifier of the accessed data corresponding to the data access request being different from the cache identifier of the storage block, the access flag bit of the storage block is changed to a second flag.

5. The shared memory data calling method according to claim 1, wherein: The data access request includes at least a read request, and the step of writing the accessed data into the replacement storage block and responding to the data access request includes: In response to the data access request being a read request, acquiring data from a physical storage address of the data corresponding to the read request; Writing the acquired data into the replacement storage block to replace the data originally stored in the replacement storage block; Determine, based on the acquired data, a cache identifier corresponding to the data; The cache identifier is added to a hash table.

6. The shared memory data calling method according to claim 1, wherein: The data access request further includes a write request, and the step of writing the accessed data into the replacement storage block and responding to the data access request further includes: In response to the data access request being a write request, writing the data requested to be written into the replacement storage block to replace the data originally stored in the replacement storage block; Determining, according to the data requested to be written, a cache identifier corresponding to the data requested to be written; Adding the cache identifier to a hash table; The data requested to be written is written from the replacement storage block to the corresponding physical storage address.

7. The shared memory data calling method according to claim 1, wherein: The shared memory data calling method further includes: In response to the data stored in any storage block no longer being used by any process, the data will be written back to the disk according to the physical storage address mapping of the data; Set the memory block as a free memory block.

8. A shared memory data calling device, characterized in that: include: an identifier determination module, configured to obtain a data access request and determine a cache identifier of accessed data according to the data access request; a data verification module, configured to determine whether the accessed data exists in the shared memory according to the cache identifier; a block search module, configured to search for a free storage block in the shared memory by storing a blockchain table in response to the accessed data not being present in the shared memory; a block replacement module, configured to determine a replacement storage block based on a storage block stored in the last called data in response to the absence of a free storage block in the shared memory; The data writing module is used to write the accessed data into the replacement storage block from the physical storage address, and respond to the data access request with the accessed data.

9. A shared memory data calling device, characterized in that: The invention comprises a memory, a processor and a shared memory data calling program stored in the memory and executable on the processor. When the processor executes the shared memory data calling program, the shared memory data calling method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that A shared memory data calling program is stored thereon, and when the shared memory data calling program is executed by a processor, the shared memory data calling method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Cache replacement method and device

    CN108021514A

  • File pre-read cache allocation method and device based on access popularity

    CN115203072A