A method, device, equipment and medium for realizing multi-process file sharing

By obtaining the file handle and memory address information of the target file and using the kernel operating system interface for file mapping, the performance loss problem in multi-process file sharing is solved, and efficient file synchronization and sharing is achieved.

CN115309568BActive Publication Date: 2025-11-21DALIAN JIUZHENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210956168.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-10
Publication Date
2025-11-21
Estimated Expiration
2042-08-10

AI Technical Summary

Technical Problem

How to achieve more efficient file sharing between multiple processes, improve the efficiency of the operating system, and avoid performance loss caused by inter-process communication and interaction.

Method used

By obtaining the file handle and memory address information of the target file created by the target process in the disk space, and calling the kernel operating system interface, at least two processes can share the target file based on the file mapping method.

Benefits of technology

It enables fast sharing of the same file among multiple processes, avoids performance loss caused by inter-process communication, and improves the read and write efficiency of the operating system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115309568B_ABST
    Figure CN115309568B_ABST
Patent Text Reader

Abstract

The application discloses a kind of method, device, equipment and medium for realizing multi-process file sharing.The method comprises: obtaining target file created by target process in disk space, and obtaining file handle of the target file and memory address information of target file in target process memory space;Wherein, the target process is the first process started in at least two processes;According to the file handle and the memory address information, call kernel operating system interface, based on file mapping mode, realize the sharing of the target file by the at least two processes.The scheme provided by the application can quickly realize the sharing of the same file between multiple processes through file mapping mode, and avoid the performance loss caused by communication interaction between processes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computers, and in particular to a method, apparatus, device, and medium for realizing multi-process file sharing. Background Technology

[0002] When multiple processes interact with an operating system, such as an exo-kernel operating system and a kernel operating system, it is often necessary to synchronize the data in files on the disk or the data generated during process execution in order to ensure the normal operation of the system.

[0003] How to achieve more efficient file sharing between multiple processes, enabling file or data synchronization between multiple processes and improving the operating system's efficiency, is a problem that urgently needs to be solved. Summary of the Invention

[0004] This invention provides a method, apparatus, device, and medium for multi-process file sharing, which can quickly enable multiple processes to share the same file and avoid performance loss caused by inter-process communication.

[0005] According to one aspect of the present invention, a method for implementing multi-process file sharing is provided, comprising:

[0006] Obtain the target file created by the target process in the disk space, and obtain the file handle of the target file and the memory address information of the target file in the memory space of the target process; wherein, the target process is the first process to start among at least two processes;

[0007] Based on the file handle and memory address information, the kernel operating system interface is invoked to achieve file sharing between at least two processes using a file mapping method.

[0008] According to another aspect of the present invention, an apparatus for implementing multi-process file sharing is provided, comprising:

[0009] The acquisition module is used to acquire the target file created by the target process in the disk space, and to acquire the file handle of the target file and the memory address information of the target file in the memory space of the target process; wherein, the target process is the first process to start among at least two processes;

[0010] The sharing module is used to invoke the kernel operating system interface based on the file handle and the memory address information, and to achieve sharing of the target file by at least two processes based on file mapping.

[0011] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0012] At least one processor; and

[0013] A memory communicatively connected to the at least one processor; wherein,

[0014] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the method for implementing multi-process file sharing as described in any embodiment of the present invention.

[0015] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the method for implementing multi-process file sharing as described in any embodiment of the present invention.

[0016] The technical solution of this invention obtains the target file created in the disk space by the first target process launched among at least two processes, and obtains the file handle and memory address information of the target file in the target process's memory space. Based on the file handle and memory address information, it calls the kernel operating system interface and, based on a file mapping method, enables at least two processes to share the target file. By using file mapping, each process stores the target file at the same location in its own memory space, which can quickly achieve sharing of the same file among multiple processes and avoid the performance loss caused by inter-process communication.

[0017] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart of a method for implementing multi-process file sharing provided in Embodiment 1 of the present invention;

[0020] Figure 2 This is a flowchart of a method for implementing multi-process file sharing provided in Embodiment 2 of the present invention;

[0021] Figure 3 This is a flowchart of a method for implementing multi-process file sharing provided in Embodiment 3 of the present invention;

[0022] Figure 4 This is a structural diagram of the apparatus for implementing multi-process file sharing provided in Embodiment 4 of the present invention;

[0023] Figure 5 This is a schematic diagram of the structure of the electronic device provided in Embodiment 5 of the present invention. Detailed Implementation

[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0025] It should be noted that the terms "first," "second," "target," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0026] In related technologies, the process of an application reading a file on the disk is as follows: each process in the application requests the kernel through the system interface; the kernel inserts the request into the request queue; then the application sleeps; the kernel schedules the request queue, sends a data read request to the hard disk; after returning the data, it wakes up the application, and the application returns to the user layer. This invention introduces an external kernel operating system running in user mode, namely the libos operating system (library operating system, network library operating system), between the application's processes and the kernel operating system. libos is essentially a function library. Each process managed by the kernel operating system pre-loads a copy of libos. When a process issues a request to process a disk file, the libos operating system acts as an agent for the kernel operating system, integrating the requests and sending file update requests to the kernel operating system. The kernel operating system then operates on the corresponding file stored on the disk space, for example, writing new data to the file stored on the disk space.

[0027] libos has many advantages, but also some disadvantages, the most significant being its single-process limitation. Once a process loads libos, all system operations of that process pass through it. Therefore, while it can completely record and control the state of its own process, it has no control over other processes. This means libos can only manage a single process. To address this issue, related technologies involve each managed process loading a copy of libos. Processes then synchronize data, such as open files, threads, and process data, through libos. This allows each managed process to share a unified state, forming a multi-process management scheme. While this solution solves the single-process problem, it introduces performance overhead in inter-process communication and increased code complexity.

[0028] This invention considers mapping the libos data area to a fixed location in the address space of each managed process, performing synchronization during memory operations, thereby achieving data sharing between libos processes, with clean code and no inter-process communication overhead. The method for multi-process file sharing provided in this invention is based on memory mapping technology. Specifically, memory-mapped I / O maps data from disk files to memory, allowing users to modify disk files by modifying memory. Direct memory manipulation results in high efficiency. Each process has its own virtual address space. By ensuring that each process stores the same file at the same location in its virtual address space, it is possible to achieve file synchronization and sharing between processes when any process performs operations on that file without communicating with other processes. The specific implementation method is described in detail in the following embodiments of this invention.

[0029] Example 1

[0030] Figure 1 This is a flowchart of a method for implementing multi-process file sharing according to Embodiment 1 of the present invention. This embodiment is applicable to situations where files of at least two processes are synchronously shared. This method can be executed by a device for implementing multi-process file sharing. This device can be implemented in software and / or hardware and can be integrated into an electronic device that has the function of implementing multi-process file sharing. Figure 1 As shown, the method includes:

[0031] S101. Obtain the target file created by the target process in the disk space, and obtain the file handle of the target file and the memory address information of the target file in the target process's memory space.

[0032] In this context, the target process is the process within the operating system that creates the temporary file. The target file is the temporary file created by the target process and is stored on disk. A file handle is a unique sequence number that identifies the target file. Memory space refers to the process's memory space; each process has its own dedicated memory space. Memory address information refers to the address information in the process's memory where the target file is stored. Specifically, the memory address information where the target file is stored can be determined from the process's address space. For example, the target process can determine the memory address information as 0x7fffffff from its address space.

[0033] Optionally, the process mentioned in the embodiments of the present invention may refer to an application process, such as a browser process, a media player process, or other processes running in user mode.

[0034] Optionally, the target process can be the first process to start among at least two processes, or it can be determined in advance from among the processes managed by the operating system based on preset filtering rules, such as the functions implemented by different processes.

[0035] Optionally, the kernel operating system can open the target file through a system call after the target process starts and creates a temporary file (i.e., the target file), thus obtaining the target file created by the target process in the disk space.

[0036] Optionally, the kernel operating system can obtain the file handle of the target file after the target process starts and creates a temporary file (i.e., the target file). Specifically, if at least two processes detect calls to kernel operating system functions by the target process, the kernel can obtain the name of the target file sent by the target process and the memory address information of the target file in the target process's memory space; and obtain the file handle of the target file based on the name and memory address information of the target file.

[0037] Optionally, the kernel operating system can call relevant interfaces to directly obtain the memory address information corresponding to the target file stored in the target process's address space, that is, obtain the memory address information of the target file in the target process's memory space.

[0038] S102. Based on the file handle and memory address information, call the kernel operating system interface to achieve sharing of the target file by at least two processes based on file mapping.

[0039] The kernel operating system refers to the operating system running in kernel mode; for example, it could be a Linux operating system or a Windows operating system. File mapping refers to the way the operating system maps a target file into memory in one go. File mapping can be a Linux file mapping method. Essentially, file mapping maps data from a disk file into memory.

[0040] Optionally, after the kernel operating system obtains the target file, file handle, and memory address information, it can call the kernel operating system interface based on the file handle and memory address information to map the target file to the same process address space location of all other processes through file mapping, that is, to the location corresponding to the memory address information of each process.

[0041] It should be noted that file mapping can effectively improve the read and write efficiency of the operating system and reduce the time and frequency of input and output data.

[0042] It should be noted that, through the solution of this embodiment of the invention, all processes can store the same memory address of the target file, that is, the corresponding disk file is the same. Therefore, each process does not need to interact and synchronize with itself, avoiding the cumbersome code required for establishing communication channels between processes for synchronization, thereby achieving the best performance of shared data.

[0043] The technical solution of this invention obtains the target file created in the disk space by the first target process launched among at least two processes, and obtains the file handle and memory address information of the target file in the target process's memory space. Based on the file handle and memory address information, it calls the kernel operating system interface and, based on a file mapping method, enables at least two processes to share the target file. By using file mapping, each process stores the target file at the same location in its own memory space, which can quickly achieve sharing of the same file among multiple processes and avoid the performance loss caused by inter-process communication.

[0044] Example 2

[0045] Figure 2 This is a flowchart of a method for implementing multi-process file sharing provided in Embodiment 2 of the present invention. Based on the above embodiments, this embodiment further explains in detail the process of "calling the kernel operating system interface based on file handle and memory address information, and implementing file sharing of the target file by at least two processes based on file mapping," as follows: Figure 2 As shown, the method includes:

[0046] S201. Obtain the target file created by the target process in the disk space, and obtain the file handle of the target file and the memory address information of the target file in the memory space of the target process.

[0047] S202. Call the kernel operating system interface, determine the target file from the disk space based on the file handle, and obtain the disk address information of the target file.

[0048] Here, disk space refers to the actual space where the operating system stores files. Disk address information refers to the address information of the target file stored on the disk.

[0049] Optionally, after obtaining the target file created by the target process in the disk space, and obtaining the file handle and memory address information of the target file in the target process's memory space, the kernel operating system can call the kernel operating system interface to match the file handle in the disk space, determine the target file and the address information where the target file is stored, that is, determine the target file from the disk space and obtain the disk address information of the target file.

[0050] S203. Map the disk address information of the target file to the memory address information in the memory space of other processes, so that the memory address information of the target file is the same in at least two processes, thereby realizing the sharing of the target file by at least two processes.

[0051] It should be noted that, through the steps of S201-203 of the present invention, the memory address information of the target file in each process can be the same. For example, process A stores the target file at address 0x7fffffff in the corresponding memory space A, and process B stores the target file at address 0x7fffffff in the corresponding memory space B. That is, the memory address information of the target file is the same in at least two processes.

[0052] Optionally, after the kernel operating system determines the disk address information of the target file, it can map the disk address information of the target file to the corresponding memory address information in the memory space of other processes based on the memory address information of the target process, so that the memory address information of the target file is the same in at least two processes, thereby realizing the sharing of the target file by at least two processes.

[0053] The technical solution of this invention involves obtaining the target file created by the target process in the disk space, and then obtaining the file handle and memory address information of the target file in the target process's memory space. Next, it calls the kernel operating system interface to determine the target file from the disk space based on the file handle, obtaining the target file's disk address information. Finally, it maps the target file's disk address information to the memory address information in the memory spaces of other processes, ensuring that the target file's memory address information is the same in at least two processes, thus enabling at least two processes to share the target file. This invention provides a feasible implementation for sharing a target file between at least two processes, allowing each process to store the target file at the same location in its own memory space. This enables rapid sharing of the same file between multiple processes and avoids performance degradation caused by inter-process communication.

[0054] Example 3

[0055] Figure 3 This is a flowchart of a method for implementing multi-process file sharing provided in Embodiment 3 of the present invention. Based on the above embodiments, this embodiment further explains in detail how to achieve process state synchronization when at least two processes are processing a target file. Figure 3 As shown, the method includes:

[0056] S301. Obtain the target file created by the target process in the disk space, and obtain the file handle of the target file and the memory address information of the target file in the target process's memory space.

[0057] S302. Based on the file handle and memory address information, call the kernel operating system interface to achieve sharing of the target file by at least two processes based on file mapping.

[0058] S303. In response to the processing operations of at least two processes on the target file, the processing data of the at least two processes on the target file is integrated using the external kernel operating system to obtain the data to be updated in the target file.

[0059] In this context, "processing operation" refers to the actions performed by a process on a target file. Specifically, processing operations can include at least one of reading, modifying, and deleting. The outer kernel operating system, also known as the library operating system, runs in user mode and has lower privileges than the kernel operating system. The outer kernel operating system itself is a function library or code library that integrates the operations of various processes and acts as a proxy for interactions between processes and the kernel operating system. For example, the outer kernel operating system could be libos. "Data to be updated" refers to newly generated data after processing the target file.

[0060] Optionally, each process can perform processing operations on the target file. After each process performs processing operations on the target file, the outer kernel operating system can compare the original target file with the target file after the processing operations are performed to determine the processing data of each process on the target file, and integrate the processing data to obtain the data to be updated in the target file.

[0061] S304: Call the kernel operating system interface to synchronize the data to be updated to the disk space.

[0062] Optionally, the kernel operating system can receive a file update request sent to the kernel operating system after the outer kernel operating system has determined the data to be updated, and call the corresponding kernel operating system interface according to the file update request to synchronize the data to be updated to the target file corresponding to the disk space. That is, call the kernel operating system interface to synchronize the data to be updated to the disk space.

[0063] S305. Based on the memory address information of the target file in each process, synchronize the data to be updated to each process.

[0064] Optionally, after the kernel operating system determines that the target file on the disk space has been updated, it can synchronize the data to be updated to each process based on the memory address information of the target file in each process, thereby realizing the synchronization of the operation status of each process on the target file.

[0065] It should be noted that, by enabling each process to map the same memory to the same location in its own address space, and uniformly allocating the memory used by libos to the same commonly mapped memory area, this embodiment of the invention can achieve the following: all managed processes use the same memory at the same address; all managed processes use the same memory block (i.e., through the Linux file mapping method described in the above embodiment of the invention, since it is the same file, the memory is the same); and all managed processes use the same memory because the memory address is the same, so there is no need for synchronization, nor is there any cumbersome code required for synchronization, achieving the best performance for shared data.

[0066] The technical solution of this invention, based on file handle and memory address information, calls the kernel operating system interface to achieve file sharing between at least two processes using a file mapping method. In response to the processing operations of the at least two processes on the target file, the outer kernel operating system integrates the processing data of the at least two processes to obtain the data to be updated in the target file. The kernel operating system interface is then called to synchronize the data to be updated to disk space. Based on the memory address information of the target file in each process, the data to be updated is synchronized to each process. In this way, after at least one process operates on the file, all other processes can synchronously perceive the file changes, thus achieving multi-process file sharing and avoiding the performance loss caused by synchronization through interaction between processes.

[0067] Example 4

[0068] Figure 4 This is a structural diagram of the apparatus for implementing multi-process file sharing provided in Embodiment 4 of the present invention. The apparatus for implementing multi-process file sharing provided in the embodiments of the present invention can execute the method for implementing multi-process file sharing provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method.

[0069] like Figure 4 As shown, the device includes:

[0070] The acquisition module 401 is used to acquire the target file created by the target process in the disk space, and to acquire the file handle of the target file and the memory address information of the target file in the memory space of the target process; wherein, the target process is the first process to start among at least two processes;

[0071] The sharing module 402 is used to call the kernel operating system interface based on the file handle and the memory address information to realize the sharing of the target file by at least two processes based on the file mapping method.

[0072] The technical solution of this invention obtains the target file created in the disk space by the first target process launched among at least two processes, and obtains the file handle and memory address information of the target file in the target process's memory space. Based on the file handle and memory address information, it calls the kernel operating system interface and, based on a file mapping method, enables at least two processes to share the target file. By using file mapping, each process stores the target file at the same location in its own memory space, which can quickly achieve sharing of the same file among multiple processes and avoid the performance loss caused by inter-process communication.

[0073] Furthermore, the shared module 402 is specifically used for:

[0074] The kernel operating system interface is invoked to determine the target file from the disk space based on the file handle, and the disk address information of the target file is obtained.

[0075] The disk address information of the target file is mapped to the memory address information in the memory space of other processes, so that the memory address information of the target file is the same in the at least two processes, thereby realizing the sharing of the target file by the at least two processes.

[0076] Furthermore, the acquisition module 401 is specifically used for:

[0077] If calls to kernel operating system functions by the target process are detected in at least two processes, then the name of the target file sent by the target process and the memory address information of the target file in the target process's memory space are obtained.

[0078] Based on the name of the target file and the memory address information, obtain the file handle of the target file.

[0079] Furthermore, the above-mentioned device is also used for:

[0080] In response to the processing operations of at least two processes on the target file, the processing data of the at least two processes on the target file is integrated using the external kernel operating system to obtain the data to be updated in the target file;

[0081] Call the kernel operating system interface to synchronize the data to be updated to the disk space;

[0082] Based on the memory address information of the target file in each process, the data to be updated is synchronized to each process.

[0083] Furthermore, the processing operations include at least one of reading, modifying, and deleting.

[0084] Furthermore, the kernel operating system is the Linux operating system; the outer kernel operating system is the libos operating system.

[0085] Example 5

[0086] Figure 5 This is a schematic diagram of the structure of the electronic device provided in Embodiment 5 of the present invention. Figure 5 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0087] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0088] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0089] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as methods for implementing multi-process file sharing.

[0090] In some embodiments, the method for implementing multi-process file sharing can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the method for implementing multi-process file sharing described above can be performed. Alternatively, in other embodiments, processor 11 can be configured by any other suitable means (e.g., by means of firmware) to execute the method for implementing multi-process file sharing, the method comprising: obtaining a target file created by a target process in disk space, and obtaining a file handle of the target file and memory address information of the target file in the memory space of the target process; wherein the target process is the first process started among at least two processes; and, based on the file handle and the memory address information, calling a kernel operating system interface to implement the sharing of the target file by the at least two processes based on a file mapping method. The solution provided by the present invention can quickly realize the sharing of the same file between multiple processes through file mapping, avoiding the performance loss caused by inter-process communication interaction.

[0091] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0092] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0093] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0094] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0095] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0096] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0097] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0098] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A method for implementing multi-process file sharing, characterized in that, include: Obtain the target file created by the target process in the disk space, and obtain the file handle of the target file and the memory address information of the target file in the memory space of the target process; wherein, the target process is the first process to start among at least two processes; Based on the file handle and the memory address information, the kernel operating system interface is invoked to achieve the sharing of the target file by at least two processes based on the file mapping method; Based on the file handle and the memory address information, the kernel operating system interface is invoked to achieve sharing of the target file by at least two processes using a file mapping method, including: The kernel operating system interface is invoked to determine the target file from the disk space based on the file handle, and the disk address information of the target file is obtained. The disk space is the space in the operating system used to store files, and the disk address information is the address information of the target file stored in the disk space. The disk address information of the target file is mapped to the memory address information in the memory space of other processes, so that the memory address information of the target file is the same in the at least two processes, thereby realizing the sharing of the target file by the at least two processes.

2. The method according to claim 1, characterized in that, Obtaining the file handle of the target file includes: If calls to kernel operating system functions by the target process are detected in at least two processes, then the name of the target file sent by the target process and the memory address information of the target file in the target process's memory space are obtained. Based on the name of the target file and the memory address information, obtain the file handle of the target file.

3. The method according to claim 1, characterized in that, Also includes: In response to the processing operations of at least two processes on the target file, the processing data of the at least two processes on the target file is integrated using the external kernel operating system to obtain the data to be updated in the target file; Call the kernel operating system interface to synchronize the data to be updated to the disk space; Based on the memory address information of the target file in each process, the data to be updated is synchronized to each process.

4. The method according to claim 3, characterized in that, in, The processing operations include at least one of reading, modifying, and deleting.

5. The method according to claim 3, characterized in that, in, The kernel operating system is the Linux operating system; the outer kernel operating system is the libos operating system.

6. An apparatus for implementing multi-process file sharing, characterized in that, include: The acquisition module is used to acquire the target file created by the target process in the disk space, and to acquire the file handle of the target file and the memory address information of the target file in the memory space of the target process; wherein, the target process is the first process to start among at least two processes; The sharing module is used to call the kernel operating system interface based on the file handle and the memory address information, and to realize the sharing of the target file by the at least two processes based on the file mapping method; The shared module includes: The unit is used to call the kernel operating system interface, determine the target file from the disk space based on the file handle, and obtain the disk address information of the target file. The disk space is the space in the operating system used to store files, and the disk address information is the address information of the target file stored in the disk space. The sharing unit is used to map the disk address information of the target file to the memory address information in the memory space of other processes, so that the memory address information of the target file is the same in the at least two processes, thereby realizing the sharing of the target file by the at least two processes.

7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the method for implementing multi-process file sharing as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the method for achieving multi-process file sharing as described in any one of claims 1-5.