Shared memory data calling method, device and equipment and readable storage medium
By finding and determining the replacement storage blocks in shared memory, the problem of insufficient memory during shared memory replacement is solved, data processing performance is improved, and virtual machines are shut down due to insufficient memory.
Patent Information
- Application Number
- CN202411211738.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2044-08-30
AI Technical Summary
During shared memory replacement, the existing technology relies on the virtual machine operating system and memory full-load state, resulting in the virtual machine being shut down when there is insufficient memory, which is unable to effectively improve the utilization of physical memory.
By finding free storage blocks in shared memory or determining the permutation storage block based on the storage block of the last called data, the writing and permutation of data can be realized, and the data processing performance is improved.
It realizes timely filtering and replacing storage blocks in shared memory, improving data processing performance, and avoiding the virtual machine shutdown due to insufficient memory.
Smart Images

Figure CN119200968A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a shared memory data calling method, device, equipment and a readable storage medium. Background Art
[0002] In the era of big data, databases are widely used. Disks or disk arrays are used as storage media to store data. Accordingly, data has a physical storage address in the disk. When the central processor needs to access data, the speed of reading and writing disks is slow, while the speed of accessing memory by the central processor is extremely fast. Writing commonly used data from the physical storage address to the shared memory can greatly improve the processing speed of the central processor for data. Since the space of shared memory is limited, the original data needs to be replaced when the shared memory is full. At present, common means include memory bubbles. Although the memory bubble technology can release memory to virtual machines with higher usage by squeezing the memory of other virtual machines, thereby improving the utilization of physical memory. However, the implementation of this technology depends on the premise that the memory in the virtual machine operating system cannot always be fully loaded. If the over-resolution is too large, that is, the total memory allocated to the virtual machine is greater than the total amount of physical memory actually available, when all clients are at a high memory usage rate, the virtual machine 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 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 according to a storage block stored in the last called data;
[0009] Write the accessed data into the replacement storage block and respond to the data access request.
[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 applied storage blocks, wherein the storage blockchain table is used to store at least the serial numbers of the storage blocks and a physical storage address mapping of the data stored in the storage blocks corresponding to the serial 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] Further, 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:
[0018] Sequentially number any storage block in the shared memory;
[0019] Setting an access mark bit for any storage block, wherein the access mark bit includes a first mark and a second mark, the first mark indicates that the corresponding storage block is in an access active state, and the second mark indicates 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, so as to poll and identify the access mark bits of the storage blocks;
[0021] Starting from the last storage block marked as the first mark in the shared memory, the storage blocks in the circular queue are polled and compared according to the cache identifier until a storage block whose first access mark bit is marked as the second mark is found;
[0022] Using the first storage block marked with the second mark that is found as the replacement storage block;
[0023] Clear the data stored in the replacement storage block;
[0024] The step of polling and comparing storage blocks in a circular queue according to a 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 mark bit of the storage block is changed to a second mark.
[0027] Further, 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:
[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] Add 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, according to 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 into the corresponding physical storage address.
[0037] Furthermore, the shared memory data calling method also 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, used 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 for determining whether the accessed data exists in the shared memory according to the cache identifier;
[0043] 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;
[0044] A block replacement module, for determining a replacement storage block according to 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 from the physical storage address into the replacement storage block, and respond to the data access request with the accessed data.
[0046] In a 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 executable 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 recorded in the first aspect.
[0049] The beneficial effect of the technical solution provided by the embodiment of the present application is: by implementing the shared memory data calling method, device, equipment and readable storage medium disclosed in the embodiment of the present application, it is possible to timely screen the storage blocks used 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 drawings required for use in the description of the embodiments will be briefly introduced below. 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 creative work.
[0051] Figure 1 It is a schematic diagram of a shared memory data calling method provided in an embodiment of the present application;
[0052] Figure 2 It is a schematic diagram of a shared memory data calling device provided in an embodiment of the present application;
[0053] Figure 3It is a schematic diagram of a shared memory data calling device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in the implementation mode of this application will be clearly and completely described below in conjunction with the drawings in the implementation mode of this application. Obviously, the described implementation mode is only a part of the embodiments of this application, not all embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0055] Unless otherwise defined, the technical terms or scientific terms used in the present disclosure shall have the usual meanings understood by persons with ordinary skills in the field to which the present disclosure belongs. The words "first", "second" and similar words used in the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. Similarly, words such as "one", "one" or "the" do not indicate a quantity limitation, but indicate that there is at least one. The numbers in the drawings of the specification only indicate the distinction between various functional components or modules, and do not indicate the logical relationship between components or modules. Words such as "include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Words such as "connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used 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 according to the present disclosure will be described in detail with reference to the accompanying drawings. It should be noted 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] In view of the defects existing in shared memory replacement, this application provides the following technical solutions:
[0058] In some embodiments, Figure 1 As shown, a shared memory data calling method includes:
[0059] S100: Obtain a data access request, and determine a cache identifier of 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 according to a storage block stored in the last called data;
[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 a cache identifier of accessed data according to the data access request, the process further includes:
[0068] S010: Apply for several storage blocks from the memory as shared memory;
[0069] S020: creating a storage blockchain table associated with the applied storage blocks, wherein the storage blockchain table is used to store at least the serial numbers of the storage blocks and the physical storage address mapping of the data stored in the storage blocks corresponding to the serial 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 the shared memory; state is used to save the state 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 existing 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, S400: 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, including:
[0090] S410: Sequentially number any storage block in the shared memory;
[0091] S420: setting an access mark bit for any storage block, wherein the access mark bit includes a first mark and a second mark, the first mark indicates that the corresponding storage block is in an access active state, and the second mark indicates that the corresponding storage block is in an access inactive state;
[0092] S430: setting the sequentially numbered storage blocks in the shared memory into a circular queue according to the order of the numbers, so as to poll and identify the access flag bits of the storage blocks;
[0093] S440: 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 a storage block whose first access mark bit is marked as the second mark is found;
[0094] S450: using the first storage block marked with the second mark that is found as a replacement storage block;
[0095] S460: Clearing the data stored in the replacement storage block;
[0096] The step of polling and comparing storage blocks in a circular queue according to a 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 into which data has been written to store new data.
[0100] The data access request at least includes a read request, specifically, writing the accessed data into a 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 according to the acquired data;
[0104] S540: Add the cache identifier to the hash table.
[0105] Preferably, the data is written from the physical storage address to the replacement storage area through RelationFileNode. The table space where the data block is located is identified through tbsNode. The database to which the data block belongs is identified through databaseNode. The specific table or index is identified through relationNode. The data is located at the physical storage address and written to the replacement storage area.
[0106] Indicatively, 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 has been 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 data requested to be written 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 the data to the shared memory, the corresponding process can perform other tasks. The data written to the shared memory can be asynchronously written to the physical storage address to improve the efficiency of executing the task.
[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. Moreover, 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, used 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 for determining whether the accessed data exists in the shared memory according to the cache identifier;
[0127] 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;
[0128] A block replacement module, for determining a replacement storage block according to 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 from the physical storage address into the replacement storage block, 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, which 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 and a combination thereof. 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 in the computer device in the form of software, so that the processor can call and execute the operations corresponding to 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 executable 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 embodiment of the present application is: by implementing the shared memory data calling method, device, equipment and readable storage medium disclosed in the embodiment of the present application, it is possible to timely screen the storage blocks used for replacement in the shared memory, thereby improving the data processing performance of the shared memory.
[0135] All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present application, which will not be described one by one here.
[0136] Embodiment 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 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 according to a storage block stored in the last called data;
[0142] Write the accessed data into the replacement storage block and respond to the data access request.
[0143] Embodiment 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 applied storage blocks, wherein the storage blockchain table is used to store at least the serial numbers of the storage blocks and a physical storage address mapping of the data stored in the storage blocks corresponding to the serial 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 mark bit for any storage block, wherein the access mark bit includes a first mark and a second mark, the first mark indicates that the corresponding storage block is in an access active state, and the second mark indicates 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, so as to poll and identify the access mark bits of the storage blocks;
[0155] Starting from the last storage block marked as the first mark in the shared memory, the storage blocks in the circular queue are polled and compared according to the cache identifier until a storage block whose first access mark bit is marked as the second mark is found;
[0156] Using the first storage block marked with the second mark that is found as the replacement storage block;
[0157] Clear the data stored in the replacement storage block;
[0158] The step of polling and comparing storage blocks in a circular queue according to a 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 mark bit of the storage block is changed to a second mark.
[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] Add 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 the response 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, according to 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 into 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] Embodiment 3
[0175] Shared memory data call device, such as Figure 2 As shown, including:
[0176] An identifier determination module, used 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 for determining whether the accessed data exists in the shared memory according to the cache identifier;
[0178] 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;
[0179] A block replacement module, for determining a replacement storage block according to 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 from the physical storage address into the replacement storage block, and respond to the data access request with the accessed data.
[0181] Embodiment 4
[0182] Shared memory data call device, such as Figure 3 As shown, it 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 Embodiment 1 or Embodiment 2 is implemented. The contents described in Embodiment 1 and Embodiment 2 are not repeated here.
[0183] Embodiment 5
[0184] 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 in Embodiment 1 or Embodiment 2 is implemented. The contents described in Embodiment 1 and Embodiment 2 are not repeated here.
[0185] Embodiment 6
[0186] A computer program product includes a computer program, and 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 embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above 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 device, 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 an embodiment of the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In an embodiment of the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. 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. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit 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 of the above.
[0189] The computer-readable medium may be included in the server; or it may exist independently without being installed in the server. The computer-readable medium carries one or more programs. When the one or more programs are executed by the server, the server: in response to detecting that the peripheral mode of the terminal is not activated, obtains the frame rate of the application on the terminal; when the frame rate meets the screen-off condition, determines whether the user is obtaining the screen information of the terminal; in response to the judgment result that the user is not obtaining the screen information of the terminal, controls the screen to enter the immediate dimming mode.
[0190] Computer program code for performing the operation of the 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" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of 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., using an Internet service provider to connect through the Internet).
[0191] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can 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 may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.
[0192] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present 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 substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope 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 a blockchain table; 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; 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, characterized in that: The obtaining of the data access request and determining the cache identifier of the accessed data according to the data access request further includes: Applying a number of storage blocks from the memory as the shared memory; Creating a storage blockchain table associated with the applied storage blocks, wherein the storage blockchain table is used to store at least the serial numbers of the storage blocks and a physical storage address mapping of the data stored in the storage blocks corresponding to the serial 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, characterized in that: 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 a storage block corresponding to the cache identifier.
4. The shared memory data calling method according to claim 1, characterized in that: 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 mark bit for any storage block, wherein the access mark bit includes a first mark and a second mark, the first mark indicates that the corresponding storage block is in an access active state, and the second mark indicates 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 mark 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 mark 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, characterized in that: The data access request at least includes 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, characterized in that: The data access request also includes a write request, and the step of writing the accessed data into the replacement storage block and responding to the data access request also 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; Determine, 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 into the corresponding physical storage address.
7. The shared memory data calling method according to claim 1, characterized in that: The shared memory data calling method also 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, used to obtain a data access request and determine a cache identifier of accessed data according to the data access request; A data verification module, used 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, for determining a replacement storage block according to 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
Method and device for modifying data in memory
CN101650692A
Cache replacement method and device
CN108021514A
File pre-read cache allocation method and device based on access popularity
CN115203072A
Cited By
Method, device and equipment for safely starting updating of digital certificate
CN119740239A