Method, device and electronic device for creating a process

By setting the access status for the target process in the Linux environment, only the child process is allowed to access necessary memory data, which solves the memory overflow problem caused by copying data when the parent process creates the child process, and improves system stability and memory usage efficiency.

CN112231121BActive Publication Date: 2024-09-13BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011130643.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-10-20
Publication Date
2024-09-13
Estimated Expiration
2040-10-20

AI Technical Summary

Technical Problem

In a Linux environment, when a parent process creates a child process, the process of copying data may cause memory overflow, affecting system stability. Especially when the amount of data is large or memory resources are tight, running programs or instances may stop running.

Method used

By setting the access status in the memory data of the target process, only the child process is allowed to access the required target data to avoid double copying of all memory data. The memory data other than the target data is marked before using the COW mechanism to ensure that the child process Access only necessary memory data.

Benefits of technology

It effectively avoids the memory overflow problem caused by excessive memory usage growth, improves the stability of system operation, especially in resource-constrained environments, reduces memory usage and improves service stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112231121B
    Figure CN112231121B
Patent Text Reader

Abstract

The present invention provides a method, device and electronic device for creating a process. When a subprocess needs to be created based on a target process, the target data that the subprocess needs to access is first determined from the memory data of the target process according to the process task of the subprocess; then, based on the target data, the access status of at least a part of the memory data of the target process is set; and finally, based on the target process after the access status is set, the subprocess is created. In this method, when a subprocess is created based on a target process, the access status is set for the memory data in the target process according to the target data that the subprocess needs to access, so that the subprocess only has the right to access a part of the memory data in the target process, and there is no need to double copy all the memory data in the target process, thereby avoiding the problem of memory overflow caused by excessive growth of memory usage, thereby improving the stability of system operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of memory optimization, and in particular to a method, device and electronic device for creating a process. Background Art

[0002] In the Linux environment, after the parent process creates the child process, before the parent process or the child process writes data, the parent process and the child process share the same physical memory area in the memory; if the parent process or the child process needs to write data, the physical memory areas of the parent process and the child process need to be separated, that is, the data in the originally shared physical memory area is copied to other areas of the memory; during the copying process, if the amount of data to be copied is large, or the current memory resources are tight, it may cause memory overflow, causing some programs or instances running in the memory to stop running, resulting in poor stability of system operation. Summary of the invention

[0003] In view of this, the purpose of the present invention is to provide a method, device and electronic device for creating a process to avoid the problem of memory overflow caused by excessive memory usage growth during data copying, thereby improving the stability of system operation.

[0004] In a first aspect, an embodiment of the present invention provides a method for creating a process, the method comprising: if a child process needs to be created based on a target process, determining the target data that the child process needs to access from the memory data of the target process according to the process task of the child process; based on the target data, setting the access status of at least a part of the memory data of the target process; wherein the access status is used to indicate: whether the child process has the authority to access at least a part of the memory data; and creating the child process based on the target process after setting the access status.

[0005] Furthermore, based on the target data, the step of setting the access status of at least a part of the memory data of the target process includes: setting a marker for the data other than the target data in the memory data of the target process; wherein the marker is used to indicate that the child process has no authority to access data other than the target data.

[0006] Furthermore, the step of setting a marker for data other than the target data in the memory data of the target process includes: obtaining the memory address and memory size of the data other than the target data; setting a marker for the data corresponding to the memory address and memory size to mark the data corresponding to the memory address and memory size as data that the child process does not have permission to access.

[0007] Furthermore, after the step of creating a child process based on the target process after setting the access status, the method further includes: when the child process needs to access the memory data of the target process, accessing the memory data of the target process according to the access status.

[0008] Furthermore, the memory data of the target process includes multiple types; the step of accessing the memory data of the target process according to the access status includes: for each type of memory data, if the current type of memory data is set with an access status, and the access status indicates that the child process does not have the authority to access the current type of memory data, denying the child process access to the current type of memory data; if the current type of memory data has no access status, or the set access status indicates that the child process has the authority to access the current type of memory data, writing the current type of memory data into the physical memory corresponding to the child process.

[0009] Furthermore, after the step of accessing the memory data of the target process according to the access status, the method further includes: canceling the set access status.

[0010] Furthermore, the process tasks of the subprocess include: a database data backup task; the target data that the subprocess needs to access includes: database data in the memory data of the target process.

[0011] In a second aspect, an embodiment of the present invention provides a device for creating a process, the device comprising: a determination module, for determining, if a child process needs to be created based on a target process, the target data that the child process needs to access from the memory data of the target process according to the process task of the child process; a setting module, for setting the access status of at least a part of the memory data of the target process based on the target data; wherein the access status is used to indicate whether the child process has the authority to access at least a part of the memory data; and a creation module, for creating a child process based on the target process after the access status is set.

[0012] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for creating a process according to any one of the first aspects.

[0013] In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method for creating a process according to any one of the first aspects.

[0014] The embodiments of the present invention bring the following beneficial effects:

[0015] The embodiment of the present invention provides a method, device and electronic device for creating a process. When a subprocess needs to be created based on a target process, the target data that the subprocess needs to access is first determined from the memory data of the target process according to the process task of the subprocess; then, based on the target data, the access status of at least a part of the memory data of the target process is set; finally, based on the target process after the access status is set, the subprocess is created. In this method, when a subprocess is created based on a target process, the access status is set for the memory data in the target process according to the target data that the subprocess needs to access, so that the subprocess only has the right to access a part of the memory data in the target process, and there is no need to double copy all the memory data in the target process, thereby avoiding the problem of memory overflow caused by excessive growth of memory usage, thereby improving the stability of system operation.

[0016] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0017] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 A flow chart of a method for creating a process provided by an embodiment of the present invention;

[0020] Figure 2 A flow chart of another method for creating a process provided by an embodiment of the present invention;

[0021] Figure 3 A schematic diagram of a creation process provided by an embodiment of the present invention;

[0022] Figure 4 A schematic diagram of the structure of a device for creating a process provided by an embodiment of the present invention;

[0023] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0025] At present, in the Linux environment, memory optimization between parent and child processes usually adopts the COW (Copy On Write) mechanism, which saves a lot of memory space copies, thereby reducing memory usage. However, when either the parent process or the child process modifies the memory, the side effect of COW will be generated, that is, a double copy of the memory will be generated. For example, Redis (Remote dictionary server) is a full-memory database. When the master-slave full replication or backup is performed, it is necessary to create a child process to generate an rdb (reverse dot blot) database. When the host's large-capacity instance memory and IO (Input / Output) are tight, and the main process data is operated, the side effect of the COW mechanism, that is, double memory copies, may be caused, so that the host memory usage increases too high, which may cause OOM (Out Of Memory), causing some programs or instances running in the memory that use too much memory to stop running, resulting in poor stability of system operation. Based on this, an embodiment of the present invention provides a method, device and electronic device for creating a process, and the technology can be applied to various hardware devices such as computers and notebooks.

[0026] To facilitate understanding of this embodiment, a method for creating a process disclosed in an embodiment of the present invention is first described in detail. Figure 1 As shown, the method comprises the following steps:

[0027] Step S102, if a child process needs to be created based on the target process, the target data that the child process needs to access is determined from the memory data of the target process according to the process task of the child process;

[0028] The above-mentioned target process usually refers to an instance of a running program. A running program may have multiple processes. After the target process creates one or more child processes, it can be called a parent process. The above-mentioned child process is a process created by the target process. The process tasks of the above-mentioned child process include: database data backup tasks, that is, the type of data to be backed up, and various types of files are generated based on the data. The specific settings can be made according to actual needs. For example, a child process needs to be created for the target process to generate an rdb file. At this time, the process task can be the database data that needs to be backed up to generate the rdb file.

[0029] The target data that the above-mentioned sub-process needs to access includes: database data in the memory data of the target process; it may include a part of the data in the memory data of the target process; in addition, the memory data of the target process may include multiple types, such as data memory, master-slave replication cache, client and client cache, AOF (Append Only File) cache, lua script GC (garbage collection) buffer, program running memory, etc., and it can be based on the database data backup task included in the process task of the sub-process, which can be a backup data memory, and determine the target data that the sub-process needs to access from the memory data of the target process, which can be the data in the data memory, and then copy the target data to generate the target file of the sub-process.

[0030] Step S104, based on the target data, setting the access status of at least a portion of the memory data of the target process; wherein the access status is used to indicate whether the child process has the authority to access at least a portion of the memory data;

[0031] The above-mentioned access status can be to set a marking parameter for at least a part of the memory data of the target process, which can be marked using an interface function; specifically, after receiving information on creating a child process based on the target process, before starting to copy using the COW mechanism, the memory data in the target process other than the target data needs to be marked, and the memory data in the target process corresponding to the target data can also be marked; the interface function can be used to perform parameter marking on at least a part of the memory data so that the access status of the part of the memory data is that the child process does not have the authority to access the part of the memory data, or the child process has the authority to access the part of the memory data.

[0032] Step S106, creating a child process based on the target process after setting the access status.

[0033] After setting the access state of the data memory in the target process, a subprocess can be created according to the data memory accessible to the subprocess in the access state, so that the created subprocess includes the corresponding physical memory.

[0034] Taking the Redis full-memory database as an example, this embodiment illustrates the memory occupation problem caused by creating a child process without setting the access status; the buf buffer of AOF in the target process, when the redis service turns on the AOF data operation log, the child process does not need this part of the memory to generate the rdb file. If the target process uses 100MB of memory as the buf buffer of AOF, if the access status of the buf buffer data is not marked, after the child process is created to copy the data, the parent process modifies the buf buffer memory data of AOF, which will result in a scenario where 200MB of the system is occupied.

[0035] The memory buffer between the master and slave replication. When the redis service already has a slave node, the child process does not need this part of memory to generate the RDB file. If the parent process uses 100MB of memory as the master-slave incremental buffer, if the access status is not marked, after the child process is created to copy the data, the parent process modifies the master-slave replication buffer memory, which will occupy 200MB of the system.

[0036] The network packet buffer between the redis client and the redis-server service. When the user has multiple client connections, in the scenario where the child process generates an RDB file, since the child process does not need this part of memory, the parent process will modify the memory when restoring the client request result, resulting in double memory usage.

[0037] The GC (garbage collection) buffer of the Lua script, in the scenario where users use a large number of Lua scripts, generates RDB data in the child process. Due to the large number of Lua scripts executed, the memory usage of the Lua virtual machine will increase, resulting in the double occupancy of the memory usage of the garbage collection mechanism of the Lua virtual machine.

[0038] The embodiment of the present invention provides a method for creating a process. When a child process needs to be created based on a target process, the target data that the child process needs to access is first determined from the memory data of the target process according to the process task of the child process; then, based on the target data, the access status of at least a part of the memory data of the target process is set; and finally, based on the target process after the access status is set, the child process is created. In this method, when a child process is created based on a target process, the access status is set for the memory data in the target process according to the target data that the child process needs to access, so that the child process only has the right to access a part of the memory data in the target process, and there is no need to double copy all the memory data in the target process, thereby avoiding the problem of memory overflow caused by excessive growth of memory usage, thereby improving the stability of system operation.

[0039] This embodiment also provides another method for creating a process. This embodiment focuses on describing the specific implementation process of the step of setting the access status of at least a part of the memory data of the target process based on the target data (implemented by step S204), and the specific implementation process of the steps after the step of creating a child process based on the target process after the access status is set (implemented by steps S208-S210). Figure 2 As shown, the method comprises the following steps:

[0040] Step S202, if a child process needs to be created based on the target process, the target data that the child process needs to access is determined from the memory data of the target process according to the process task of the child process;

[0041] Step S204, setting a marker for the data other than the target data in the memory data of the target process; wherein the marker is used to indicate that the child process has no authority to access the data other than the target data;

[0042] In the process of creating a child process using the COW mechanism, all the memory in the target process will be copied in full, increasing the use of host memory; in addition, the process task of the child process does not need to copy all the memory in the target process, only the target data needs to be copied. Therefore, a marker can be set for the data in the memory data of the target process except the target data, so that the child process has no authority to access data except the target data, and then only the target data is copied to create the child process.

[0043] For example, in the current solution, i.e. the open source community version, a complete memory copy is performed during the process of creating a child process for the master-slave replication of a large-capacity redis instance, and a large part of the memory is useless in the child process, such as the AOF buf buffer, the memory buffer between the master and the slave, the network packet buffer between the redis client and the redis-server, etc. The full rdb file backup only uses the memory data of the db part, and the other parts will cause the memory to be doubled when the child process performs a full rdb file backup.

[0044] The above-mentioned markers can be set using interface functions, and the memory address, memory size, data itself, etc. of data other than the target data can be set; for example, a system interface madviseMADV_DONTFORK int madvise(void*addr,size_t length,int advice) of the Linux system platform can be used to set the markers of data other than the target data; thus indicating that the memory data with the marker set does not need to be shared with the child process, that is, the child process has no authority to access this part of the memory data, which is the data other than the target data in the memory data of the target process. This method of marking in the kernel and not allowing these memories to be copied can avoid page copying and reference problems when copying; since the child process's memory only uses the memory of the storage part of the database, even after the target process makes a certain amount of memory modifications in other parts, it will reduce the increase in memory usage.

[0045] In the above step S204, the step of setting a marker for data other than the target data in the memory data of the target process includes:

[0046] (1) Obtain the memory address and memory size of data other than the target data;

[0047] Specifically, different memories of data are marked with pointers in the memory management area, and the memory address and memory size of the data other than the target data can be found through the memory address management area of ​​the database.

[0048] (2) Setting a marker for the data corresponding to the memory address and the memory size to mark the data corresponding to the memory address and the memory size as data that the child process does not have permission to access.

[0049] Similarly, the interface function can be used to set it. For example, the marker can be set through a system interface madvise MADV_DONTFORK int madvise(void*addr,size_t length,int advice) of the Linux system platform; the first void*addr can be the memory address pointed to, the second size_t length can be the size of the memory, and the data corresponding to the marked memory address and memory size can be marked with the third int advice as: data that the child process does not have permission to access, where the marker set can be MADV_DONTFORK to indicate that this part of memory data does not need to be shared with the child process, that is, the child process does not have permission to access this part of memory data, and this part of memory data is the data in the target process's memory data except the target data; of course, MADV_DOFORK can also be used to cancel the marking status of this part of memory.

[0050] Step S206, creating a child process based on the target process after setting the access status;

[0051] Step S208, when the child process needs to access the memory data of the target process, the memory data of the target process is accessed according to the access status;

[0052] In actual implementation, when the child process needs to access the memory data of the target process, the child process will use the COW mechanism to access all the memory data of the target process. When the access status indicates that the child process is not allowed to access, the memory data will not be accessed. Usually, memory data without an access status can be accessed directly, that is, the target data that the child process needs to access in the memory data of the target process can be accessed. The accessed memory data can be copied and saved in the memory corresponding to the created child process.

[0053] The memory data of the target process in the above step S208 includes multiple types; the step of accessing the memory data of the target process according to the access status includes:

[0054] (1) For each type of memory data, if the current type of memory data is set with an access status, and the access status indicates that the child process does not have permission to access the current type of memory data, deny the child process access to the current type of memory data;

[0055] For example Figure 3 As shown in the schematic diagram of the creation process, the memory data of the target process includes: memory data, master-slave replication cache, client and client cache, AOF (Append Only File) cache, Lua script GC (garbage collection) buffer, program running memory, etc. In actual implementation, each of the above memory data can be accessed. If the current type of memory data is set with an access status, and the access status indicates that the child process has no permission to access the current type of memory data, the child process is denied access to the current type of memory data.

[0056] For example Figure 3 As shown, in the scenario where the child process generates an RDB file, the child process only needs to access the memory data and program running memory in the copy target process. When accessing the master-slave copy cache data other than the memory data and program running memory, the client and client cache, the AOF (Append Only File) cache, and the GC (garbage collection) buffer of the Lua script, an access status is set, and the access status indicates that the child process has no permission to access this part of the data, then the child process is denied access to the current type of memory data, which can avoid copying unnecessary data and generating page copy and reference problems.

[0057] (2) If the memory data of the current type has no access status, or the set access status indicates that the child process has the authority to access the memory data of the current type, the memory data of the current type is written into the physical memory corresponding to the child process.

[0058] For example Figure 3 As shown in the schematic diagram of the creation process, in the scenario where the child process generates an rdb file, the child process only needs to access the memory data and program running memory in the copied target process. When accessing the memory data and program running memory, since the access status is not set, the child process has the authority to access the current type of memory data, and can directly write the current type of memory data into the physical memory corresponding to the child process; or since the set access status indicates that the child process has the authority to access this part of the data, the current type of memory data can be written into the physical memory corresponding to the child process, which can avoid copying unnecessary data and generating page copy and reference problems.

[0059] Step S210, canceling the set access status.

[0060] After the copying work is completed, in order to facilitate the subsequent creation of different process tasks, the access status of the memory data setting in the target process that has completed the copying task can be canceled.

[0061] It should be noted that the present application is not limited to the scenario of generating rdb files, that is, the process tasks of the child process can include multiple types, among which the type of memory data to be copied, that is, the target data can be set according to the process task, and is not limited to data memory and program running data.

[0062] In this method, by setting a marker for the data other than the target data in the target process, the child process has no right to access the data other than the target data. The child process is created based on the target process after the access status is set. When the child process needs to access the memory data of the target process, the memory data of the target process is accessed according to the access status. In the process of copying data, the double copy of all memory data in the child process is avoided. The memory addresses that do not need to be cow copied are marked in the kernel to prevent these memories from being copied. Then, when forking, there will be no page copy and reference problems. Since the memory of the child process only uses the memory of the storage part of the database, even after the parent process makes a certain amount of memory modification in other parts, the increase in memory usage will be reduced, and the problem of excessive memory usage growth caused by master-slave synchronization in a resource-constrained environment will be reduced, thereby improving service stability and synchronization success rate. In addition, the memory usage of the software in most parent and child process replication situations can be optimized, and the memory usage can be optimized when the master-slave full replication of the online redis database instance is reduced.

[0063] Corresponding to the above method embodiment, the embodiment of the present invention provides a device for creating a process, such as Figure 4 As shown, the device comprises:

[0064] A determination module 41 is used for determining target data that the subprocess needs to access from the memory data of the target process according to the process task of the subprocess if a subprocess needs to be created based on the target process;

[0065] A setting module 42 is used to set the access status of at least a part of the memory data of the target process based on the target data; wherein the access status is used to indicate whether the child process has the authority to access at least a part of the memory data;

[0066] The creation module 43 is used to create a child process based on the target process after the access state is set.

[0067] The embodiment of the present invention provides a device for creating a process. When a child process needs to be created based on a target process, the device first determines the target data that the child process needs to access from the memory data of the target process according to the process task of the child process; then sets the access status of at least a part of the memory data of the target process based on the target data; and finally creates the child process based on the target process after the access status is set. In this method, when a child process is created based on a target process, the access status is set for the memory data in the target process according to the target data that the child process needs to access, so that the child process only has the right to access a part of the memory data in the target process, and there is no need to double copy all the memory data in the target process, thereby avoiding the problem of memory overflow caused by excessive growth of memory usage, thereby improving the stability of system operation.

[0068] Furthermore, the above setting module is also used to: set a marker for data other than the target data in the memory data of the target process; wherein the marker is used to indicate that the child process has no authority to access data other than the target data.

[0069] Furthermore, the above-mentioned setting module is also used to: obtain the memory address and memory size of data other than the target data; set a marker for the data corresponding to the memory address and memory size to mark the data corresponding to the memory address and memory size as: data that the child process has no permission to access.

[0070] Furthermore, the above-mentioned device also includes an access module, which is used to access the memory data of the target process according to the access status when the child process needs to access the memory data of the target process.

[0071] Furthermore, the memory data of the above-mentioned target process includes multiple types; the above-mentioned access module is also used for: for each type of memory data, if the current type of memory data is set with an access status, and the access status indicates that the child process has no authority to access the current type of memory data, denying the child process access to the current type of memory data; if the current type of memory data has no access status, or the set access status indicates that the child process has the authority to access the current type of memory data, writing the current type of memory data into the physical memory corresponding to the child process.

[0072] Furthermore, the above device is also used to cancel the set access status.

[0073] Furthermore, the process tasks of the above sub-process include: a database data backup task; the target data that the above sub-process needs to access includes: database data in the memory data of the target process.

[0074] The device for creating a process provided by the embodiment of the present invention has the same technical features as the method for creating a process provided by the above embodiment, so it can also solve the same technical problems and achieve the same technical effects.

[0075] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned method of creating a process.

[0076] See also Figure 5 As shown, the electronic device includes a processor 100 and a memory 101, wherein the memory 101 stores machine executable instructions that can be executed by the processor 100, and the processor 100 executes the machine executable instructions to implement the above-mentioned method for creating a process.

[0077] Further, Figure 5 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .

[0078] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0079] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the above embodiment in combination with its hardware.

[0080] This embodiment also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned method for creating a process.

[0081] The computer program product of the method, device and electronic device for creating a process provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments and will not be repeated here.

[0082] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0083] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0084] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0085] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0086] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for creating a process, characterized in that: The method comprises: If a child process needs to be created based on the target process, the target data that the child process needs to access is determined from the memory data of the target process according to the process task of the child process; Based on the target data, setting an access status of at least a portion of the memory data of the target process; wherein the access status is used to indicate whether the child process has permission to access the at least a portion of the memory data; Creating the child process based on the target process after setting the access state; The step of setting the access status of at least a portion of the memory data of the target process based on the target data includes: A marker is set for data other than the target data in the memory data of the target process; wherein the marker is used to indicate that the child process has no authority to access data other than the target data.

2. The method according to claim 1, characterized in that: The step of setting a marker for data other than the target data in the memory data of the target process comprises: Obtaining the memory address and memory size of data other than the target data; The marker is set for the data corresponding to the memory address and the memory size, so as to mark the data corresponding to the memory address and the memory size as data that the child process has no permission to access.

3. The method according to claim 1, characterized in that After the step of creating the child process based on the target process after setting the access status, the method further includes: When the child process needs to access the memory data of the target process, the memory data of the target process is accessed according to the access status.

4. The method according to claim 3, characterized in that The memory data of the target process includes multiple types; The step of accessing the memory data of the target process according to the access state comprises: For each type of memory data, if an access status is set for the current type of memory data, and the access status indicates that the child process has no permission to access the current type of memory data, denying the child process access to the current type of memory data; If the memory data of the current type has no access status, or the set access status indicates that the child process has the authority to access the memory data of the current type, the memory data of the current type is written into the physical memory corresponding to the child process.

5. The method according to claim 3, characterized in that: After the step of accessing the memory data of the target process according to the access status, the method further includes: canceling the set access status.

6. The method according to claim 1, characterized in that The process task of the sub-process includes: a database data backup task; the target data that the sub-process needs to access includes: database data in the memory data of the target process.

7. A device for creating a process, characterized in that: The device comprises: A determination module, for determining, if it is necessary to create a subprocess based on a target process, target data that the subprocess needs to access from memory data of the target process according to a process task of the subprocess; A setting module, configured to set an access status of at least a portion of the memory data of the target process based on the target data; wherein the access status is used to indicate whether the child process has permission to access the at least a portion of the memory data; A creation module, used for creating the subprocess based on the target process after setting the access state; Wherein, the setting module is also used for: A marker is set for data other than the target data in the memory data of the target process; wherein the marker is used to indicate that the child process has no authority to access data other than the target data.

8. An electronic device, characterized in that: The invention comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for creating a process according to any one of claims 1 to 6.

9. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method for creating a process as described in any one of claims 1 to 6.