Multi-system storage space management method and device, electronic equipment and storage medium

By dynamically allocating physical pages in a multi-system environment, the problem of unbalanced storage space allocation in the prior art is solved, and efficient use of Flash memory and flexible adjustment of storage space are achieved.

CN120045137APending Publication Date: 2025-05-27BEIJING TSINGTENG MICROSYSTEM CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510202324.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-24
Publication Date
2025-05-27

AI Technical Summary

Technical Problem

The existing Flash data management methods of eSE and eSIM lack flexibility, resulting in unbalanced storage space allocation and being unable to adapt to complex application scenarios.

Method used

By realizing dynamic physical page allocation in a multi-system environment, using the physical page sharing area to obtain free physical pages, and establishing associations in the mapping table of virtual pages to physical pages, realizing flexible allocation of physical pages on demand.

Benefits of technology

It improves the efficiency of Flash memory usage, realizes isolation and dynamic adjustment of storage space, and adapts to complex application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120045137A_ABST
    Figure CN120045137A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to a multi-system storage space management method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a virtual page number of a target virtual page where a target virtual address is located in response to a received request of writing data to the target virtual address from a target system; querying a target mapping table corresponding to the target system, and judging whether a physical page number associated with the virtual page number exists or not; if the virtual page number does not exist in the target mapping table, an idle physical page is obtained from a physical page sharing area to serve as a target physical page, the target physical page number of the target physical page and the virtual page number are associated and written into the target mapping table, and the physical pages in the physical page sharing area are shared by a plurality of systems; and writing the to-be-written data of the target system into the target physical page, wherein the information area of the target physical page records the context information of the target system. By the adoption of the technical scheme, the physical pages can be flexibly distributed according to needs, and the use efficiency of Flash is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of Flash memory, and in particular, to a method, device, electronic device, and storage medium for managing storage space of multiple systems. Background Art

[0002] Currently, Flash memory is widely used in microcontroller units (MCUs) due to its non-volatile, high storage density, low power consumption, etc., and is commonly used to store programs and application data. An MCU with a large-capacity Flash can provide powerful data storage capabilities for embedded devices, making it possible to implement an embedded functional chip that combines multiple applications. For example, a secure element (SE) system and a universal integrated circuit card (UICC) system can be run simultaneously on one MCU to form a composite device that combines the functions of an embedded secure element (eSE) and an embedded subscriber identity module (eSIM).

[0003] When multiple systems use the same Flash memory, storage space isolation must be performed to prevent information leakage and data overwrite problems. However, the existing Flash data management methods for eSE and eSIM mostly adopt a fixed space division scheme, that is, the address segment and size of the Flash space used by each system are determined during code writing. The result of this processing method is that the size of the user space and the transaction capabilities corresponding to each system cannot be dynamically adjusted according to the actual operating conditions. Therefore, although the existing solutions can meet the isolation requirements of the Flash storage space of multiple systems, they lack flexibility and are prone to the problem of uneven storage space allocation, thus being unable to adapt to complex application scenarios. Summary of the Invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a method, device, electronic device, and storage medium for managing storage space of multiple systems.

[0005] In a first aspect, an embodiment of the present disclosure provides a method for managing storage space of multiple systems, including:

[0006] Upon receiving a request from a target system to write data to a target virtual address, obtaining the virtual page number of the target virtual page where the target virtual address is located;

[0007] Query the target mapping table corresponding to the target system to determine whether there is a physical page number associated with the virtual page number;

[0008] If not, obtain an idle physical page from the physical page sharing area as the target physical page, and write the target physical page number of the target physical page and the virtual page number into the target mapping table in association, where the physical pages in the physical page sharing area are shared by multiple systems;

[0009] Write the data to be written of the target system into the target physical page, and the information area of the target physical page records the context information of the target system.

[0010] In a second aspect, an embodiment of the present disclosure provides a storage space management device for multiple systems, including:

[0011] A first acquisition module, configured to, in response to receiving a request from a target system to write data to a target virtual address, acquire the virtual page number of the target virtual page where the target virtual address is located;

[0012] A judgment module, configured to query the target mapping table corresponding to the target system to determine whether there is a physical page number associated with the virtual page number;

[0013] A second acquisition module, configured to, if not, obtain an idle physical page from the physical page sharing area as the target physical page, and write the target physical page number of the target physical page and the virtual page number into the target mapping table in association, where the physical pages in the physical page sharing area are shared by multiple systems;

[0014] A data writing module, configured to write the data to be written of the target system into the target physical page, and the information area of the target physical page records the context information of the target system.

[0015] In a third aspect, an embodiment of the present disclosure provides an electronic device, where the electronic device includes: a processor; a memory for storing executable instructions of the processor; the processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the storage space management method for multiple systems as described in the first aspect.

[0016] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, where the storage medium stores a computer program, and the computer program is used to implement the storage space management method for multiple systems as described in the first aspect.

[0017] The technical solutions provided by the embodiments of the present disclosure have the following advantages compared with the prior art:

[0018] The storage space management solution for multiple systems provided by the embodiments of the present disclosure, in response to receiving a request from a target system to write data to a target virtual address, obtains the virtual page number of the target virtual page where the target virtual address is located; queries the target mapping table corresponding to the target system to determine whether there is a physical page number associated with the virtual page number. If not, obtains an idle physical page from the physical page sharing area as the target physical page, and writes the target physical page number of the target physical page and the virtual page number into the target mapping table in an associated manner, where the physical pages in the physical page sharing area are shared by multiple systems; writes the data to be written by the target system into the target physical page, and the information area of the target physical page records the context information of the target system. By adopting the solution of the present disclosure, when writing data is required, an idle physical page is obtained from the physical page sharing area as the target physical page, and the data to be written is written into the target physical page, so as to realize dynamic physical page allocation when the upper-layer system writes data to an idle virtual address, and dynamically establish a mapping from the virtual page to the physical page during operation, thereby realizing flexible on-demand allocation of physical pages and improving the utilization efficiency of Flash; and, by recording the context information of the belonging system in the information area of the physical page to distinguish the systems to which each physical page belongs, each system can only access the physical pages belonging to its own context, realizing isolation of the storage space. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In combination with the accompanying drawings and with reference to the following specific embodiments, the above and other features, advantages and aspects of the embodiments of the present disclosure will become more obvious. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic and the original elements and elements are not necessarily drawn to scale.

[0020] Figure 1 It is a schematic flowchart of a method for managing the storage space of multiple systems provided by an exemplary embodiment of the present disclosure;

[0021] Figure 2 It shows a schematic diagram of the allocation and mapping relationship of the storage space under multiple systems in an exemplary embodiment of the present disclosure;

[0022] Figure 3 It shows a schematic diagram of the mapping relationship between VID and PID in an exemplary embodiment of the present disclosure;

[0023] Figure 4 It shows a schematic diagram of the physical page sharing area in an exemplary embodiment of the present disclosure;

[0024] Figure 5 It shows a schematic diagram of determining an idle physical page in an exemplary embodiment of the present disclosure;

[0025] Figure 6 It shows a schematic diagram of transaction backup in an exemplary embodiment of the present disclosure;

[0026] Figure 7 The structural schematic diagram of a storage space management device for multiple systems provided by an embodiment of the present disclosure. Detailed implementation manners

[0027] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.

[0028] It should be understood that the steps recited in the method embodiments of the present disclosure can be executed in different orders and / or executed in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this regard.

[0029] The term "including" and its variations used herein are open-ended, that is, "including but not limited to". The term "based on" is "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0030] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependent relationships.

[0031] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly stated in the context, it should be understood as "one or more".

[0032] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only for illustrative purposes and are not used to limit the scope of these messages or information.

[0033] Aiming at the problems of unbalanced storage space allocation and poor flexibility existing in the prior art, the present disclosure provides a storage space management solution for multiple systems, which can be applied to the scenario of eSE and eSIM composite devices. On the premise of meeting the requirements of data isolation for different systems, this solution realizes the functions of dynamically allocating storage space on demand and dynamically expanding transaction capabilities.

[0034] The following will explain in detail the storage space management method, device, electronic device, and storage medium of multiple systems provided by the present disclosure in conjunction with the accompanying drawings.

[0035] Figure 1 It is a flowchart of the storage space management method for multiple systems provided by an exemplary embodiment of the present disclosure. This method can be executed by the storage space management device for multiple systems provided by the embodiments of the present disclosure. The device can be implemented in software and / or hardware and can be integrated into an electronic device.

[0036] Figure 2 It shows a schematic diagram of the allocation and mapping relationship of the storage space under multiple systems in an exemplary embodiment of the present disclosure. Figure 2 Taking the example where multiple systems include two systems, eSE and eSIM. As Figure 2 shown, eSE and eSIM respectively correspond to a virtual space. Each virtual space is divided into a transaction area, a rotation area, and a user area. The physical space actually used for storing data is divided into an eSIM log area, an eSE log area, and a physical page sharing area. The physical pages in the physical page sharing area are shared by the eSE and eSIM systems, and the two dynamically obtain physical pages from the physical page sharing area according to requirements for storing their own data. The upper-layer systems (i.e., the eSE and eSIM systems) access the Flash through virtual addresses instead of directly operating on physical addresses. The minimum erasure unit of the Flash memory is a physical page (Page), and its size is fixed. All physical pages in the physical address space are numbered, and each physical page corresponds to a physical page ID (PID). Similarly, all virtual pages in the virtual address space are numbered, and each virtual page corresponds to a virtual page ID (VID). The size of the virtual page is the same as that of the physical page.

[0037] As Figure 2 shown, eSE and eSIM respectively correspond to a mapping table. Through the mapping table, the association between virtual pages and physical pages is realized, and thus the conversion from virtual addresses to physical addresses is realized. The mapping table is essentially an array. The index of the array is represented by VID, and the element value at the index is used to store the PID associated with each VID. If a virtual page has not been used, the PID corresponding to its VID in the mapping table is an invalid value or is empty. Exemplarily, Figure 3 It shows a schematic diagram of the mapping relationship between VID and PID in an exemplary embodiment of the present disclosure. As Figure 3 shown, the virtual address space is divided into multiple virtual pages from low address to high address, and the corresponding virtual page numbers are VID0, VID1, and VID2. VID0 is associated with PID2, VID1 is associated with PID0, and VID2 is associated with PID1. Then, according to this mapping relationship, Figure 3The mapping table shown in

[0038] As Figure 1 shown, the storage space management method of the multi-system may include the following steps:

[0039] Step 101, in response to receiving a request from a target system to write data to a target virtual address, obtain the virtual page number of the target virtual page where the target virtual address is located.

[0040] Among them, the target system may be any system in the multi-system and is the currently started and running system in the multi-system. The target virtual address is a virtual address in the virtual address space corresponding to the target system and is the virtual address to which the target system requests to write data.

[0041] In this embodiment, when receiving a request from a target system to write data to a target virtual address, the electronic device obtains the virtual page number of the target virtual page where the target virtual address is located. It can be understood that the size of each virtual page is the same as that of the physical page, and the size of the physical page is fixed. Therefore, the size of the virtual page is also fixed. The virtual start address and virtual end address corresponding to each virtual page are known. Therefore, according to the target virtual address, the virtual page where the target virtual address is located (referred to as the target virtual page for easy description and distinction) can be determined, and thus the virtual page number of the target virtual page can be determined because the virtual page number corresponding to each virtual page is known and unique.

[0042] Step 102, query the target mapping table corresponding to the target system, and determine whether there is a physical page number associated with the virtual page number.

[0043] Among them, the target mapping table is the mapping table corresponding to the target system, and the mapping relationship between the virtual pages and physical pages of the target system is recorded in the target mapping table. In this embodiment, each system in the multi-system has its own independent mapping table. The multiple mapping tables implement the conversion behavior of independent virtual addresses to physical addresses in the multi-system. When switching system contexts, the mapping tables are also switched simultaneously. Therefore, according to the target system, its corresponding target mapping table can be determined. For example, if the target system is the eSE system, the target mapping table is the eSE mapping table.

[0044] In this embodiment, after determining the virtual page number of the target virtual page where the target virtual address is located, the target mapping table corresponding to the target system can be queried. The target mapping table records the mapping relationship between the associated virtual page number and the physical page number. If the physical page number associated with the virtual page number of the target virtual page is not recorded in the target mapping table, it is determined that there is no physical page number associated with this virtual page number in the target mapping table, and step 103 is executed. For example, if the virtual page number of the target virtual page is used as an index to query the target mapping table and it is determined that the element value of this index is empty or an invalid value, it is determined that there is no physical page number associated with this virtual page number, that is, it is determined that the target virtual page has not been written with data and is an idle virtual page.

[0045] Step 103, if not, obtain an idle physical page from the physical page sharing area as the target physical page, and write the target physical page number of the target physical page and the virtual page number in association into the target mapping table. Among them, the physical pages in the physical page sharing area are shared by multiple systems.

[0046] In this embodiment, if it is determined that there is no physical page number associated with this virtual page number in the target mapping table, an idle physical page is obtained from the physical page sharing area as the target physical page, and the target physical page number of the target physical page and the virtual page number are written in association into the target mapping table. Thus, when the target system subsequently writes data to the virtual address in the target virtual page, by querying the target mapping table, it can be determined that there is an associated target physical page for the target virtual page, and the data to be written can be directly written into the corresponding physical address in the target physical page. Among them, the conversion process from the virtual address vAddr to the physical address pAddr is as follows: first, obtain the page offset pageOffset within the virtual page where the virtual address vAddr is located and the virtual page number VID, then obtain the physical page number PID associated with this virtual page through the target mapping table by VID, then obtain the starting address pAlignedAddr of the physical page according to PID, and finally, adding the page offset pageOffset to pAlignedAddr can obtain the final physical address pAddr, and this physical address pAddr is the address where the data is finally written.

[0047] In this embodiment, all the physical pages in the physical page sharing area are shared by multiple systems, but after a physical page is written with data, this physical page can only be accessed by the system to which it belongs, and other systems have no right to access this physical page. This is because after a physical page is written with data of a certain system, the physical page number of this physical page is associated with the virtual page number of the virtual page of this system and recorded in the independent mapping table of this system, and will no longer appear in the mapping tables of other systems. When the system context switches, the mapping table also switches. Therefore, when running other systems, the physical page number of this physical page will not be queried, and thus this physical page will not be accessed, realizing the isolation of the storage space.

[0048] The physical page sharing area includes used physical pages and free physical pages. As long as there are free physical pages in the physical page sharing area, each system can continue to apply for new Flash space to store data, realizing the characteristic of on-demand allocation of the remaining space in a multi-system environment. Figure 4 The figure shows a schematic diagram of the physical page sharing area of an exemplary embodiment of the present disclosure. Taking a multi-system including two systems, eSE and eSIM, as an example, as Figure 4 shown, the eSE and eSIM systems share the physical page sharing area. Some physical pages in the physical page sharing area have been used by eSE and eSIM. From Figure 4 it can be seen that the physical space is not fixedly divided into an eSIM area and an eSE area, but is dynamically allocated according to requirements. All unused free physical pages in the physical page sharing area form a free physical page pool. In any system environment, when writing data to an unused virtual page, it is necessary to first obtain a free physical page in the physical page sharing area, establish a mapping relationship with this virtual page, and then the data can be written into the physical page corresponding to this virtual page.

[0049] Step 104, write the data to be written of the target system into the target physical page, and the information area of the target physical page records the context information of the target system.

[0050] In this embodiment, after determining the target physical page, the data to be written of the target system can be written into the target physical page, so that the target system only needs to access the virtual address to write the data into the corresponding physical page. It can be understood that when the target system needs to read the data in the physical space, it also only needs to access the virtual address, and the physical page associated with this virtual address can be determined by querying the mapping table, and then the data in the physical address can be read.

[0051] In addition, in this embodiment, in addition to being used to store data itself, the physical pages in the physical page sharing area are also attached with a small-capacity information area (HE area) for recording the relevant information of the physical page corresponding to it. The information area also belongs to the non-volatile storage area and does not lose data when powered off. The information area is not visible externally and is only used for internal implementation. The context information (CTX) of the system to which this physical page belongs is recorded in the information area of each physical page, that is, which system it belongs to. Therefore, in this embodiment, the information area of the target physical page records the context information of the target system. Exemplarily, taking a multi-system including two systems, eSE and eSIM, as an example, a possible implementation is: CTX = 1 represents that this physical page belongs to the eSE system, CTX = 2 represents that this physical page belongs to the eSIM system, and other values are undefined. When there are more systems, other values can be extended as needed to represent the corresponding systems. In this way, the data isolation effect of the physical pages in the sharing area is achieved.

[0052] The storage space management method for multiple systems provided by the embodiments of the present disclosure, in response to receiving a request from a target system to write data to a target virtual address, obtains the virtual page number of the target virtual page where the target virtual address is located; queries the target mapping table corresponding to the target system to determine whether there is a physical page number associated with the virtual page number. If not, obtains an idle physical page from the physical page sharing area as the target physical page, and writes the target physical page number of the target physical page and the virtual page number into the target mapping table in an associated manner. Among them, the physical pages in the physical page sharing area are shared by multiple systems; writes the data to be written by the target system into the target physical page, and the information area of the target physical page records the context information of the target system. By adopting the solution of the present disclosure, when writing data is required, an idle physical page is obtained from the physical page sharing area as the target physical page, and the data to be written is written into the target physical page, so that dynamic physical page allocation can be performed when the upper-layer system writes data to an idle virtual address, and the mapping from the virtual page to the physical page can be dynamically established during operation, thereby realizing flexible on-demand allocation of physical pages and improving the utilization efficiency of Flash; moreover, by recording the context information of the belonging system in the information area of the physical page to distinguish the systems to which each physical page belongs, each system can only access the physical pages belonging to its own context, realizing the isolation of the storage space.

[0053] In an alternative embodiment of the present disclosure, the status of the physical pages in the physical page sharing area is marked by a global page status flag array, and the status of the physical pages includes an idle status and a used status. Among them, the global page status flag array can be an array of bit type, used to record the status of all physical pages in the physical page sharing area, where 1 represents that the physical page is in an idle status, and 0 represents that the physical page is in a used status. During the operation of the system, an idle physical page is obtained by traversing the global page status flag array. Each time an idle physical page is taken from the physical page sharing area, its page status flag is set to used (busy). On the contrary, when releasing, the page status flag is set to idle (free). In this embodiment, when obtaining an idle physical page from the physical page sharing area as the target physical page, the global page status flag array can be traversed in sequence starting from the position currently pointed to by the global page index pointer. Among them, the global page index pointer increases during the traversal until the status of the current position of the global page status flag array pointed to by the global page index pointer is in an idle status, determining the target physical page number corresponding to the current position, and further determining the idle physical page corresponding to the target physical page number as the target physical page, and updating the status of the current position in the global page status flag array to used status.

[0054] Further, in an alternative embodiment of the present disclosure, when the global page index pointer increments to a preset value and no free physical page has been traversed yet, the global page index pointer is reset to zero to continue traversing from the starting position of the global page status flag array. The value of the preset value can be set according to actual business requirements. For example, if there are 10 physical pages in the physical page sharing area, the preset value can be set to 9. When the global page index pointer increments to 9, it means that the status of the last physical page has been traversed. If no free page is found, the global page index pointer is reset to zero and the traversal starts again from the status of the first physical page until a free physical page is found. If there is a free physical page, it can always be found.

[0055] In this embodiment, a global index is used to record the position of accessing the global page status flag array each time a free page is obtained. When any system obtains a free page, it starts traversing the global page status flag array from the position pointed to by the global page index pointer. During the traversal, the global page index pointer increments. If it increments to the maximum value (i.e., the preset value), it is reset to zero and returns to the starting position of the global page status flag array to start traversing again until a free physical page with a status flag of 1 is encountered. This page is returned as the currently obtained free page, that is, the target physical page is found. The method for obtaining a free physical page provided by the present disclosure can rotate the physical pages in the sharing area for use instead of fixedly using a certain physical page, achieving the effect of Flash wear leveling and maximizing the number of data writes to Flash.

[0056] It can be understood that when obtaining a free physical page from the physical page sharing area, the position currently pointed to by the global page index pointer is the position of the free physical page found last time. The status of the physical page corresponding to this position may be the used state or the free state (for example, when the data of this physical page has been erased, it is in the free state). Starting from this position, the global page status flag array is traversed in sequence until a free physical page is found. Exemplarily, Figure 5 shows a schematic diagram of determining a free physical page in an exemplary embodiment of the present disclosure, as Figure 5 shown, the global page status flag array is traversed through the global page index pointer. During the traversal, the global page index pointer increments. As Figure 5 shown, the status of the current position of the global page status flag array pointed to by the global page index pointer is 1 (i.e., the free state), and the physical page number corresponding to this current position is PID2. Then, the free physical page corresponding to PID2 is determined as the target physical page.

[0057] In an alternative embodiment of the present disclosure, when the chip is powered on and the system is initialized, all physical pages in the physical page shared area are traversed, and relevant data is initialized according to the erasure state and data storage state of the physical pages, including the initialization of the mapping table and the initialization of the global page status flag array. By initializing, the mapping table and the global page status flag array are re-established to keep them up-to-date, thereby providing the accuracy of storage space management and allocation. Thus, the solution of the present disclosure further includes: when the target system is initialized, traversing each physical page in the physical page shared area; when the currently traversed physical page is erased, marking the status of the position corresponding to the physical page number of the currently traversed physical page in the global page status flag array as the idle state; when the currently traversed physical page is not erased, marking the status of the position corresponding to the physical page number of the currently traversed physical page in the global page status flag array as the used state, and reading the target context information and the target mapping relationship recorded in the information area of the currently traversed physical page. The target mapping relationship is the mapping relationship between the physical page number of the currently traversed physical page and the associated virtual page number. Then, according to the target context information, it is determined which system the currently traversed physical page belongs to, and the target mapping relationship is written into the mapping table corresponding to the system to which the currently traversed physical page belongs.

[0058] In this embodiment, when the chip is powered on, all physical pages in the physical page shared area are traversed. If the state of a physical page is the erased state, its state is marked as the idle state in the global page status flag array; if its state is valid, the information area of this physical page is read to obtain the mapping relationship from VID to PID and the CTX context information. According to the CTX context information, it can be determined which system this physical page belongs to. If it is a physical page belonging to the eSE system, this mapping relationship from VID to PID is written into the mapping table of the eSE system. If it is a physical page belonging to the eSIM system, this mapping relationship from VID to PID is written into the mapping table of the eSIM system, and at the same time, the state of this physical page is marked as the used state in the global page status flag array.

[0059] In an alternative embodiment of the present disclosure, when writing the data to be written in the target system into the target physical page, the page offset within the target virtual page of the target virtual address can be obtained first. Then, based on the physical start address of the target physical page and this page offset, the target physical address corresponding to the target virtual address is determined. Furthermore, the data to be written in the target system is written into the target physical address. Thus, it is realized that the data to be written can be written into the corresponding physical address without accessing the real physical address.

[0060] It can be understood that the sizes of each virtual page and physical page are fixed, and the starting addresses of the virtual page and physical page are known. Therefore, for a determined target virtual page, the page offset of the target virtual address within the target virtual page can be determined according to the difference between its starting address and the target virtual address. The sum of this page offset and the physical starting address of the associated target physical page is the target physical address corresponding to the target virtual address.

[0061] Since the system may power off at any time, and the Flash writing operation takes a certain amount of time, sudden power failure during the Flash writing process may damage the data integrity. A transaction can contain multiple atomic operations. When starting a transaction for atomic writing operations, the results of these atomic write operations can only be all successfully completed or all not executed (the Flash data remains unchanged as before the write). To achieve the atomicity of a transaction, rollback operations need to be supported. After a certain operation fails, roll back to the state before the transaction execution.

[0062] Opening of a transaction: When opening a transaction, it is necessary to write the version number of the current transaction in the log area to mark the start operation of the current transaction write, and at the same time, it is also for the integrity verification of the transaction operation. When the transaction operation is successfully completed, it is necessary to write the result of taking the inverse of the version number of the current transaction in the log area. If the log area is scanned during power-on and it is found that a transaction with a certain version number does not satisfy the inverse relationship (for example, only the version number of the transaction is recorded but not the inverse result of the version number), it means that this transaction has not been successfully completed, and it is necessary to erase the physical page in the information area whose transaction version number is equal to this version number.

[0063] Figure 6 The figure shows a schematic diagram of transaction backup in an exemplary embodiment of the present disclosure. It can be understood that Figure 6 the backup area in Figure 2 corresponds to the eSE transaction area or eSIM transaction area in Figure 6 This transaction area is a static transaction space. Process of transaction writing: Assume that data is written to destVID (for example Figure 6 VID2 in Figure 6 ), and its associated physical page is destPID (for example Figure 6PID1 in it). Read the original data in destPID into the RAM buffer, write the data into the RAM buffer according to the write operation, then write the data in the RAM buffer into freePID, and then exchange the PIDs associated with destVID and freeVID in the mapping table, that is, let destVID be associated with freePID, and let freeVID be associated with destPID. At this time, the physical page associated with destVID is the page with the newly written data, while the freeVID backup page is associated with the old physical page, which is equivalent to backing up the original data.

[0064] Commit of the transaction: To implement the commit of the transaction, it is necessary to write the mapping relationship between destVID and freePID and the current transaction version number into the information area of the new physical page of freePID, and then erase the backup physical page (i.e., destPID).

[0065] Active rollback of the transaction: Read the original destPID from the information area of the old physical page destPID associated with freeVID, then exchange the PIDs of destVID and freeVID in the mapping table to restore the original mapping relationship to implement transaction rollback, then erase the backup area freePID, and replace the PID associated with freeVID with a new free physical page to achieve wear leveling of the transaction area. Finally, write the negation of the current transaction version number in the log area to mark that the current transaction has been completed.

[0066] The static transaction space (backup area) of each system is limited. In the existing solutions, when the static transaction space is consumed, no transaction backup can be provided anymore. Based on this, the solution provided by the present disclosure supports dynamic transaction capabilities. By using the idle user space to dynamically construct transaction backup pages, dynamic-sized transaction capabilities are achieved, improving the transaction capabilities of the system. Thus, the solution of the present disclosure further includes: when a transaction is enabled in the target system, determining whether the static transaction space of the target system has been used up; when the static transaction space has been used up, traversing from the low virtual address to the high virtual address in the user area space of the target system to determine an idle virtual page as the backup virtual page; determining an idle physical page from the physical page sharing area as the backup physical page; associating the virtual page number of the backup virtual page with the physical page number of the backup physical page to obtain a pair of dynamic transaction backup pages, which are used for transaction operations.

[0067] Among them, a dynamic transaction refers to temporarily borrowing an idle user virtual page and an idle physical page in the sharing area to perform the transaction data writing function, which improves the transaction writing ability of the system and makes full use of the idle resources.

[0068] In this embodiment, when the target system starts a transaction, to perform a transaction write, it is necessary to first determine the transaction backup page, including the backup virtual page and the associated physical page. The electronic device first obtains the backup virtual page of the static transaction space. If the static transaction space has been used up, it is necessary to apply for a dynamic transaction space. Specifically, user data grows from the high address to the low address of the virtual page, while the dynamic transaction grows from the low address to the high address of the user area. For example Figure 2 shows the growth directions of user data and dynamic transactions. When the static transaction is exhausted, free VID is retrieved from the low virtual address space of the user area of the target system to the high virtual address space as the dynamic transaction VID (i.e., the backup virtual page), and a free physical page (i.e., the backup physical page) is retrieved from the physical page sharing area and associated with the dynamic transaction VID to form a complete dynamic transaction backup page. After that, the transaction write operation can be performed. Among them, the method of obtaining a free physical page from the physical page sharing area can refer to the relevant description of obtaining a free physical page in the foregoing embodiment, which will not be elaborated here.

[0069] Furthermore, in an alternative embodiment of the present disclosure, the solution of the present disclosure further includes: in the case of transaction commit or rollback, detecting whether the backup page used during the transaction operation is a dynamic transaction backup page; if so, erasing the backup physical page in the dynamic transaction backup page, marking the status of the backup physical page as the free state in the global page status flag array, and deleting the association relationship between the physical page number of the backup physical page and the virtual page number of the backup virtual page in the dynamic transaction backup page in the target mapping table.

[0070] It can be understood that when a transaction is committed, the backup physical page refers to the physical page associated with the target virtual page in the original mapping relationship (i.e., the destPID mentioned above). According to the foregoing description, during the transaction write process, data is written into the backup physical page, and the data recorded in the backup physical page is the data in the original physical page and the newly written data. Therefore, after the transaction is successfully committed, it is necessary to erase the data in the original physical page (destPID) used as the backup; when a transaction is rolled back, the backup physical page refers to the physical page associated with the backup virtual page (i.e., the freePID mentioned above). When the transaction is rolled back, it is necessary to restore the data in the target physical page to the original state. Therefore, the physical page (freePID) associated with the backup virtual page is erased.

[0071] In this embodiment, when a transaction is committed or rolled back, it is checked whether a dynamic transaction is used. For example, it can be determined whether the transaction area or the user area of the target system is used based on the VID of the backup page during the transaction operation. If it belongs to the user area, it can be determined that a dynamic transaction is used, and then the dynamic transaction will be released: erase the PID physical pages of all dynamic transactions, mark them as free in the global physical page status array, and then set the PID associated with the dynamic transaction VID to an invalid value in the mapping table, thus completing the release process of the dynamic transaction.

[0072] To implement the above embodiment, the present disclosure also provides a storage space management device for multiple systems.

[0073] Figure 7 FIG. is a schematic structural diagram of a storage space management device for multiple systems provided by an embodiment of the present disclosure. The device is implemented in a software and / or hardware manner and can be integrated into an electronic device.

[0074] As Figure 7 shown, the storage space management device 50 for multiple systems may include: a first acquisition module 510, a judgment module 520, a second acquisition module 530, and a data writing module 540.

[0075] Among them, the first acquisition module 510 is configured to, in response to a request to write data to a target virtual address received by the target system, acquire the virtual page number of the target virtual page where the target virtual address is located;

[0076] The judgment module 520 is configured to query the target mapping table corresponding to the target system and judge whether there is a physical page number associated with the virtual page number;

[0077] The second acquisition module 530 is configured to, if not, acquire an idle physical page from the physical page sharing area as the target physical page, and associate the target physical page number of the target physical page with the virtual page number and write it into the target mapping table, where the physical pages in the physical page sharing area are shared by multiple systems;

[0078] The data writing module 540 is configured to write the data to be written by the target system into the target physical page, and the information area of the target physical page records the context information of the target system.

[0079] Optionally, the status of the physical pages in the physical page sharing area is marked by a global page status flag array, and the status includes an idle status and a used status; the second acquisition module 530 is further configured to:

[0080] Starting from the position currently pointed to by the global page index pointer, traverse the global page status flag array in sequence. During the traversal, the global page index pointer is incremented until the status of the current position in the global page status flag array pointed to by the global page index pointer is the idle state, and determine the target physical page number corresponding to the current position;

[0081] Determine the idle physical page corresponding to the target physical page number as the target physical page, and update the status of the current position in the global page status flag array to the used state.

[0082] Further optionally, the second acquisition module 530 is further configured to:

[0083] In the case that the global page index pointer has been incremented to the preset value and no idle physical page has been traversed yet, reset the global page index pointer to zero to continue traversing from the starting position of the global page status flag array.

[0084] Optionally, the storage space management device 50 of the multi-system further includes:

[0085] The first traversal module is configured to traverse each physical page in the physical page sharing area when the target system is initialized;

[0086] The first marking module is configured to mark the status of the corresponding position of the physical page number of the currently traversed physical page in the global page status flag array as the idle state when the currently traversed physical page is erased;

[0087] The second marking module is configured to mark the status of the corresponding position of the physical page number of the currently traversed physical page in the global page status flag array as the used state when the currently traversed physical page is not erased, and read the target context information and the target mapping relationship recorded in the information area of the currently traversed physical page, where the target mapping relationship is the mapping relationship between the physical page number of the currently traversed physical page and the associated virtual page number;

[0088] The association module is configured to determine the system to which the currently traversed physical page belongs according to the target context information, and write the target mapping relationship into the mapping table corresponding to the system to which the currently traversed physical page belongs.

[0089] Optionally, the data writing module 540 is further configured to:

[0090] Obtain the page offset within the target virtual page of the target virtual address;

[0091] Based on the physical starting address of the target physical page and the page offset, determine the target physical address corresponding to the target virtual address;

[0092] Write the data to be written in the target system into the target physical address.

[0093] Optionally, the storage space management device 50 of the multi-system further includes:

[0094] A verification module, configured to determine whether the static transaction space of the target system has been exhausted when the target system starts a transaction;

[0095] A second traversal module, configured to traverse from the low virtual address to the high virtual address of the user area space of the target system to determine an idle virtual page as a backup virtual page when the static transaction space has been exhausted;

[0096] A determination module, configured to determine an idle physical page from the physical page sharing area as a backup physical page;

[0097] A backup association module, configured to associate the virtual page number of the backup virtual page with the physical page number of the backup physical page to obtain a pair of dynamic transaction backup pages, and the dynamic transaction backup pages are used for transaction operations.

[0098] Further optionally, the storage space management device 50 of the multi-system further includes:

[0099] A detection module, configured to detect whether the backup page used during the transaction operation is a dynamic transaction backup page when the transaction is committed or rolled back;

[0100] A release module, configured to erase the backup physical page in the dynamic transaction backup page, mark the state of the backup physical page as an idle state in the global page status flag array, and delete the association relationship between the physical page number of the backup physical page and the virtual page number of the backup virtual page in the dynamic transaction backup page in the target mapping table when using the dynamic transaction backup page.

[0101] The storage space management device of the multi-system applied to an electronic device provided by the embodiments of the present disclosure can execute the storage space management method of the multi-system provided by the embodiments of the present disclosure, and has the corresponding functional modules and beneficial effects for executing the method. The content not described in detail in the embodiments of the present disclosure device can be referred to the description in any method embodiment of the present disclosure.

[0102] The embodiments of the present disclosure also provide a computer program product, including computer programs / instructions, and when the computer programs / instructions are executed by a processor, the storage space management method of the multi-system provided by any embodiment of the present disclosure is implemented.

[0103] According to one or more embodiments of the present disclosure, the present disclosure provides an electronic device, including:

[0104] A processor;

[0105] A memory for storing instructions executable by the processor;

[0106] The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the storage space management method for multiple systems provided in any embodiment of the present disclosure.

[0107] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium storing a computer program for implementing the storage space management method for multiple systems provided in any embodiment of the present disclosure.

[0108] It should be noted that the computer-readable medium in the present disclosure may be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having 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 present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take various 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, which can 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 appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0109] The above computer-readable medium may be included in the above electronic device; or may exist separately without being assembled into the electronic device.

[0110] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks may occur in a different order than noted in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or by a combination of dedicated hardware and computer instructions.

[0111] The units described in the embodiments of the present disclosure can be implemented in software or in hardware. In some cases, the name of the unit does not constitute a limitation on the unit itself.

[0112] The functions described above herein can be performed, at least in part, by one or more hardware logic components. By way of example, and not limitation, the types of hardware logic components that may be used include: field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems on a chip (SOCs), complex programmable logic devices (CPLDs), and the like.

[0113] In the context of the present disclosure, a machine-readable medium may be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0114] The above description is only a preferred embodiment of the present disclosure and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosure concept. For example, the technical solutions formed by mutually replacing the above features with the technical features (but not limited to) having similar functions disclosed in the present disclosure.

[0115] In addition, although the operations are depicted in a particular order, this should not be construed as requiring that the operations be performed in the particular order shown or in sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although a number of specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features described in the context of separate embodiments may also be implemented combinatorially in a single embodiment. Conversely, the various features described in the context of a single embodiment may also be implemented separately or in any suitable sub-combination in multiple embodiments.

[0116] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.

Claims

1. A multi-system storage space management method, characterized in that: The method comprises: In response to receiving a request from a target system to write data to a target virtual address, obtaining a virtual page number of a target virtual page where the target virtual address is located; Querying a target mapping table corresponding to the target system to determine whether there is a physical page number associated with the virtual page number; If not, obtaining a free physical page from the physical page sharing area as the target physical page, and writing the target physical page number of the target physical page into the target mapping table in association with the virtual page number, wherein the physical pages in the physical page sharing area are shared by multiple systems; The data to be written in the target system is written into the target physical page, and the information area of ​​the target physical page records the context information of the target system.

2. The method according to claim 1, characterized in that: The states of the physical pages in the physical page sharing area are marked by a global page state flag array, and the states include an idle state and a used state; The step of obtaining a free physical page from the physical page sharing area as a target physical page includes: Starting from the position currently pointed to by the global page index pointer, the global page status flag array is traversed in sequence, wherein the global page index pointer is incremented during the traversal process until the state of the current position of the global page status flag array pointed to by the global page index pointer is an idle state, and a target physical page number corresponding to the current position is determined; An idle physical page corresponding to the target physical page number is determined as the target physical page, and the state of the current position in the global page state flag array is updated to a used state.

3. The method according to claim 2, characterized in that The method further comprises: When the global page index pointer is incremented to a preset value but still fails to traverse to an idle physical page, the global page index pointer is reset to zero to continue traversing from the start position of the global page status flag array.

4. The method according to claim 2, characterized in that: The method further comprises: When the target system is initialized, traversing each physical page in the physical page sharing area; When the currently traversed physical page is erased, marking the state of the position corresponding to the physical page number of the currently traversed physical page in the global page state flag array as an idle state; When the currently traversed physical page has not been erased, the state of the position corresponding to the physical page number of the currently traversed physical page in the global page state flag array is marked as a used state, and the target context information and the target mapping relationship recorded in the information area of ​​the currently traversed physical page are read, and the target mapping relationship is the mapping relationship between the physical page number of the currently traversed physical page and the associated virtual page number; The system to which the currently traversed physical page belongs is determined according to the target context information, and the target mapping relationship is written into a mapping table corresponding to the system to which the currently traversed physical page belongs.

5. The method according to any one of claims 1 to 4, characterized in that: Writing the to-be-written data of the target system into the target physical page includes: Obtaining the in-page offset of the target virtual address in the target virtual page; Determine a target physical address corresponding to the target virtual address based on the physical start address of the target physical page and the in-page offset; The data to be written in the target system is written into the target physical address.

6. The method according to any one of claims 2 to 4, characterized in that: The method further comprises: In the case where the target system starts a transaction, determining whether the static transaction space of the target system has been exhausted; When the static transaction space is exhausted, traverse from a low virtual address to a high virtual address of the user area space of the target system to determine a free virtual page as a backup virtual page; Determine a free physical page from the physical page sharing area as a backup physical page; The virtual page number of the backup virtual page is associated with the physical page number of the backup physical page to obtain a pair of dynamic transaction backup pages, and the dynamic transaction backup pages are used for transaction operations.

7. The method according to claim 6, characterized in that The method further comprises: When a transaction is committed or rolled back, detect whether the backup page used in the transaction operation is a dynamic transaction backup page; If so, the backup physical page in the dynamic transaction backup page is erased, and the state of the backup physical page is marked as idle in the global page status flag array, and the association between the physical page number of the backup physical page in the target mapping table and the virtual page number of the backup virtual page in the dynamic transaction backup page is deleted.

8. A multi-system storage space management device, characterized in that: The device comprises: A first acquisition module, configured to, in response to receiving a request from a target system to write data to a target virtual address, acquire a virtual page number of a target virtual page where the target virtual address is located; A determination module, used for querying a target mapping table corresponding to the target system to determine whether there is a physical page number associated with the virtual page number; A second acquisition module is used for acquiring an idle physical page from the physical page sharing area as the target physical page if it does not exist, and writing the target physical page number of the target physical page into the target mapping table in association with the virtual page number, wherein the physical pages in the physical page sharing area are shared by multiple systems; The data writing module is used to write the to-be-written data of the target system into the target physical page, and the information area of ​​the target physical page records the context information of the target system.

9. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing instructions executable by the processor; The processor is used to read the executable instructions from the memory and execute the executable instructions to implement the multi-system storage space management method described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program is used to implement the multi-system storage space management method described in any one of claims 1 to 7.

Citation Information

Cited By

  • Data processing method, electronic equipment, system, storage medium and program product

    CN121166043A

  • Data processing method, electronic device, system, storage medium and program product

    CN121166043B