WO2024060193A1 - Operation method and apparatus applied to computer device, and computer device - Google Patents

Operation method and apparatus applied to computer device, and computer device Download PDF

Info

Publication number
WO2024060193A1
WO2024060193A1 PCT/CN2022/120849 CN2022120849W WO2024060193A1 WO 2024060193 A1 WO2024060193 A1 WO 2024060193A1 CN 2022120849 W CN2022120849 W CN 2022120849W WO 2024060193 A1 WO2024060193 A1 WO 2024060193A1
Authority
WO
WIPO (PCT)
Prior art keywords
request
kernel
memory
response
computer
Prior art date
Application number
PCT/CN2022/120849
Other languages
French (fr)
Chinese (zh)
Inventor
葛世飞
秦涛
邵俊骏
张文
司马云瑞
Original Assignee
宇龙计算机通信科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 宇龙计算机通信科技(深圳)有限公司 filed Critical 宇龙计算机通信科技(深圳)有限公司
Priority to PCT/CN2022/120849 priority Critical patent/WO2024060193A1/en
Publication of WO2024060193A1 publication Critical patent/WO2024060193A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning

Definitions

  • the present application relates to the field of computer technology, and more specifically, to an operating method, device and computer equipment applied to computer equipment.
  • Embodiments of the present application provide an operating method, device and computer equipment applied to computer equipment.
  • the operating method enables the application program of the computer equipment to respond to a request initiated by the kernel of the computer equipment, thereby enabling the computer kernel to actively send requests to the application.
  • the program transmits data, for example, it can be used in scenarios such as applications transmitting cloud disk data to cloud disks, etc., which improves the user's experience of using computer equipment.
  • a first aspect provides an operating method applied to a computer device.
  • the operating method is applied to an application layer of the computer device.
  • the operating method includes: detecting whether there is a first request in the kernel, and the first request needs to be sent to the application. layer's request; when detecting that the first request exists in the core, read the first request; in response to the first request, send a first response to the core.
  • the method before sending a first response to the kernel in response to the first request, the method further includes: executing a first operation corresponding to the first request.
  • each of the one or more pending requests corresponds to an operation.
  • One or more pending requests include a first request, which refers to a pending request with a pending order of 1 in the kernel request list. Therefore, as long as there is a pending request in the kernel request list, there must be a first request. request, where the kernel request linked list is located in the kernel of the computer device and is used to store pending requests.
  • the first request may include any one of a read request, a write request, and a delete request.
  • the first request may also include any other form of request, which is not limited in this application.
  • the kernel of the computer device can initiate a request, and the application program of the computer device can respond to the request, thereby enabling the computer kernel to actively transmit data to the application program.
  • the application program of the computer device can respond to the request, thereby enabling the computer kernel to actively transmit data to the application program.
  • it can be applied to the application program transmitting data to a cloud disk. Scenarios such as cloud disk data.
  • detecting whether the first request exists in the kernel includes: detecting whether the first request exists in the kernel request linked list by calling the poll function, and the kernel request linked list is located in the kernel.
  • reading the first request includes: reading the first request by calling a read function.
  • sending the first response to the kernel includes: sending the first response to the kernel by calling an ioctl function.
  • the first request in the kernel is further read by calling the read function. After reading the first request, the first request phase is executed. The corresponding first operation is then passed to the kernel by calling the ioctl function in response to the first request.
  • This solution combines the poll function, read function and ioctl function to enable the computer kernel to actively transmit data to the application. For example, it can be applied to scenarios such as applications transmitting cloud disk data to cloud disks.
  • the method further includes: when detecting that the first request does not exist in the kernel, blocking the kernel request list and waiting for the first request.
  • the kernel request list when there is no pending request in the kernel, the kernel request list is blocked, and when there is a pending request in the kernel request list, the read function is called to read the request. In this way, it is equivalent to requesting the kernel.
  • the pending requests in the linked list are monitored and read immediately once they exist, which can improve the operating performance of the computer equipment.
  • the method further includes: in response to the first request, generating first response data.
  • the first response data refers to the response data generated after the application layer performs the first operation corresponding to the first request.
  • the first response data may be corresponding read data.
  • the first response includes the first response data.
  • the first response data is directly passed to the kernel (for example, copied from the application layer to the kernel), so that the kernel can further perform subsequent operations based on the first response data.
  • the method further includes: caching the first response data in a first memory, where the first memory is a virtual memory located in the user layer, and the first response includes a first response
  • the first response code includes first indication information, and the first indication information is used to indicate that the first response data exists in the first memory.
  • the first memory may be buf.
  • the first memory has a mapping relationship with a second memory, and the second memory is located in the core.
  • the second memory is used by the core to determine that the first memory exists in the first memory according to the first indication information.
  • When responding to data read the first response data.
  • the second memory may specifically be pages, and one page corresponds to one buf.
  • a mapping relationship is established between the second memory located in the kernel and the first memory (for example: buf) located in the application layer, so that the data stored in the first memory is presented in the form of a page in the second memory.
  • the first memory and the second memory are essentially the same memory. Reading and writing the second memory is equivalent to reading and writing the first memory. Therefore, the kernel can directly read the data of the application layer without the need to transfer the data from the application layer.
  • the layer is copied to the kernel for reading or processing, which can significantly save the performance overhead of computer equipment; moreover, the mapping speed can also be controlled through the mapping management module, which can avoid a large number of mappings from occupying too much memory.
  • a second aspect provides an operating method applied to a computer device.
  • the operating method is applied to the kernel of the computer device.
  • the operating method includes: generating a first request, which is a request that needs to be sent to the application layer; receiving the application When the layer detects that the first request exists in the kernel, it sends a first response in response to the first request.
  • each of the one or more pending requests corresponds to an operation.
  • One or more pending requests include a first request, which refers to a pending request with a pending order of 1 in the kernel request list. Therefore, as long as there is a pending request in the kernel request list, there must be a first request. request, where the kernel request linked list is located in the kernel of the computer device and is used to store pending requests.
  • the first request may include any one of a read request, a write request, and a delete request.
  • the first request may also include any other form of request, which is not limited in this application.
  • the kernel of the computer device can initiate a request, and the application program of the computer device can respond to the request, thereby enabling the computer kernel to actively transmit data to the application program.
  • the application program of the computer device can respond to the request, thereby enabling the computer kernel to actively transmit data to the application program.
  • it can be applied to the application program transmitting data to a cloud disk. Scenarios such as cloud disk data.
  • the first response received by the kernel is sent by the application layer by calling the ioctl function.
  • the first response includes the first response data.
  • the first response data refers to the response data generated after the application layer performs the first operation corresponding to the first request.
  • the first response data may be corresponding read data.
  • the application layer after the application layer generates the first response data, it directly transfers the first response data to the kernel (for example, copies it from the application layer to the kernel), so that the kernel can further perform subsequent operations based on the first response data.
  • the kernel for example, copies it from the application layer to the kernel
  • the first response includes a first response code
  • the first response code includes first indication information
  • the first indication information is used to indicate that the first response code exists in the first memory.
  • Response data wherein the first memory is a virtual memory located in the user layer, and the first memory is used by the user layer to cache the first response data.
  • the first memory may be buf.
  • the first response data is obtained by reading the second memory, which is located in the core and is related to The first memory has a mapping relationship.
  • the second memory may specifically be pages, and one page corresponds to one buf.
  • a mapping relationship is established between the second memory located in the kernel and the first memory (for example: buf) located in the application layer, so that the data stored in the first memory is presented in the form of a page in the second memory.
  • the first memory and the second memory are essentially the same memory. Reading and writing the second memory is equivalent to reading and writing the first memory. Therefore, the kernel can directly read the data of the application layer without the need to transfer the data from the application layer.
  • the layer is copied to the kernel for reading or processing, which can significantly save the performance overhead of computer equipment; moreover, the mapping speed can also be controlled through the mapping management module, which can avoid a large number of mappings from occupying too much memory.
  • an operating device for computer equipment is provided.
  • the operating device is located at the application layer of the computer equipment.
  • the operating device includes: a detection module for detecting whether there is a first request in the kernel.
  • the first request is required A request sent to the application layer; a first acquisition module, used to read the first request when detecting that the first request exists in the kernel; a processing module, used to respond to the first request, send a request to the kernel First response.
  • the processing module is also configured to perform the first operation corresponding to the first request.
  • each of the one or more pending requests corresponds to an operation.
  • One or more pending requests include a first request, which refers to a pending request with a pending order of 1 in the kernel request list. Therefore, as long as there is a pending request in the kernel request list, there must be a first request. request, where the kernel request linked list is located in the kernel of the computer device and is used to store pending requests.
  • the first request may include any one of a read request, a write request, and a delete request.
  • the first request may also include any other form of request, which is not limited in this application.
  • the kernel of the computer device can initiate a request, and the application program of the computer device can respond to the request, thereby enabling the computer kernel to actively transmit data to the application program.
  • the application program of the computer device can respond to the request, thereby enabling the computer kernel to actively transmit data to the application program.
  • it can be applied to the application program transmitting data to a cloud disk. Scenarios such as cloud disk data.
  • the detection module is specifically configured to: detect whether the first request exists in the kernel request linked list by calling the poll function, and the kernel request linked list is located in the kernel.
  • the first acquisition module is specifically used to: read the first request by calling a read function.
  • the processing module is specifically configured to: send the first response to the kernel by calling an ioctl function.
  • the first request in the kernel is further read by calling the read function. After reading the first request, the first request phase is executed. The corresponding first operation is then passed to the kernel by calling the ioctl function in response to the first request.
  • This solution combines the poll function, read function and ioctl function to enable the computer kernel to actively transmit data to the application. For example, it can be applied to scenarios such as applications transmitting cloud disk data to cloud disks.
  • the detection module is also specifically configured to: when detecting that the first request does not exist in the kernel, block the kernel request list and wait for the first request.
  • the kernel request list when there is no pending request in the kernel, the kernel request list is blocked, and when there is a pending request in the kernel request list, the read function is called to read the request. In this way, it is equivalent to requesting the kernel.
  • the pending requests in the linked list are monitored and read immediately once they exist, which can improve the operating performance of the computer equipment.
  • the processing module is further configured to: generate first response data in response to the first request.
  • the first response data refers to the response data generated after the application layer performs the first operation corresponding to the first request.
  • the first response data may be corresponding read data.
  • the first response includes the first response data.
  • the application layer after the application layer generates the first response data, it directly transfers the first response data to the kernel (for example, copies it from the application layer to the kernel), so that the kernel can further perform subsequent operations based on the first response data.
  • the kernel for example, copies it from the application layer to the kernel
  • the processing module is further configured to: cache the first response data in a first memory, where the first memory is a virtual memory located in the user layer, and the first response includes the first response data.
  • a response code the first response code includes first indication information, the first indication information is used to indicate that the first response data exists in the first memory.
  • the first memory may be buf.
  • the first memory has a mapping relationship with a second memory, and the second memory is located in the core.
  • the second memory is used by the core to determine that the first memory exists in the first memory according to the first indication information.
  • When responding to data read the first response data.
  • the second memory may specifically be pages, and one page corresponds to one buf.
  • a mapping relationship is established between the second memory located in the kernel and the first memory (for example: buf) located in the application layer, so that the data stored in the first memory is presented in the form of a page in the second memory.
  • the first memory and the second memory are essentially the same memory. Reading and writing the second memory is equivalent to reading and writing the first memory. Therefore, the kernel can directly read the data of the application layer without the need to transfer the data from the application layer.
  • the layer is copied to the kernel for reading or processing, which can significantly save the performance overhead of computer equipment; moreover, the mapping speed can also be controlled through the mapping management module, which can avoid a large number of mappings from occupying too much memory.
  • the fourth aspect provides an operating device applied to computer equipment.
  • the operating device is located in the core of the computer equipment.
  • the operating device includes: a generating module for generating a first request.
  • the first request is a request that needs to be sent to the application layer.
  • Request a second acquisition module, configured to receive a first response sent by the application layer in response to the first request when detecting that the first request exists in the kernel.
  • each of the one or more pending requests corresponds to an operation.
  • One or more pending requests include a first request, which refers to a pending request with a pending order of 1 in the kernel request list. Therefore, as long as there is a pending request in the kernel request list, there must be a first request. request, where the kernel request linked list is located in the kernel of the computer device and is used to store pending requests.
  • the first request may include any one of a read request, a write request, and a delete request.
  • the first request may also include any other form of request, which is not limited in this application.
  • the kernel of the computer device can initiate a request, and the application program of the computer device can respond to the request, thereby enabling the computer kernel to actively transmit data to the application program.
  • the application program of the computer device can respond to the request, thereby enabling the computer kernel to actively transmit data to the application program.
  • it can be applied to the application program transmitting data to a cloud disk. Scenarios such as cloud disk data.
  • the first response received by the kernel is sent by the application layer by calling the ioctl function.
  • the first response includes the first response data.
  • the first response data refers to the response data generated after the application layer performs the first operation corresponding to the first request.
  • the first response data may be corresponding read data.
  • the application layer after the application layer generates the first response data, it directly transfers the first response data to the kernel (for example, copies it from the application layer to the kernel), so that the kernel can further perform subsequent operations based on the first response data.
  • the kernel for example, copies it from the application layer to the kernel
  • the first response includes a first response code
  • the first response code includes first indication information
  • the first indication information is used to indicate that the first response code exists in the first memory.
  • Response data wherein the first memory is a virtual memory located in the user layer, and the first memory is used by the user layer to cache the first response data.
  • the first memory may be buf.
  • the second acquisition module is specifically configured to: when it is determined that the first response data exists in the first memory according to the first indication information, obtain the first response data by reading the second memory, and the second The memory is located in the core and has a mapping relationship with the first memory.
  • the second memory may specifically be pages, and one page corresponds to one buf.
  • a mapping relationship is established between a second memory located in the kernel and a first memory (for example: buf) located in the application layer, so that the data stored in the first memory is presented in the second memory in the form of pages.
  • the first memory and the second memory are essentially the same block of memory, and reading and writing the second memory is equivalent to reading and writing the first memory. Therefore, the kernel can directly read the data of the application layer, and there is no need to copy the data from the application layer to the kernel for reading or processing, which can significantly save the performance overhead of the computer device; and the mapping speed can also be controlled through the mapping management module, which can avoid a large number of mappings occupying too much memory.
  • a fifth aspect provides an operating device applied to computer equipment, including: a processor and a memory, the memory is used to store a program, and the processor is used to call and run the program from the memory to execute the first aspect or any of the first aspects.
  • a computer device including: an operating device applied to the computer device as in the third aspect or any of the possible implementations of the third aspect, or including an operating device as in the fourth aspect or any of the fourth aspects.
  • An operating device applied to computer equipment in a possible implementation may include an operating device applied to computer equipment as in the fifth aspect.
  • a computer-readable storage medium comprising a computer program.
  • the computer program runs on a computer, the computer executes an operating method applied to a computer device as in the first aspect or any possible implementation of the first aspect, or executes an operating method applied to a computer device as in the second aspect or any possible implementation of the second aspect.
  • Figure 1 is a schematic frame diagram of a computer device provided by an embodiment of the present application.
  • Figure 2 is another schematic frame diagram of a computer device provided by an embodiment of the present application.
  • FIG. 3 is a schematic flow chart of an operating method applied to a computer device provided by an embodiment of the present application.
  • FIG. 4 is a schematic flow diagram of another operating method applied to a computer device provided by an embodiment of the present application.
  • FIG. 5 is a schematic flow diagram of another operating method applied to a computer device provided by an embodiment of the present application.
  • FIG. 6 is a schematic flow chart of a method for a kernel to read first response data provided by an embodiment of the present application.
  • Figure 7 is a schematic diagram of the composition of a first request encoding provided by an embodiment of the present application.
  • Figure 8 is a schematic diagram of the composition of a first response encoding provided by an embodiment of the present application.
  • FIG. 9 is a schematic flow chart of an operating method applied to a computer device provided by an embodiment of the present application.
  • FIG. 10 is a schematic structural block diagram of an operating device applied to computer equipment provided by an embodiment of the present application.
  • FIG. 11 is a schematic frame diagram of another operating device applied to computer equipment provided by an embodiment of the present application.
  • Figure 12 is a schematic structural block diagram of a computer device provided by an embodiment of the present application.
  • FIG. 13 is a schematic diagram of an application scenario of an operating method applied to a computer device provided by an embodiment of the present application.
  • FIG. 14 is a schematic frame diagram of another operating device applied to computer equipment provided by an embodiment of the present application.
  • the operating methods applied to computer equipment provided by the embodiments of the present application can be applied to computer equipment.
  • the computer device is a handheld device such as a smartphone, or a terminal device such as a personal computer, which is not particularly limited in this application.
  • the execution subject of the operating method applied to the computer device provided by the embodiment of the present application may be the computer device, or a functional module in the computer device.
  • Figure 1 shows a schematic framework diagram of a computer device 1 provided by an embodiment of the present application.
  • the computer device 1 includes: a hardware layer 10 , an operating system layer 20 running on the hardware layer 10 , and an application layer 30 running on the operating system layer 20 .
  • the hardware layer 10 includes hardware such as processors, memory, and external storage.
  • the operating system layer 20 is any one or more computer operating systems that implement business processing through processes, such as Linux operating system, Unix operating system, Android operating system, iOS operating system or Windows operating system, etc.
  • the application layer 30 includes application programs such as browsers, address books, word processing software, and instant messaging software.
  • the operating system layer 20 includes a kernel (Kernel) 201, which is the core of the operating system layer 20 and is responsible for managing the system's processes, memory, device drivers, files, network systems, etc., and determines the performance and stability of the system.
  • the kernel 201 is a bridge connecting the application layer 30 and the hardware layer 10 .
  • Figure 2 shows another schematic frame diagram of the computer device 1 provided by the embodiment of the present application.
  • the application program (Application, APP) 301 is a computer program in the application layer 30. It is located in the user space (User Space) of the computer device 1 and can be used and designed by the user.
  • User Space User Space
  • the kernel 201 in the operating system layer 20 is located in the kernel space (Kernel Space) of the computer device 1 .
  • the kernel 201 is independent of user-level applications.
  • the kernel 201 has access to protected memory space and has full access to underlying hardware devices.
  • the operating system layer 20 generally forces user processes not to directly operate the kernel 201.
  • the kernel 201 may include: a system call interface (System Call Interface, SCI) 210, a memory management unit (Memory Management Unit, MMU) 220, a process management program 230, and a virtual file system (Virtual File).
  • SCI System Call Interface
  • MMU memory Management Unit
  • MMU memory Management Unit
  • VFS Virtual File System
  • File System, FS file system
  • DDR Device Driver
  • the system call interface (SCI) 210 provides an interface for user space to access the kernel space.
  • SCI system call interface
  • the memory management unit (MMU) 220 is used to control data interaction between the memory and the processor in the computer device 1 . Specifically, the MMU 220 receives a memory access request from the processor and controls access to the memory based on the memory access request.
  • the process management program 230 is a program that manages multiple processes in the operating system.
  • the process management program 230 can be used to implement various functions such as process scheduling, interrupt processing, signal/process priority, context switching, process status management, and progress memory management.
  • the virtual file system (VFS) 240 is an intermediate processing system between the file system (FS) 250 and the system call interface (SCI) 210.
  • the computer device 1 can support multiple different types of file systems.
  • the FS 250 can include: EXT2, EXT3, EXT4, F2FS, rootfs, proc and other types of file systems. .
  • VFS 240 hides the specific details of the hardware of different file systems, separates file system operations from the specific hardware implementation of different file systems, and provides a unified interface for all devices.
  • Device driver 260 is one of the main parts of kernel 201.
  • the device driver 260 actually controls the interaction between the operating system layer 20 and the hardware layer 10. Specifically, in addition to providing a set of abstract interfaces understandable by the operating system layer 20 to complete the interaction between the operating system layer 20 , the device driver 260 is also used to complete specific operation details related to the hardware devices in the hardware layer 10 . Generally speaking, the device driver 260 is related to the control chip of the hardware device.
  • the kernel 201 in the operating system layer 20 and the application program in the application layer 30 are both software modules in the computer device 1, which are specifically implemented as computer programs (or also called computer programs). code).
  • the hardware layer 10 of the computer device 1 needs to include at least one processor 110 .
  • the hardware layer 10 may also include memories such as a memory 120 and an external memory 130.
  • the function of the processor 110 is mainly to interpret instructions of the computer program and process data in the computer program.
  • the instructions of the computer program and the data in the computer program can be stored in the memory 120 and/or the external memory 130 of the computer device 1 .
  • the processor 110 may be an integrated circuit chip with signal processing capabilities.
  • the processor 110 may be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), or a field programmable gate array. , FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • the general-purpose processor is a microprocessor or the like.
  • the processor 110 is a central processing unit (CPU).
  • Each processor 110 includes at least one processing unit.
  • this processing unit is also called a core and is the most important component of the processor. All calculations, receiving commands, storing commands, and processing data of the processor 110 are performed by the core.
  • each processor 110 also includes a cache, which is a buffer for data exchange. When the processing unit wants to read data, it will first search the required data from the cache. If it is found, it will be executed directly. If it is not found, it will be searched from the memory. Since cache runs much faster than memory, the purpose of the cache is to help the processing unit run faster.
  • the memory 120 is also called main memory, and is used to temporarily store operation data in the processor 110 and data exchanged with the external memory 130 . There is a fast data reading and writing speed between the memory 120 and the processor 110 .
  • the memory 120 can provide running space for processes in the computer device 1.
  • the memory 120 stores computer programs for generating processes. After the computer program is run by the processor 110 to generate a process, the processor 110 allocates corresponding storage space for the process in the memory 120 .
  • the memory 120 stores data generated during the running of the process, such as intermediate data, process data, etc., in the storage space corresponding to the above-mentioned process.
  • the memory 120 may be a volatile memory.
  • the volatile memory may be random access memory (Random Access Memory, RAM).
  • RAM Random Access Memory
  • many forms of RAM are available, such as static random access memory (Static RAM, SRAM), dynamic random access memory (Dynamic RAM, DRAM), and the like.
  • the external memory 130 can also be called auxiliary memory, which refers to the memory in the computer device 1 except the memory 120 and cache.
  • the external memory 130 can be a memory that can still save data after power is turned off.
  • the external memory 130 can have a relatively large capacity and can store file data such as pictures, videos, text, and application programs in the computer device 1 to meet the user's needs.
  • the external storage 130 can be a non-volatile memory, a magnetic disk, an optical disk, a U disk (also called a USB flash disk) or a Secure Digital Memory Card (SD Card) etc.
  • the non-volatile memory may include at least one of the following memories: read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory ( Erasable PROM, EPROM), electrically erasable programmable read-only memory (Electrically EPROM, EEPROM) and flash memory (FLASH).
  • the disk can be a hard disk (Hard Disk) or a floppy disk (Soft Disk).
  • the hard disk can include: solid state drive (Solid State Drive, SSD), hybrid hard drive (Hybrid Hard Drive, HHD) and mechanical hard drive (Hard Disk Drive, HDD) and so on.
  • the computer device 1 in the embodiment of the application includes various software modules or hardware modules in computer systems in the prior art.
  • the computer device 1 also includes: communication devices, sensor devices, peripheral devices with various functions, and so on.
  • the storage space of the memory 120 mainly affects the running speed of the computer device 1. Therefore, the memory 120 can also be called "operation memory”.
  • the storage space of the external memory 130 mainly affects the ability of the computer device 1 to store file data.
  • the storage space of the external memory 130 can be understood as the storage space in the computer device 1 for storing file data.
  • the application (APP) of the computer device 1 can implement specific functions by way of system calls. Among them:
  • the kernel 201 provides a series of system calls.
  • the application program 301 implements the function of reading file data by calling the read function provided by the kernel 201.
  • the code execution flow of this process is from the application program 301 to the kernel 201. .
  • the application can also implement a specific function through ioctl.
  • the application 301 defines a set of command codes, and different command codes represent different functions. Then the application 301 passes the defined command code to ioctl, so that the kernel 201 implements the function corresponding to the command code according to the command code. The code execution flow of this process is from the application 301 to the kernel 201.
  • the computer device 1 may also be other types of devices.
  • the kernel interface functions are compiled and need to be triggered by the application layer before further execution, the request is initiated by the application 301 and the kernel 201 responds; however, in some application scenarios, (For example: application 301 reads cloud disk data), there is a need for the kernel 201 to initiate a request (for example: read request, write request, delete request, etc.) or transmit data to the application 301.
  • the existing solution cannot meet this demand. .
  • embodiments of the present application provide an operating method applied to a computer device, which method enables the kernel 201 to initiate a request or transmit data to the application 301 .
  • FIG. 3 shows a schematic flow chart of an operating method 300 applied to a computer device provided by an embodiment of the present application.
  • the operation method 300 is applied to the application layer and kernel of the computer device.
  • the application layer may include the application layer 30 shown in FIG. 1 above and/or the application program 301 shown in FIG. 2; the kernel may include the kernel shown in FIG. 1 and/or FIG. 2 above. 201.
  • the operation method 300 may include the following steps.
  • the request to be processed is located in the kernel request list, and the request to be processed includes the first request.
  • the first request refers to the request to be processed with the order of 1 in the kernel request list. Therefore, as long as the kernel request If there is a pending request in the linked list, there must be a first request.
  • the kernel request linked list is located in the kernel of the computer device. There are one or more data nodes in the kernel request linked list, and each data node in the one or more data nodes represents a pending request.
  • the number of pending requests can be one or multiple.
  • the application detects whether there are pending requests in the kernel by calling the poll function.
  • the application program blocks and waits until the first request appears in the kernel (ie, a pending request appears), and then further reads the first request.
  • the kernel ie, a pending request appears
  • the application detects whether there are pending requests in the kernel request list by calling the poll function. When there are no pending requests in the kernel request list, the application blocks and waits for the kernel request list (that is, the poll function does not return); once a kernel request is detected When there is a pending request in the linked list, the poll function returns immediately, triggering the application to read the first request.
  • the application reads the first request in the kernel request list by calling the read function.
  • the application program first decodes the first request, and then further performs the operation corresponding to the first request.
  • S340 In response to the first request, send a first response to the kernel.
  • the application program After the application program completes the operation corresponding to the first request, it generates a first response and transmits the first response to the kernel.
  • the application passes the first response to the kernel by calling an ioctl function.
  • the first response includes a first response code, which refers to the response code corresponding to the above-mentioned first request.
  • the application program transfers the first response to the kernel by calling the ioctl function, which may be: using the first response encoding as a function parameter corresponding to the ioctl function, and passing it to the kernel through a function call.
  • the first response includes first response data, where the first response data refers to response data corresponding to the first request.
  • each of the above operation steps is executed by an application program of the operating system in the computer device.
  • the kernel of the computer device initiates a request, and the application program of the computer device responds to the request, thereby enabling the computer core to actively transmit data to the application program.
  • the application program of the computer device responds to the request, thereby enabling the computer core to actively transmit data to the application program.
  • it can be applied to the application program sending data to the application program. Scenarios such as cloud disk transmission of cloud disk data.
  • FIG. 4 shows a schematic flow chart of an operating method 400 applied to a computer device provided by an embodiment of the present application.
  • the operating method 400 is applied to a computer device. application layer and kernel.
  • the operation method 400 may include the following steps.
  • S410 The application program detects whether there is a pending request in the kernel by calling the poll function.
  • the pending requests include the first request.
  • the application program blocks and waits until the first request appears in the kernel, and then further reads the first request.
  • the application detects whether there are pending requests in the kernel request list by calling the poll function. When there are no pending requests in the kernel request list, the application blocks and waits for the kernel request list (that is, the poll function does not return); once the kernel is detected When there is a pending request in the request list, the poll function returns immediately, which triggers the application to call the read function to read the first request in the kernel request list.
  • the kernel request linked list is located in the kernel of the computer device. There are one or more data nodes in the kernel request linked list, and each data node in the one or more data nodes represents a pending request.
  • the application After the application reads the first request in the kernel request list by calling the read function, it decodes the read first request.
  • S440 The application executes a first operation corresponding to the first request according to the decoded first request.
  • the first operation may be: the application queries the user data and compresses or packages the queried user data; the first operation may also include verification. Operation (determining whether the requested object is trustworthy, etc.); in addition, the first operation may also be other operations corresponding to the first request, which is not limited in this application.
  • the kernel request linked list is blocked until the execution of the first request is completed.
  • the application sends the first response to the kernel by calling an ioctl function.
  • the first response includes a first response code
  • the first response code refers to a response code corresponding to the first request.
  • the application program transfers the first response to the kernel by calling the ioctl function, which may be: using the first response encoding as a function parameter corresponding to the ioctl function, and passing it to the kernel through a function call.
  • the first response includes first response data, where the first response data refers to response data corresponding to the first request.
  • the relationship between the first response code and the first response data may be: the first response code includes information indicating the storage address of the first response data; in this case, The kernel can read the first response data through a "zero-copy" scheme.
  • this "zero-copy" scheme an exemplary explanation is given in the embodiment shown in FIG. 6 below.
  • each of the above operation steps is executed by an application program of the operating system in the computer device.
  • step S430 is an optional step.
  • step S410 and step S420 may respectively be an implementation manner of step S310 and step S320 in the above-described embodiment.
  • Steps S430 to S440 may be an implementation manner of step S330 in the embodiment described above.
  • Step S450 may be an implementation of step S340 in the above-described embodiment.
  • the kernel of the computer device can initiate a request, and the application program of the computer device can respond to the request, thereby enabling the computer core to actively transmit data to the application program, and also enable the application program to send data to the cloud. Disk transfer cloud disk data, etc.
  • embodiments of the present application can also implement other methods to enable applications to read requests in the kernel and respond.
  • Figure 5 shows a schematic flow diagram of an operating method 500 applied to a computer device provided by an embodiment of the present application.
  • the operating method 500 applies For the application layer and kernel of computer equipment.
  • the operation method 500 may include the following steps.
  • the first response code refers to the response code generated by the application program in response to the first request.
  • the first response code is used as the corresponding parameter of the ioctl function.
  • the application program can pass the first response code to the kernel by calling the ioctl function.
  • S520 The kernel decodes the first response code and obtains the identification ID of the first request.
  • the first response data refers to the response data generated by the application program in response to the first request.
  • the relationship between the first response code and the first response data may be: the first response code includes information indicating the storage address of the first response data; in this case, The kernel can read the first response data through a "zero-copy" scheme.
  • this "zero-copy" scheme an exemplary explanation is given in the embodiment shown in FIG. 6 below.
  • the first response code includes the first response data.
  • the first response data in the first response encoding can be the presence of a response parameter (that is, the response parameter is not empty).
  • a response parameter that is, the response parameter is not empty.
  • S540 The kernel sends the first response data to the first request according to the ID of the first request.
  • the kernel sends the first response data to the pending request in the kernel request list according to the ID of the first request.
  • the first response data is sent to the pending request in the kernel request list.
  • a request is removed from the kernel request list, and based on the first response data, the kernel further performs subsequent operations.
  • steps S510 to S540 may be an implementation manner of step S450 in the embodiment described above.
  • the embodiment of the present application can be regarded as a solution extension based on the embodiment shown in Fig. 3 or Fig. 4.
  • the application program calls the read function to read the request or data, and further performs the operation corresponding to the request or data, and after the operation is completed,
  • the kernel transmits the response information of the request or data.
  • the kernel can initiate the request and the application program responds. This can further enable the computer kernel to actively transmit data to the application program, and also enable the application program to transmit data to the cloud disk. Cloud disk data, etc.
  • FIG. 6 shows a schematic flow chart of a method 600 for a kernel to read first response data provided by an embodiment of the present application.
  • the method 600 also applies to the application layer and kernel of the computer device.
  • the application layer may include the application layer 30 shown in FIG. 1 above and/or the application program 301 shown in FIG. 2; the kernel may include the kernel shown in FIG. 1 and/or FIG. 2 above. 201.
  • the method 600 includes the following steps.
  • the application program generates first response data and stores the first response data in the first memory.
  • the first memory is a virtual memory (data buffer) located at the application layer.
  • the first memory may be buf.
  • the kernel layer obtains the first response data from the second memory.
  • the second memory has a mapping relationship with the first memory.
  • the second memory is located at the kernel layer.
  • the second memory may specifically be pages, and one page corresponds to one buf.
  • the kernel establishes a mapping from the second memory to the first memory through the get user pages function. After the mapping is established, the first response data stored in the first memory is presented in the second memory in the kernel (in the form of pages). Therefore, the kernel can directly read the first response data through the second memory.
  • step S620 may also include the following steps:
  • S630 The application passes the first response code to the kernel.
  • step S620 is further performed.
  • the kernel can directly read the first response data generated by the application program in the kernel, without the need to transfer the first response data to the kernel.
  • the response data is copied from the application layer to the kernel, which saves the performance overhead occupied by the process of copying data, thus improving the performance of the computer device and thereby improving the user experience of the computer device.
  • the first request code is the code corresponding to the first request described in the embodiment shown in FIGS. 3 to 6 . Moreover, reading the first request described above is actually reading the code corresponding to the first request.
  • FIG. 7 shows a schematic diagram of the composition of a first request encoding 700 provided by an embodiment of the present application.
  • the first request code 700 includes an operation code, a file identification code (ID), a request code (ID), and request parameters.
  • ID file identification code
  • ID request code
  • request parameters request parameters.
  • the operation code may be, for example, op, which is used to describe what operation the first request is used to perform, such as a read operation, an open operation, etc.
  • the file identification code can be, for example, fid, which is used to uniquely identify a file in the system.
  • the uniquely identified file is a user-mode file and is also the file to be accessed by the first request.
  • the uniquely identified file can be a corresponding file on the cloud disk.
  • the request code may be, for example, a rid, which is used to number the first request to distinguish multiple requests in the system, and is equivalent to the identification information of the first request.
  • the request parameters may be, for example, arg1 to argN.
  • FIG. 8 shows a schematic diagram of the composition of a first response code 800 provided by the embodiment of the present application.
  • the first response code is the response code of the first request code.
  • the first response code 800 includes a request code (ID), status code, file path, fragmentation information and response parameters. in:
  • the request code may be, for example, a rid, which is used to number the first request to distinguish multiple requests in the system, and is equivalent to the identification information of the first request.
  • the status code may be, for example, err, which is used to describe the execution status of the first request.
  • the status code may be some error codes defined according to the type of the first request.
  • the corresponding execution status may be network error, network difference, network file does not exist, etc.
  • the file path may be, for example, path, which is used to describe the absolute path of the file accessed by the first request.
  • the field corresponding to the fragmentation information can be frag.
  • the field corresponding to the fragmentation information is empty (NULL).
  • the response parameters may be, for example, arg1 to argN: used to describe the first response data (that is, the response data of the application program for the first request).
  • the first response data includes multiple response data, and each response data in the multiple response data corresponds to one arg.
  • the response parameter describes the address information of the first response data.
  • FIG. 9 shows a schematic diagram of an operating method 900 applied to a computer device provided by an embodiment of the present application.
  • the method 900 also applies to the application layer and kernel of the computer device.
  • the application layer may include the application layer 30 shown in FIG. 1 above and/or the application program 301 shown in FIG. 2; the kernel may include the kernel shown in FIG. 1 and/or FIG. 2 above. 201.
  • one or more pending requests are stored in the kernel request list.
  • the pending requests refer to requests that need to be sent to the application program 301.
  • the one or more pending requests include the first request.
  • the explanation of the first request has been described in detail in the embodiment shown in FIGS. 3 to 8 , and will not be repeated here for the sake of brevity.
  • the application detects whether there are pending requests in the kernel request list by calling the poll function. When it is detected that there are no pending requests in the kernel request list, the application blocks and waits until it detects that there are pending requests in the kernel request list. When processing the request (the first request), continue to call the read function, and read the first request through the read function.
  • the first request in the kernel request list is the first request code described in the embodiment shown in FIG. 7 .
  • each pending request in the kernel request list corresponds to an operation (for example, the first request corresponds to the first operation).
  • the kernel provides the device_create function.
  • a device file can be created.
  • the operation set of the device file includes the poll function and the read function provided by the kernel.
  • the kernel defines a struct file_operations variable, and then manages the operation function set of the above device file through the struct file_operations variable, thereby enabling the application to call the read function and poll function.
  • Figure 10 shows a schematic structural block diagram of an operating device 1000 applied to computer equipment provided by an embodiment of the present application.
  • the operating device 1000 is located at the application layer of the computer equipment.
  • the operating device 1000 is located in the application layer 30 in the embodiment shown in FIG. 1 and/or the application program 301 in the embodiment shown in FIG. 2 .
  • the operating device 1000 includes: a first acquisition module 1010 and a processing module 1020.
  • the first acquisition module 1010 is used to: detect whether there is a pending request in the kernel; and read the first request when it is detected that there is a first request in the kernel.
  • reading the first request can be understood as reading the code corresponding to the first request (first request code).
  • the pending request is located in the kernel request linked list, and the pending request includes a first request, and the first request refers to the pending request with a pending order of 1 in the kernel request linked list. Therefore, as long as there are pending requests in the kernel request linked list, there must be a first request.
  • the kernel request linked list is located in the kernel of the computer device. There are one or more data nodes in the kernel request linked list, and each data node in the one or more data nodes represents a pending request.
  • the number of pending requests can be one or multiple.
  • the first acquisition module 1010 detects whether there are pending requests in the kernel by calling the poll function.
  • the first acquisition module 1010 when the first acquisition module 1010 detects that there is no first request (pending request) in the kernel, the first acquisition module 1010 blocks and waits until the first request appears in the kernel, and then further reads the first request.
  • One request specifically:
  • the first acquisition module 1010 detects whether there are pending requests in the kernel by calling the poll function. When there are no pending requests in the kernel request list, the first acquisition module 1010 blocks and waits for the kernel request list (that is, the poll function does not return); once When it is detected that there is a pending request in the kernel request list, the poll function returns immediately, thereby triggering the first acquisition module 1010 to read the first request.
  • the operation of detecting whether there is a pending request in the kernel may be completed by a separate detection module; or may be completed by the detection module and the first acquisition module 1010 in collaboration.
  • the first acquisition module 1010 reads the first request in the kernel request list by calling the read function.
  • the processing module 1020 is configured to perform operations corresponding to the first request.
  • the processing module 1020 first decodes the first request, and then further performs the operation corresponding to the first request.
  • the processing module 1020 is also used to generate a first response.
  • the processing module 1020 sends the first response to the kernel by calling the ioctl function.
  • the first response includes a first response code
  • the first response code refers to a response code corresponding to the first request.
  • the processing module 1020 transfers the first response to the kernel by calling the ioctl function, which may be: using the first response encoding as a function parameter corresponding to the ioctl function, and passing it to the kernel through a function call.
  • the first response includes first response data, where the first response data refers to response data corresponding to the first request.
  • the operation of sending the first response to the kernel may be completed by a separate transceiver module, or may be completed by the transceiver module and the processing module 1020 in collaboration.
  • the kernel of the computer device can initiate a request, and the application program of the computer device can respond to the request, thereby enabling the computer core to actively transmit data to the application program, and also enable the application program to send data to the cloud. Disk transfer cloud disk data, etc.
  • FIG. 11 shows a schematic structural block diagram of an operating device 1100 applied to computer equipment provided by an embodiment of the present application.
  • the operating device 1100 includes: a first acquisition module 1110, a processing module 1120, and a second acquisition module 1130.
  • the first acquisition module 1110 and the processing module 1120 are located in the user space of the computer device, and the second acquisition module 1130 is located in the kernel space of the computer device.
  • the first acquisition module 1110 and the processing module 1120 are located in the user space of the computer device, and the second acquisition module 1130 is located in the kernel space of the computer device.
  • the first acquisition module 1110 is used to detect whether there is a pending request in the kernel by calling the poll function.
  • the pending requests include the first request.
  • the first acquisition module 1110 is also configured to read the first request by calling the read function when detecting that there is a first request in the kernel.
  • the first acquisition module 1110 blocks and waits until the first request appears in the kernel, and then further reads the first request. specifically:
  • the first acquisition module 1110 detects whether there are pending requests in the kernel by calling the poll function. When there are no pending requests in the kernel request list, the application blocks and waits for the kernel request list (that is, the poll function does not return); once the kernel is detected When there is a pending request in the request list, the poll function returns immediately, which triggers the first acquisition module 1110 to call the read function to read the first request.
  • the processing module 1120 is used to decode the first request.
  • the processing module 1120 is further configured to execute a first operation corresponding to the first request according to the decoded first request.
  • the first operation may be: query the user data, and compress or package the queried user data; the first operation may also include a verification operation ( Determine whether the request object is trustworthy, etc.); In addition, the first operation may also be other operations corresponding to the first request, which is not limited in this application.
  • the processing module 1120 is further configured to generate a first response.
  • the processing module 1120 is further configured to transmit a first response to the kernel by calling an ioctl function after executing the first operation.
  • the first response includes a first response code, where the first response code refers to a response code corresponding to the first request.
  • the processing module 1120 transfers the first response to the kernel by calling the ioctl function, which may be: using the first response encoding as a function parameter corresponding to the ioctl function, and passing it to the kernel through a function call.
  • the first response includes first response data, and the first response data is response data corresponding to the first request.
  • the second acquisition module 1130 is used to decode the first response code to obtain the identification ID of the first request.
  • the second acquisition module 1130 is also configured to read the first response data when there is a description of the first response data in the first response code.
  • the first response data in the first response encoding can be the presence of a response parameter (that is, the response parameter is not empty).
  • a response parameter that is, the response parameter is not empty.
  • FIG. 10 and FIG. 11 are only illustrative and not limiting.
  • the operating device 1000 and/or the computer equipment where the operating device 1100 is located may also include functional modules in related technologies.
  • Other functional modules for example, in the kernel of the computer device where the operating device 1000 and/or the operating device 1100 is located, may also include: a memory management unit 220 and a process management program 230 as shown in FIG. 2 .
  • the hardware layer of the computer device where the operating device 1000 and/or the operating device 1100 is located also includes: a processor 110 and a memory 120 as shown in FIG. 2 .
  • Figure 12 shows a computer device 1200 provided by an embodiment of the present application.
  • the computer device 1200 includes an application program 301 and a kernel 201, where the application program 301 is located in
  • the kernel 201 is located in the user space of the computer device 1200.
  • the application program 301 includes a first memory 1210;
  • the kernel 201 includes a second memory 1220, a mapping management module 1230, and a mapping pool 1240. More specifically:
  • the first memory 1210 is used to store the first response data generated by the application program 301.
  • the first memory is a virtual memory, which may be a data buffer of the user state layer.
  • the first memory may be, for example, buf.
  • a mapping relationship is established between the second memory 1220 and the first memory 1210, so that the first response data stored in the first memory 1210 is presented in the second memory in the form of a page.
  • the mapping management module 1230 is used to establish a mapping from the second memory 1220 to the first memory 1210 .
  • mapping management module 1230 establishes a mapping from the second memory 1220 to the first memory 1210 by calling the get user pages function.
  • the mapping management module 1230 is also used to control the speed of mapping from the second memory 1220 to the first memory 1210 .
  • mapping management module 1230 applies for a mapping descriptor from the mapping pool 1240.
  • mapping management module 1230 applies for the mapping descriptor, , the mapping relationship between the second memory 1220 and the first memory 1210 is established.
  • the mapping descriptor is used to uniquely identify the mapping relationship and is also used to describe the mapping status of the mapping relationship.
  • mapping status includes used status or unused status.
  • mapping management module 1230 When the mapping management module 1230 cannot apply for a mapping descriptor, it means that the mapping descriptors in the mapping pool 1240 have been used up or there are no mapping descriptors available. At this time, the mapping management module 1230 stops the second memory 1220 to the third memory. Mapping of a memory 1210. When there is an available mapping descriptor in the mapping pool 1240, mapping of the second memory 1220 to the first memory 1210 is continued.
  • mapping management module 1230 cannot apply for a mapping descriptor, it means that the mapping descriptors in the mapping pool 1240 have been used up or there are no available mapping descriptors. At this time, the mapping management module 1230 Initiate blocking wait.
  • mapping descriptor when the mapping data corresponding to the mapping descriptor is read by the kernel and sent to the corresponding request, the mapping descriptor will be released and become an available mapping descriptor.
  • a mapping relationship is established between the second memory located in the kernel and the first memory (for example: buf) located in the application layer, so that the data stored in the first memory is presented in the form of a page in the second memory.
  • the first memory and the second memory are essentially the same memory. Reading and writing the second memory is equivalent to reading and writing the first memory. Therefore, the kernel can directly read the data of the application layer without the need to transfer the data from the application layer.
  • the layer is copied to the kernel for reading or processing, which can significantly save the performance overhead of computer equipment; moreover, the mapping speed can also be controlled through the mapping management module, which can avoid a large number of mappings from occupying too much memory.
  • FIG. 13 shows a schematic diagram of an application scenario of an operating method applied to a computer device provided by an embodiment of the present application.
  • the operation method for computer equipment provided by the embodiment of the present application can be applied to the scenario where the application APP reads data from the cloud disk on the network side.
  • This process may specifically include the following steps:
  • S1310 The application APP initiates reading of data in the cloud disk by calling the read function.
  • the execution flow of the program is from user mode to kernel mode.
  • S1320 In response to the APP initiating the operation of reading cloud disk data, the kernel generates a read request and passes the read request to the cloud disk, which responds.
  • the read request is passed to the cloud disk file (for example: the daemon shown in Figure 13), and the cloud disk file responds, and the cloud disk file is located in user mode.
  • the cloud disk file for example: the daemon shown in Figure 13
  • the kernel passes the read request to the cloud disk, and the specific implementation process of the cloud disk responding has been explained in detail in the embodiments shown in Figures 3 to 12. For the sake of simplicity, it will not be described again here. .
  • FIG. 14 shows a schematic structural block diagram of another operating device 1400 applied to a computer device provided in an embodiment of the present application.
  • the operating device 1400 includes: at least one processor 1410 and a memory 1420.
  • the memory 1420 is used to store the program.
  • the at least one processor 1410 is used to call and run the program from the memory 1420 to perform any of the above.
  • An embodiment provides an operating method applied to a computer device.
  • An embodiment of the present application also provides a computer device, which may include the operating device applied to the computer device provided in any of the above embodiments.
  • the computer device includes but is not limited to a terminal device, such as a mobile phone, a personal computer, etc.
  • An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program.
  • the computer program When the computer program is executed on a computer device, the computer device executes an operating method applied to a computer device provided in any of the above embodiments.
  • Embodiments of the present application also provide a computer program product including a computer program, which, when run on a computer device, causes the computer device to execute the operating method applied to the computer device provided by any of the above embodiments.
  • An embodiment of the present application also provides a chip.
  • the chip includes a processor and a data interface.
  • the processor reads instructions stored in the memory through the data interface to execute the computer equipment provided by any of the above embodiments. method of operation.
  • the chip can be a central processing unit (CPU), a microcontroller unit (Micro Controller Unit, MCU), a microprocessor (Micro Processing Unit, MPU), a digital signal processor (DSP), a system on a chip (System On Chip (SoC), application specific integrated circuit (ASIC), field programmable gate array (FPGA) or programmable logic device (programmable logic device, PLD).
  • CPU central processing unit
  • MCU microcontroller unit
  • MPU Micro Processing Unit
  • DSP digital signal processor
  • SoC System On Chip
  • SoC System On Chip
  • ASIC application specific integrated circuit
  • FPGA field programmable gate array
  • PLD programmable logic device
  • the number of processors is not limited.
  • the processor is a general-purpose processor, and optionally, the general-purpose processor can be implemented by hardware or by software.
  • the processor is a logic circuit, integrated circuit, etc.; when implemented by software, the processor is a general processor that is implemented by reading the software code stored in the memory, which is integrated in the processor. In the processor, it is located outside the processor and exists independently.
  • the above embodiments are implemented in whole or in part by software, hardware, firmware or any other combination.
  • the above-described embodiments are implemented in whole or in part in the form of a computer program product.
  • the computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on the computer, the processes or functions described in the embodiments of the present application are generated in whole or in part.
  • the computer is a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
  • the computer instructions can be stored in or transmitted from one computer-readable storage medium to another, e.g., from a website, computer, server, or data center. Wired (such as infrared, wireless, microwave, etc.) transmission to another website, computer, server or data center.
  • the computer-readable storage medium is any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more sets of available media.
  • the available media are magnetic media (eg, floppy disks, hard disks, tapes), optical media (eg, DVD), or semiconductor media, such as solid state drives.
  • At least one refers to one or more, and “plurality” refers to two or more.
  • At least one of the following” or similar expressions thereof refers to any combination of these items, including any combination of a single item (items) or a plurality of items (items).
  • at least one of a, b, or c means: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c are single or multiple.
  • the size of the sequence numbers of the above-mentioned processes does not mean the order of execution.
  • the execution order of each process should be determined by its functions and internal logic, and should not be used in the embodiments of the present application.
  • the implementation process constitutes any limitation.
  • the device embodiments described above are only illustrative.
  • the division of modules is only a logical function division.
  • Another point is that the coupling or direct coupling or communication connection between each other shown or discussed is the indirect coupling or communication connection through some interfaces, devices or modules, which is electrical, mechanical or other forms.
  • each functional module in each embodiment of the present application can be integrated into a processing device.
  • each module physically exists alone, or two or more modules are integrated into one module.
  • the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the present application is essentially or the part that contributes to the existing technology 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 are used to cause a computer device (either a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other various media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Medical Informatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Artificial Intelligence (AREA)
  • Stored Programmes (AREA)

Abstract

Embodiments of the present application provide an operation method applied to a computer device. The operation method is applied to an application layer of the computer device, and the operation method comprises: detecting whether there is a first request in a kernel, the first request being a request needing to be sent to the application layer; when it is detected that there is the first request in the kernel, reading the first request; and further, in response to reading the first request, sending a first response to the kernel. According to the solution, an application of a computer device can respond to a request initiated by a kernel of a computer device, so that data can be actively transmitted to the application by the computer kernel, for example, the solution can be applied to scenarios such as a scenario where the application transmits cloud disk data to a cloud disk, thereby improving the experience of a user using the computer device.

Description

应用于计算机设备的操作方法、装置和计算机设备Operating methods, devices and computer equipment applied to computer equipment 技术领域Technical field
本申请涉及计算机技术领域,并且更为具体地,涉及一种应用于计算机设备的操作方法、装置和计算机设备。The present application relates to the field of computer technology, and more specifically, to an operating method, device and computer equipment applied to computer equipment.
背景技术Background technique
随着科学技术的发展和提升,在计算机设备中,数据传输网络越来越复杂,使得对数据传输的形式有了更高的要求,目前,能够通过系统调用的方式实现应用程序读取文件数据,然而,在一些应用场景中(例如:应用程序读取云磁盘数据),存在由内核向应用程序发起请求(例如:读请求、写请求、删请求等)或者传输数据的需求。With the development and improvement of science and technology, the data transmission network in computer equipment is becoming more and more complex, which puts higher requirements on the form of data transmission. Currently, applications can read file data through system calls. , However, in some application scenarios (for example, an application reads cloud disk data), there is a need for the kernel to initiate a request (for example, a read request, a write request, a delete request, etc.) or to transmit data to the application.
鉴于此,如何实现由计算机内核向应用程序传输数据,以提升用户对计算机设备的使用体验,是一项亟待解决的技术问题。In view of this, how to transmit data from the computer kernel to the application program to improve the user experience of the computer device is an urgent technical issue that needs to be solved.
发明内容Contents of the invention
本申请实施例提供一种应用于计算机设备的操作方法、装置和计算机设备,该操作方法能够使得计算机设备的应用程序对计算机设备的内核发起的请求进行响应,进而能够实现由计算机内核主动向应用程序传输数据,例如可以应用于应用程序向云磁盘传输云磁盘数据等场景,提升了用户使用计算机设备的体验感。Embodiments of the present application provide an operating method, device and computer equipment applied to computer equipment. The operating method enables the application program of the computer equipment to respond to a request initiated by the kernel of the computer equipment, thereby enabling the computer kernel to actively send requests to the application. The program transmits data, for example, it can be used in scenarios such as applications transmitting cloud disk data to cloud disks, etc., which improves the user's experience of using computer equipment.
第一方面,提供一种应用于计算机设备的操作方法,该操作方法应用于计算机设备的应用层,该操作方法包括:检测内核中是否存在第一请求,该第一请求为需要发送给该应用层的请求;当检测到该内核中存在所述第一请求时,读取该第一请求;响应于该第一请求,向该内核发送第一响应。A first aspect provides an operating method applied to a computer device. The operating method is applied to an application layer of the computer device. The operating method includes: detecting whether there is a first request in the kernel, and the first request needs to be sent to the application. layer's request; when detecting that the first request exists in the core, read the first request; in response to the first request, send a first response to the core.
可选地,在响应于第一请求,向内核发送第一响应之前,方法还包括:执行该第一请求对应的第一操作。Optionally, before sending a first response to the kernel in response to the first request, the method further includes: executing a first operation corresponding to the first request.
其中,内核中可以存在一个或多个待处理请求,该一个或多个待处理请求中的每个待处理请求均对应一个操作。There may be one or more pending requests in the kernel, and each of the one or more pending requests corresponds to an operation.
一个或多个待处理请求包括第一请求,该第一请求是指在内核请求链表中待处理顺序为1的待处理请求,因此,只要内核请求链表中存在待处理请求,就一定存在第一请求,其中,内核请求链表位于计算机设备的内核中,用于存放待处理请求。One or more pending requests include a first request, which refers to a pending request with a pending order of 1 in the kernel request list. Therefore, as long as there is a pending request in the kernel request list, there must be a first request. request, where the kernel request linked list is located in the kernel of the computer device and is used to store pending requests.
可选地,第一请求可以包括读请求、写请求、删请求中的任意一项,此外,第一请求还可以包括其他任意形式的请求,本申请对此不作限定。Optionally, the first request may include any one of a read request, a write request, and a delete request. In addition, the first request may also include any other form of request, which is not limited in this application.
本申请实施例中,能够实现由计算机设备的内核发起请求,计算机设备的应用程序对该请求进行响应,进而能够实现由计算机内核主动向应用程序传输数据,例如可以应用于应用程序向云磁盘传输云磁盘数据等场景。In the embodiments of the present application, the kernel of the computer device can initiate a request, and the application program of the computer device can respond to the request, thereby enabling the computer kernel to actively transmit data to the application program. For example, it can be applied to the application program transmitting data to a cloud disk. Scenarios such as cloud disk data.
结合第一方面,在一些可能的实施方式中,检测内核中是否存在第一请求,包括:通过调用poll函数检测内核请求链表中是否存在该第一请求,该内核请求链表位于该内核中。In connection with the first aspect, in some possible implementations, detecting whether the first request exists in the kernel includes: detecting whether the first request exists in the kernel request linked list by calling the poll function, and the kernel request linked list is located in the kernel.
结合第一方面,在一些可能的实施方式中,读取该第一请求,包括:通过调用read函数读取所述第一请求。In conjunction with the first aspect, in some possible implementations, reading the first request includes: reading the first request by calling a read function.
结合第一方面,在一些可能的实施方式中,向该内核发送第一响应,包括:通过调用ioctl函数向该内核发送该第一响应。In conjunction with the first aspect, in some possible implementations, sending the first response to the kernel includes: sending the first response to the kernel by calling an ioctl function.
本申请实施例中,通过调用poll函数检测到内核中存在第一请求时,进一步通过调用read函数读取内核中的该第一请求,读取完该第一请求后,执行该第一请求相对应的第一操作,然后通过调用ioctl函数向内核传递针对该第一请求的响应。该方案结合poll函数、read函数和ioctl函数,能够实现由计算机内核主动向应用程序传输数据,例如可以应用于应用程序向云磁盘传输云磁盘数据等场景。In the embodiment of the present application, when it is detected that there is a first request in the kernel by calling the poll function, the first request in the kernel is further read by calling the read function. After reading the first request, the first request phase is executed. The corresponding first operation is then passed to the kernel by calling the ioctl function in response to the first request. This solution combines the poll function, read function and ioctl function to enable the computer kernel to actively transmit data to the application. For example, it can be applied to scenarios such as applications transmitting cloud disk data to cloud disks.
结合第一方面,在一些可能的实施方式中,方法还包括:当检测到内核中不存在该第一请求时,对内核请求链表进行阻塞,并等待该第一请求。In conjunction with the first aspect, in some possible implementations, the method further includes: when detecting that the first request does not exist in the kernel, blocking the kernel request list and waiting for the first request.
本申请实施例中,在内核中不存在待处理请求时,对内核请求链表进行阻塞,等待至内核请求链表中存在待处理请求时,调用read函数读取该请求,这样,相当于是对内核请求链表中的待处理请求进行监测,一旦存在便会立即对其读取,能够提升计算机设备的操作性能。In the embodiment of this application, when there is no pending request in the kernel, the kernel request list is blocked, and when there is a pending request in the kernel request list, the read function is called to read the request. In this way, it is equivalent to requesting the kernel. The pending requests in the linked list are monitored and read immediately once they exist, which can improve the operating performance of the computer equipment.
结合第一方面,在一些可能的实施方式中,方法还包括:响应于该第一请求,生成第一响应数据。In conjunction with the first aspect, in some possible implementations, the method further includes: in response to the first request, generating first response data.
其中,第一响应数据是指应用层执行第一请求对应的第一操作后,所生成的响应数据,例如,当第一请求为读请求时,第一响应数据可以是相对应的读数据。The first response data refers to the response data generated after the application layer performs the first operation corresponding to the first request. For example, when the first request is a read request, the first response data may be corresponding read data.
结合第一方面,在一些可能的实施方式中,第一响应包括该第一响应数据。In conjunction with the first aspect, in some possible implementations, the first response includes the first response data.
本申请实施例中,应用层生成第一响应数据后,直接将该第一响应数据传递给内核(例如:从应用层拷贝至内核),使得内核能够进一步根据该第一响应数据执行后续操作。In the embodiment of the present application, after the application layer generates the first response data, the first response data is directly passed to the kernel (for example, copied from the application layer to the kernel), so that the kernel can further perform subsequent operations based on the first response data.
结合第一方面,在一些可能的实施方式中,方法还包括:将该第一响应数据缓存于第一内存,该第一内存为位于用户层中的虚拟内存,该第一响应包括第一响应编码,该第一响应编码包括第一指示信息,该第一指示信息用于指示该第一内存中存在该第一响应数据。In conjunction with the first aspect, in some possible implementations, the method further includes: caching the first response data in a first memory, where the first memory is a virtual memory located in the user layer, and the first response includes a first response The first response code includes first indication information, and the first indication information is used to indicate that the first response data exists in the first memory.
可选地,该第一内存可以是buf。Optionally, the first memory may be buf.
可选地,该第一内存与第二内存具有映射关系,该第二内存位于该内核中,该第二内存用于该内核在根据该第一指示信息确定该第一内存中存在该第一响应数据时,读取该第一响应数据。Optionally, the first memory has a mapping relationship with a second memory, and the second memory is located in the core. The second memory is used by the core to determine that the first memory exists in the first memory according to the first indication information. When responding to data, read the first response data.
其中,该第二内存具体可以是页(pages),一个page对应一个buf。The second memory may specifically be pages, and one page corresponds to one buf.
本申请实施例中,位于内核中的第二内存与位于应用层中的第一内存(例如:buf)之间建立映射关系,使得存储于第一内存中的数据以page的形式呈现于第二内存中,该第一内存和第二内存本质上是同一块内存,读写第二内存就相当于读写第一内存,因此,内核能够直接读取应用层的数据,不需要将数据从应用层拷贝到内核中再进行读取或处理,能够明显节省计算机设备的性能开销;并且,还能够通过映射管理模块控制映射的速度,能够避免大量映射占用太多内存。In the embodiment of the present application, a mapping relationship is established between the second memory located in the kernel and the first memory (for example: buf) located in the application layer, so that the data stored in the first memory is presented in the form of a page in the second memory. In the memory, the first memory and the second memory are essentially the same memory. Reading and writing the second memory is equivalent to reading and writing the first memory. Therefore, the kernel can directly read the data of the application layer without the need to transfer the data from the application layer. The layer is copied to the kernel for reading or processing, which can significantly save the performance overhead of computer equipment; moreover, the mapping speed can also be controlled through the mapping management module, which can avoid a large number of mappings from occupying too much memory.
第二方面,提供一种应用于计算机设备的操作方法,该操作方法应用于计算机设备的内核,该操作方法包括:生成第一请求,该第一请求为需要发送给应用层的请求;接 收应用层在检测到内核中存在该第一请求时,为响应于该第一请求发送的第一响应。A second aspect provides an operating method applied to a computer device. The operating method is applied to the kernel of the computer device. The operating method includes: generating a first request, which is a request that needs to be sent to the application layer; receiving the application When the layer detects that the first request exists in the kernel, it sends a first response in response to the first request.
其中,内核中可以存在一个或多个待处理请求,该一个或多个待处理请求中的每个待处理请求均对应一个操作。There may be one or more pending requests in the kernel, and each of the one or more pending requests corresponds to an operation.
一个或多个待处理请求包括第一请求,该第一请求是指在内核请求链表中待处理顺序为1的待处理请求,因此,只要内核请求链表中存在待处理请求,就一定存在第一请求,其中,内核请求链表位于计算机设备的内核中,用于存放待处理请求。One or more pending requests include a first request, which refers to a pending request with a pending order of 1 in the kernel request list. Therefore, as long as there is a pending request in the kernel request list, there must be a first request. request, where the kernel request linked list is located in the kernel of the computer device and is used to store pending requests.
可选地,第一请求可以包括读请求、写请求、删请求中的任意一项,此外,第一请求还可以包括其他任意形式的请求,本申请对此不作限定。Optionally, the first request may include any one of a read request, a write request, and a delete request. In addition, the first request may also include any other form of request, which is not limited in this application.
本申请实施例中,能够实现由计算机设备的内核发起请求,计算机设备的应用程序对该请求进行响应,进而能够实现由计算机内核主动向应用程序传输数据,例如可以应用于应用程序向云磁盘传输云磁盘数据等场景。In the embodiments of the present application, the kernel of the computer device can initiate a request, and the application program of the computer device can respond to the request, thereby enabling the computer kernel to actively transmit data to the application program. For example, it can be applied to the application program transmitting data to a cloud disk. Scenarios such as cloud disk data.
结合第二方面,在一些可能的实施方式中,内核接收到的第一响应是该应用层通过调用ioctl函数发送的。Combined with the second aspect, in some possible implementations, the first response received by the kernel is sent by the application layer by calling the ioctl function.
结合第二方面,在一些可能的实施方式中,第一响应包括该第一响应数据。Combined with the second aspect, in some possible implementations, the first response includes the first response data.
其中,第一响应数据是指应用层执行第一请求对应的第一操作后,所生成的响应数据,例如,当第一请求为读请求时,第一响应数据可以是相对应的读数据。The first response data refers to the response data generated after the application layer performs the first operation corresponding to the first request. For example, when the first request is a read request, the first response data may be corresponding read data.
本申请实施例中,应用层生成第一响应数据后,直接将该第一响应数据传递给内核(例如:从应用层拷贝至内核),使得内核能够进一步根据该第一响应数据执行后续操作。In the embodiment of the present application, after the application layer generates the first response data, it directly transfers the first response data to the kernel (for example, copies it from the application layer to the kernel), so that the kernel can further perform subsequent operations based on the first response data.
结合第二方面,在一些可能的实施方式中,该第一响应包括第一响应编码,该第一响应编码包括第一指示信息,该第一指示信息用于指示第一内存中存在该第一响应数据,其中,第一内存为位于用户层中的虚拟内存,该第一内存用于用户层缓存该第一响应数据。Combined with the second aspect, in some possible implementations, the first response includes a first response code, the first response code includes first indication information, and the first indication information is used to indicate that the first response code exists in the first memory. Response data, wherein the first memory is a virtual memory located in the user layer, and the first memory is used by the user layer to cache the first response data.
可选地,该第一内存可以是buf。Optionally, the first memory may be buf.
可选地,当根据该第一指示信息确定该第一内存中存在该第一响应数据时,通过读取第二内存,获得该第一响应数据,该第二内存位于该内核中,且与该第一内存具有映射关系。Optionally, when it is determined according to the first indication information that the first response data exists in the first memory, the first response data is obtained by reading the second memory, which is located in the core and is related to The first memory has a mapping relationship.
其中,该第二内存具体可以是页(pages),一个page对应一个buf。The second memory may specifically be pages, and one page corresponds to one buf.
本申请实施例中,位于内核中的第二内存与位于应用层中的第一内存(例如:buf)之间建立映射关系,使得存储于第一内存中的数据以page的形式呈现于第二内存中,该第一内存和第二内存本质上是同一块内存,读写第二内存就相当于读写第一内存,因此,内核能够直接读取应用层的数据,不需要将数据从应用层拷贝到内核中再进行读取或处理,能够明显节省计算机设备的性能开销;并且,还能够通过映射管理模块控制映射的速度,能够避免大量映射占用太多内存。In the embodiment of the present application, a mapping relationship is established between the second memory located in the kernel and the first memory (for example: buf) located in the application layer, so that the data stored in the first memory is presented in the form of a page in the second memory. In the memory, the first memory and the second memory are essentially the same memory. Reading and writing the second memory is equivalent to reading and writing the first memory. Therefore, the kernel can directly read the data of the application layer without the need to transfer the data from the application layer. The layer is copied to the kernel for reading or processing, which can significantly save the performance overhead of computer equipment; moreover, the mapping speed can also be controlled through the mapping management module, which can avoid a large number of mappings from occupying too much memory.
第三方面,提供一种应用于计算机设备的操作装置,该操作装置位于计算机设备的应用层,该操作装置包括:检测模块,用于检测内核中是否存在第一请求,该第一请求为需要发送给该应用层的请求;第一获取模块,用于当检测到内核中存在该第一请求时,读取该第一请求;处理模块,用于响应于该第一请求,向该内核发送第一响应。In a third aspect, an operating device for computer equipment is provided. The operating device is located at the application layer of the computer equipment. The operating device includes: a detection module for detecting whether there is a first request in the kernel. The first request is required A request sent to the application layer; a first acquisition module, used to read the first request when detecting that the first request exists in the kernel; a processing module, used to respond to the first request, send a request to the kernel First response.
可选地,该处理模块还用于:执行该第一请求对应的第一操作。Optionally, the processing module is also configured to perform the first operation corresponding to the first request.
其中,内核中可以存在一个或多个待处理请求,该一个或多个待处理请求中的每个 待处理请求均对应一个操作。There may be one or more pending requests in the kernel, and each of the one or more pending requests corresponds to an operation.
一个或多个待处理请求包括第一请求,该第一请求是指在内核请求链表中待处理顺序为1的待处理请求,因此,只要内核请求链表中存在待处理请求,就一定存在第一请求,其中,内核请求链表位于计算机设备的内核中,用于存放待处理请求。One or more pending requests include a first request, which refers to a pending request with a pending order of 1 in the kernel request list. Therefore, as long as there is a pending request in the kernel request list, there must be a first request. request, where the kernel request linked list is located in the kernel of the computer device and is used to store pending requests.
可选地,第一请求可以包括读请求、写请求、删请求中的任意一项,此外,第一请求还可以包括其他任意形式的请求,本申请对此不作限定。Optionally, the first request may include any one of a read request, a write request, and a delete request. In addition, the first request may also include any other form of request, which is not limited in this application.
本申请实施例中,能够实现由计算机设备的内核发起请求,计算机设备的应用程序对该请求进行响应,进而能够实现由计算机内核主动向应用程序传输数据,例如可以应用于应用程序向云磁盘传输云磁盘数据等场景。In the embodiments of the present application, the kernel of the computer device can initiate a request, and the application program of the computer device can respond to the request, thereby enabling the computer kernel to actively transmit data to the application program. For example, it can be applied to the application program transmitting data to a cloud disk. Scenarios such as cloud disk data.
结合第三方面,在一些可能的实施方式中,检测模块具体用于:通过调用poll函数检测内核请求链表中是否存在该第一请求,该内核请求链表位于该内核中。Combined with the third aspect, in some possible implementations, the detection module is specifically configured to: detect whether the first request exists in the kernel request linked list by calling the poll function, and the kernel request linked list is located in the kernel.
结合第三方面,在一些可能的实施方式中,第一获取模块具体用于:通过调用read函数读取该第一请求。In combination with the third aspect, in some possible implementations, the first acquisition module is specifically used to: read the first request by calling a read function.
结合第三方面,在一些可能的实施方式中,处理模块具体用于:通过调用ioctl函数向该内核发送该第一响应。Combined with the third aspect, in some possible implementations, the processing module is specifically configured to: send the first response to the kernel by calling an ioctl function.
本申请实施例中,通过调用poll函数检测到内核中存在第一请求时,进一步通过调用read函数读取内核中的该第一请求,读取完该第一请求后,执行该第一请求相对应的第一操作,然后通过调用ioctl函数向内核传递针对该第一请求的响应。该方案结合poll函数、read函数和ioctl函数,能够实现由计算机内核主动向应用程序传输数据,例如可以应用于应用程序向云磁盘传输云磁盘数据等场景。In the embodiment of the present application, when it is detected that there is a first request in the kernel by calling the poll function, the first request in the kernel is further read by calling the read function. After reading the first request, the first request phase is executed. The corresponding first operation is then passed to the kernel by calling the ioctl function in response to the first request. This solution combines the poll function, read function and ioctl function to enable the computer kernel to actively transmit data to the application. For example, it can be applied to scenarios such as applications transmitting cloud disk data to cloud disks.
结合第三方面,在一些可能的实施方式中,检测模块还具体用于:当检测到该内核中不存在该第一请求时,对内核请求链表进行阻塞,并等待该第一请求。Combined with the third aspect, in some possible implementations, the detection module is also specifically configured to: when detecting that the first request does not exist in the kernel, block the kernel request list and wait for the first request.
本申请实施例中,在内核中不存在待处理请求时,对内核请求链表进行阻塞,等待至内核请求链表中存在待处理请求时,调用read函数读取该请求,这样,相当于是对内核请求链表中的待处理请求进行监测,一旦存在便会立即对其读取,能够提升计算机设备的操作性能。In the embodiment of this application, when there is no pending request in the kernel, the kernel request list is blocked, and when there is a pending request in the kernel request list, the read function is called to read the request. In this way, it is equivalent to requesting the kernel. The pending requests in the linked list are monitored and read immediately once they exist, which can improve the operating performance of the computer equipment.
结合第三方面,在一些可能的实施方式中,处理模块还用于:响应于所述第一请求,生成第一响应数据。In conjunction with the third aspect, in some possible implementations, the processing module is further configured to: generate first response data in response to the first request.
其中,第一响应数据是指应用层执行第一请求对应的第一操作后,所生成的响应数据,例如,当第一请求为读请求时,第一响应数据可以是相对应的读数据。The first response data refers to the response data generated after the application layer performs the first operation corresponding to the first request. For example, when the first request is a read request, the first response data may be corresponding read data.
结合第三方面,在一些可能的实施方式中,第一响应包括该第一响应数据。Combined with the third aspect, in some possible implementations, the first response includes the first response data.
本申请实施例中,应用层生成第一响应数据后,直接将该第一响应数据传递给内核(例如:从应用层拷贝至内核),使得内核能够进一步根据该第一响应数据执行后续操作。In the embodiment of the present application, after the application layer generates the first response data, it directly transfers the first response data to the kernel (for example, copies it from the application layer to the kernel), so that the kernel can further perform subsequent operations based on the first response data.
结合第三方面,在一些可能的实施方式中,处理模块还用于:将该第一响应数据缓存于第一内存,该第一内存为位于用户层中的虚拟内存,该第一响应包括第一响应编码,该第一响应编码包括第一指示信息,该第一指示信息用于指示该第一内存中存在该第一响应数据。Combined with the third aspect, in some possible implementations, the processing module is further configured to: cache the first response data in a first memory, where the first memory is a virtual memory located in the user layer, and the first response includes the first response data. A response code, the first response code includes first indication information, the first indication information is used to indicate that the first response data exists in the first memory.
可选地,该第一内存可以是buf。Optionally, the first memory may be buf.
可选地,该第一内存与第二内存具有映射关系,该第二内存位于该内核中,该第二 内存用于该内核在根据该第一指示信息确定该第一内存中存在该第一响应数据时,读取该第一响应数据。Optionally, the first memory has a mapping relationship with a second memory, and the second memory is located in the core. The second memory is used by the core to determine that the first memory exists in the first memory according to the first indication information. When responding to data, read the first response data.
其中,该第二内存具体可以是页(pages),一个page对应一个buf。The second memory may specifically be pages, and one page corresponds to one buf.
本申请实施例中,位于内核中的第二内存与位于应用层中的第一内存(例如:buf)之间建立映射关系,使得存储于第一内存中的数据以page的形式呈现于第二内存中,该第一内存和第二内存本质上是同一块内存,读写第二内存就相当于读写第一内存,因此,内核能够直接读取应用层的数据,不需要将数据从应用层拷贝到内核中再进行读取或处理,能够明显节省计算机设备的性能开销;并且,还能够通过映射管理模块控制映射的速度,能够避免大量映射占用太多内存。In the embodiment of the present application, a mapping relationship is established between the second memory located in the kernel and the first memory (for example: buf) located in the application layer, so that the data stored in the first memory is presented in the form of a page in the second memory. In the memory, the first memory and the second memory are essentially the same memory. Reading and writing the second memory is equivalent to reading and writing the first memory. Therefore, the kernel can directly read the data of the application layer without the need to transfer the data from the application layer. The layer is copied to the kernel for reading or processing, which can significantly save the performance overhead of computer equipment; moreover, the mapping speed can also be controlled through the mapping management module, which can avoid a large number of mappings from occupying too much memory.
第四方面,提供一种应用于计算机设备的操作装置,该操作装置位于计算机设备的内核,该操作装置包括:生成模块,用于生成第一请求,该第一请求为需要发送给应用层的请求;第二获取模块,用于接收应用层在检测到内核中存在该第一请求时,为响应于该第一请求发送的第一响应。The fourth aspect provides an operating device applied to computer equipment. The operating device is located in the core of the computer equipment. The operating device includes: a generating module for generating a first request. The first request is a request that needs to be sent to the application layer. Request; a second acquisition module, configured to receive a first response sent by the application layer in response to the first request when detecting that the first request exists in the kernel.
其中,内核中可以存在一个或多个待处理请求,该一个或多个待处理请求中的每个待处理请求均对应一个操作。There may be one or more pending requests in the kernel, and each of the one or more pending requests corresponds to an operation.
一个或多个待处理请求包括第一请求,该第一请求是指在内核请求链表中待处理顺序为1的待处理请求,因此,只要内核请求链表中存在待处理请求,就一定存在第一请求,其中,内核请求链表位于计算机设备的内核中,用于存放待处理请求。One or more pending requests include a first request, which refers to a pending request with a pending order of 1 in the kernel request list. Therefore, as long as there is a pending request in the kernel request list, there must be a first request. request, where the kernel request linked list is located in the kernel of the computer device and is used to store pending requests.
可选地,第一请求可以包括读请求、写请求、删请求中的任意一项,此外,第一请求还可以包括其他任意形式的请求,本申请对此不作限定。Optionally, the first request may include any one of a read request, a write request, and a delete request. In addition, the first request may also include any other form of request, which is not limited in this application.
本申请实施例中,能够实现由计算机设备的内核发起请求,计算机设备的应用程序对该请求进行响应,进而能够实现由计算机内核主动向应用程序传输数据,例如可以应用于应用程序向云磁盘传输云磁盘数据等场景。In the embodiments of the present application, the kernel of the computer device can initiate a request, and the application program of the computer device can respond to the request, thereby enabling the computer kernel to actively transmit data to the application program. For example, it can be applied to the application program transmitting data to a cloud disk. Scenarios such as cloud disk data.
结合第四方面,在一些可能的实施方式中,内核接收到的第一响应是该应用层通过调用ioctl函数发送的。Combined with the fourth aspect, in some possible implementations, the first response received by the kernel is sent by the application layer by calling the ioctl function.
结合第四方面,在一些可能的实施方式中,第一响应包括该第一响应数据。In conjunction with the fourth aspect, in some possible implementations, the first response includes the first response data.
其中,第一响应数据是指应用层执行第一请求对应的第一操作后,所生成的响应数据,例如,当第一请求为读请求时,第一响应数据可以是相对应的读数据。The first response data refers to the response data generated after the application layer performs the first operation corresponding to the first request. For example, when the first request is a read request, the first response data may be corresponding read data.
本申请实施例中,应用层生成第一响应数据后,直接将该第一响应数据传递给内核(例如:从应用层拷贝至内核),使得内核能够进一步根据该第一响应数据执行后续操作。In the embodiment of the present application, after the application layer generates the first response data, it directly transfers the first response data to the kernel (for example, copies it from the application layer to the kernel), so that the kernel can further perform subsequent operations based on the first response data.
结合第四方面,在一些可能的实施方式中,该第一响应包括第一响应编码,该第一响应编码包括第一指示信息,该第一指示信息用于指示第一内存中存在该第一响应数据,其中,第一内存为位于用户层中的虚拟内存,该第一内存用于用户层缓存该第一响应数据。In conjunction with the fourth aspect, in some possible implementations, the first response includes a first response code, the first response code includes first indication information, and the first indication information is used to indicate that the first response code exists in the first memory. Response data, wherein the first memory is a virtual memory located in the user layer, and the first memory is used by the user layer to cache the first response data.
可选地,该第一内存可以是buf。Optionally, the first memory may be buf.
可选地,第二获取模块具体用于:当根据该第一指示信息确定该第一内存中存在该第一响应数据时,通过读取第二内存,获得该第一响应数据,该第二内存位于该内核中,且与该第一内存具有映射关系。Optionally, the second acquisition module is specifically configured to: when it is determined that the first response data exists in the first memory according to the first indication information, obtain the first response data by reading the second memory, and the second The memory is located in the core and has a mapping relationship with the first memory.
其中,该第二内存具体可以是页(pages),一个page对应一个buf。The second memory may specifically be pages, and one page corresponds to one buf.
本申请实施例中,位于内核中的第二内存与位于应用层中的第一内存(例如:buf)之间建立映射关系,使得存储于第一内存中的数据以page的形式呈现于第二内存中,该第一内存和第二内存本质上是同一块内存,读写第二内存就相当于读写第一内存,因此,内核能够直接读取应用层的数据,不需要将数据从应用层拷贝到内核中再进行读取或处理,能够明显节省计算机设备的性能开销;并且,还能够通过映射管理模块控制映射的速度,能够避免大量映射占用太多内存。In an embodiment of the present application, a mapping relationship is established between a second memory located in the kernel and a first memory (for example: buf) located in the application layer, so that the data stored in the first memory is presented in the second memory in the form of pages. The first memory and the second memory are essentially the same block of memory, and reading and writing the second memory is equivalent to reading and writing the first memory. Therefore, the kernel can directly read the data of the application layer, and there is no need to copy the data from the application layer to the kernel for reading or processing, which can significantly save the performance overhead of the computer device; and the mapping speed can also be controlled through the mapping management module, which can avoid a large number of mappings occupying too much memory.
第五方面,提供一种应用于计算机设备的操作装置,包括:处理器和存储器,存储器用于存储程序,处理器用于从存储器中调用并运行程序以执行如第一方面或第一方面中任一可能的实施方式中的应用于计算机设备的操作方法,或执行如第二方面或第二方面中任一可能的实施方式中的应用于计算机设备的操作方法。A fifth aspect provides an operating device applied to computer equipment, including: a processor and a memory, the memory is used to store a program, and the processor is used to call and run the program from the memory to execute the first aspect or any of the first aspects. An operating method applied to a computer device in a possible implementation, or performing the second aspect or the operating method applied to a computer device in any possible implementation of the second aspect.
第六方面,提供一种计算机设备,包括:如第三方面或第三方面中任一可能的实施方式中的应用于计算机设备的操作装置,或,包括如第四方面或第四方面中任一可能的实施方式中的应用于计算机设备的操作装置,或包括如第五方面中的应用于计算机设备的操作装置。In a sixth aspect, a computer device is provided, including: an operating device applied to the computer device as in the third aspect or any of the possible implementations of the third aspect, or including an operating device as in the fourth aspect or any of the fourth aspects. An operating device applied to computer equipment in a possible implementation may include an operating device applied to computer equipment as in the fifth aspect.
第七方面,提供一种计算机可读存储介质,包括计算机程序,当计算机程序在计算机上运行时,使得计算机执行如第一方面或第一方面中任一可能的实施方式中的应用于计算机设备的操作方法,或执行如第二方面或第二方面中任一可能的实施方式中的应用于计算机设备的操作方法。In the seventh aspect, a computer-readable storage medium is provided, comprising a computer program. When the computer program runs on a computer, the computer executes an operating method applied to a computer device as in the first aspect or any possible implementation of the first aspect, or executes an operating method applied to a computer device as in the second aspect or any possible implementation of the second aspect.
附图说明Description of drawings
图1是本申请实施例提供的计算机设备的一种示意性框架图。Figure 1 is a schematic frame diagram of a computer device provided by an embodiment of the present application.
图2是本申请实施例提供的计算机设备的另一示意性框架图。Figure 2 is another schematic frame diagram of a computer device provided by an embodiment of the present application.
图3是本申请实施例提供的一种应用于计算机设备的操作方法的示意性流程框图。FIG. 3 is a schematic flow chart of an operating method applied to a computer device provided by an embodiment of the present application.
图4是本申请实施例提供的另一应用于计算机设备的操作方法的示意性流程框图。FIG. 4 is a schematic flow diagram of another operating method applied to a computer device provided by an embodiment of the present application.
图5是本申请实施例提供的另一应用于计算机设备的操作方法的示意性流程框图。FIG. 5 is a schematic flow diagram of another operating method applied to a computer device provided by an embodiment of the present application.
图6是本申请实施例提供的内核读取第一响应数据的方法的示意性流程框图。FIG. 6 is a schematic flow chart of a method for a kernel to read first response data provided by an embodiment of the present application.
图7是本申请实施例提供的一种第一请求编码的组成示意图。Figure 7 is a schematic diagram of the composition of a first request encoding provided by an embodiment of the present application.
图8是本申请实施例提供的一种第一响应编码的组成示意图。Figure 8 is a schematic diagram of the composition of a first response encoding provided by an embodiment of the present application.
图9是本申请实施例提供的一种应用于计算机设备的操作方法的示意性流程框图。FIG. 9 is a schematic flow chart of an operating method applied to a computer device provided by an embodiment of the present application.
图10是本申请实施例提供的一种应用于计算机设备的操作装置的示意性结构框图。FIG. 10 is a schematic structural block diagram of an operating device applied to computer equipment provided by an embodiment of the present application.
图11是本申请实施例提供的另一应用于计算机设备的操作装置的示意性框架图。FIG. 11 is a schematic frame diagram of another operating device applied to computer equipment provided by an embodiment of the present application.
图12是本申请实施例提供的一种计算机设备的示意性结构框图。Figure 12 is a schematic structural block diagram of a computer device provided by an embodiment of the present application.
图13是本申请实施例提供的一种应用于计算机设备的操作方法的应用场景示意图。FIG. 13 is a schematic diagram of an application scenario of an operating method applied to a computer device provided by an embodiment of the present application.
图14是本申请实施例提供的另一应用于计算机设备的操作装置的示意性框架图。FIG. 14 is a schematic frame diagram of another operating device applied to computer equipment provided by an embodiment of the present application.
具体实施方式Detailed ways
下面将结合附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application will be described below with reference to the accompanying drawings.
本申请实施例提供的应用于计算机设备的操作方法可应用于计算机设备。可选地,该计算机设备是智能手机等手持设备,或个人计算机等终端设备,本申请并未特别限定。 本申请实施例提供的应用于计算机设备的操作方法的执行主体可以是计算机设备,或者,是计算机设备中的功能模块。The operating methods applied to computer equipment provided by the embodiments of the present application can be applied to computer equipment. Optionally, the computer device is a handheld device such as a smartphone, or a terminal device such as a personal computer, which is not particularly limited in this application. The execution subject of the operating method applied to the computer device provided by the embodiment of the present application may be the computer device, or a functional module in the computer device.
图1示出了本申请实施例提供的计算机设备1的一种示意性框架图。Figure 1 shows a schematic framework diagram of a computer device 1 provided by an embodiment of the present application.
如图1所示,该计算机设备1包括:硬件层10、运行在硬件层10之上的操作系统层20,以及运行在操作系统层20上的应用层30。该硬件层10包括处理器、内存和外存等硬件。该操作系统层20是任意一种或多种通过进程(process)实现业务处理的计算机操作系统,例如,Linux操作系统、Unix操作系统、Android操作系统、iOS操作系统或Windows操作系统等。该应用层30包含浏览器、通讯录、文字处理软件、即时通信软件等应用程序。As shown in FIG. 1 , the computer device 1 includes: a hardware layer 10 , an operating system layer 20 running on the hardware layer 10 , and an application layer 30 running on the operating system layer 20 . The hardware layer 10 includes hardware such as processors, memory, and external storage. The operating system layer 20 is any one or more computer operating systems that implement business processing through processes, such as Linux operating system, Unix operating system, Android operating system, iOS operating system or Windows operating system, etc. The application layer 30 includes application programs such as browsers, address books, word processing software, and instant messaging software.
具体地,操作系统层20包括内核(Kernel)201,其为操作系统层20的核心,负责管理系统的进程、内存、设备驱动程序、文件和网络系统等等,决定着系统的性能和稳定性。该内核201是连接应用层30和硬件层10的桥梁。Specifically, the operating system layer 20 includes a kernel (Kernel) 201, which is the core of the operating system layer 20 and is responsible for managing the system's processes, memory, device drivers, files, network systems, etc., and determines the performance and stability of the system. . The kernel 201 is a bridge connecting the application layer 30 and the hardware layer 10 .
在图1所示实施例的基础上,图2示出了本申请实施例提供的计算机设备1的另一示意性框架图。Based on the embodiment shown in Figure 1, Figure 2 shows another schematic frame diagram of the computer device 1 provided by the embodiment of the present application.
如图2所示,应用程序(Application,APP)301为应用层30中的计算机程序,其位于计算机设备1的用户空间(User Space),能够由用户进行使用和设计。As shown in Figure 2, the application program (Application, APP) 301 is a computer program in the application layer 30. It is located in the user space (User Space) of the computer device 1 and can be used and designed by the user.
相对于用户空间,操作系统层20中的内核201位于计算机设备1的内核空间(Kernel Space)。该内核201独立于用户级的应用程序,该内核201可以访问受保护的内存空间,也有访问底层硬件设备的所有权限。为了保证内核201的安全,操作系统层20一般都强制用户进程不能直接操作该内核201。Relative to the user space, the kernel 201 in the operating system layer 20 is located in the kernel space (Kernel Space) of the computer device 1 . The kernel 201 is independent of user-level applications. The kernel 201 has access to protected memory space and has full access to underlying hardware devices. In order to ensure the security of the kernel 201, the operating system layer 20 generally forces user processes not to directly operate the kernel 201.
可选地,在该内核空间中,内核201可包括:系统调用接口(System Call Interface,SCI)210,内存管理单元(Memory Management Unit,MMU)220,进程管理程序230,虚拟文件系统(Virtual File System,VFS)240,文件系统(File System,FS)250以及设备驱动(Device Driver)程序260等多种功能模块。Optionally, in the kernel space, the kernel 201 may include: a system call interface (System Call Interface, SCI) 210, a memory management unit (Memory Management Unit, MMU) 220, a process management program 230, and a virtual file system (Virtual File). System, VFS) 240, file system (File System, FS) 250 and device driver (Device Driver) program 260 and other functional modules.
具体地,在该内核201中,系统调用接口(SCI)210提供了用户空间访问内核空间的一个接口。在不同的计算机设备1的硬件架构下,通过SCI 210进入内核空间的方法是不同的。Specifically, in the kernel 201, the system call interface (SCI) 210 provides an interface for user space to access the kernel space. Under different hardware architectures of computer devices 1, the methods of entering the kernel space through SCI 210 are different.
内存管理单元(MMU)220用于控制计算机设备1中的内存与处理器之间的数据交互。具体地,MMU 220从处理器接收内存访问请求,并基于该内存访问请求控制针对内存的访问。The memory management unit (MMU) 220 is used to control data interaction between the memory and the processor in the computer device 1 . Specifically, the MMU 220 receives a memory access request from the processor and controls access to the memory based on the memory access request.
进程管理程序230为管理操作系统中多个进程的程序。该进程管理程序230能够用于实现:进程调度、中断处理、信号/进程优先级、上下文切换、进程状态管理、进度内存管理等多种功能。The process management program 230 is a program that manages multiple processes in the operating system. The process management program 230 can be used to implement various functions such as process scheduling, interrupt processing, signal/process priority, context switching, process status management, and progress memory management.
虚拟文件系统(VFS)240为文件系统(FS)250与系统调用接口(SCI)210之间的中间处理系统。在本申请实施例中,计算机设备1可以支持多种不同类型的文件系统,作为示例而非限定,FS 250中可以包括:EXT2,EXT3,EXT4,F2FS,rootfs,proc等多种类型的文件系统。The virtual file system (VFS) 240 is an intermediate processing system between the file system (FS) 250 and the system call interface (SCI) 210. In the embodiment of this application, the computer device 1 can support multiple different types of file systems. As an example but not a limitation, the FS 250 can include: EXT2, EXT3, EXT4, F2FS, rootfs, proc and other types of file systems. .
为了支撑不同的文件系统,VFS 240隐藏了不同文件系统的硬件的具体细节,把文件系统操作和不同文件系统的具体硬件实现分离开来,为所有的设备提供了统一的接口。In order to support different file systems, VFS 240 hides the specific details of the hardware of different file systems, separates file system operations from the specific hardware implementation of different file systems, and provides a unified interface for all devices.
设备驱动程序260是内核201的主要部分之一。该设备驱动程序260实际控制操作 系统层20和硬件层10之间的交互。具体地,该设备驱动程序260除了提供一组操作系统层20可理解的抽象接口完成和操作系统层20之间的交互以外,还用于完成与硬件层10中硬件设备相关的具体操作细节。一般而言,设备驱动程序260和硬件设备的控制芯片有关。Device driver 260 is one of the main parts of kernel 201. The device driver 260 actually controls the interaction between the operating system layer 20 and the hardware layer 10. Specifically, in addition to providing a set of abstract interfaces understandable by the operating system layer 20 to complete the interaction between the operating system layer 20 , the device driver 260 is also used to complete specific operation details related to the hardware devices in the hardware layer 10 . Generally speaking, the device driver 260 is related to the control chip of the hardware device.
可以理解的是,在本申请实施例中,上述操作系统层20中的内核201以及应用层30中的应用程序均为计算机设备1中的软件模块,其具体实现为计算机程序(或者也称计算机代码)。为了实现该程序功能,如图2所示,计算机设备1的硬件层10需包括至少一个处理器110。除处理器110以外,硬件层10还可以包括内存120和外存130等存储器。It can be understood that in the embodiment of the present application, the kernel 201 in the operating system layer 20 and the application program in the application layer 30 are both software modules in the computer device 1, which are specifically implemented as computer programs (or also called computer programs). code). In order to realize the program function, as shown in FIG. 2 , the hardware layer 10 of the computer device 1 needs to include at least one processor 110 . In addition to the processor 110, the hardware layer 10 may also include memories such as a memory 120 and an external memory 130.
具体地,处理器110的功能主要是解释计算机程序的指令以及处理计算机程序中的数据。其中,该计算机程序的指令以及计算机程序中的数据能够保存在计算机设备1的内存120和/或外存130中。Specifically, the function of the processor 110 is mainly to interpret instructions of the computer program and process data in the computer program. The instructions of the computer program and the data in the computer program can be stored in the memory 120 and/or the external memory 130 of the computer device 1 .
可选地,处理器110可能是集成电路芯片,具有信号的处理能力。作为示例而非限定,处理器110是可以是通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。其中,通用处理器是微处理器等。例如,该处理器110是中央处理单元(central processing unit,CPU)。Alternatively, the processor 110 may be an integrated circuit chip with signal processing capabilities. By way of example and not limitation, the processor 110 may be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), or a field programmable gate array. , FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Among them, the general-purpose processor is a microprocessor or the like. For example, the processor 110 is a central processing unit (CPU).
其中,每个处理器110包括至少一个处理单元。可选地,该处理单元也称为核心(core),是处理器最重要的组成部分。处理器110所有的计算、接受命令、存储命令、处理数据都由核心执行。可选地,每个处理器110还包括缓存,该缓存是数据交换的缓冲区。当处理单元要读取数据时,会首先从缓存中查找需要的数据,如果找到了则直接执行,找不到的话则从内存中找。由于缓存的运行速度比内存快得多,故缓存的作用就是帮助处理单元更快地运行。Each processor 110 includes at least one processing unit. Optionally, this processing unit is also called a core and is the most important component of the processor. All calculations, receiving commands, storing commands, and processing data of the processor 110 are performed by the core. Optionally, each processor 110 also includes a cache, which is a buffer for data exchange. When the processing unit wants to read data, it will first search the required data from the cache. If it is found, it will be executed directly. If it is not found, it will be searched from the memory. Since cache runs much faster than memory, the purpose of the cache is to help the processing unit run faster.
内存120也称为主存,其作用是用于暂时存放处理器110中的运算数据,以及与外存130交换的数据。该内存120与处理器110之间具有较快的数据读写速度。另外,该内存120能够为计算机设备1中的进程提供运行空间,例如,内存120中保存用于生成进程的计算机程序。计算机程序被处理器110运行而生成进程后,处理器110在内存120中为该进程分配对应的存储空间。内存120在上述进程对应的存储空间中保存进程运行期间产生的数据,例如,中间数据,或过程数据等等。The memory 120 is also called main memory, and is used to temporarily store operation data in the processor 110 and data exchanged with the external memory 130 . There is a fast data reading and writing speed between the memory 120 and the processor 110 . In addition, the memory 120 can provide running space for processes in the computer device 1. For example, the memory 120 stores computer programs for generating processes. After the computer program is run by the processor 110 to generate a process, the processor 110 allocates corresponding storage space for the process in the memory 120 . The memory 120 stores data generated during the running of the process, such as intermediate data, process data, etc., in the storage space corresponding to the above-mentioned process.
作为示例而非限定,在本申请实施例中,内存120可以是易失性存储器。其中,该易失性存储器可以是随机存取存储器(Random Access Memory,RAM)。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(Static RAM,SRAM)、动态随机存取存储器(Dynamic RAM,DRAM)等等。As an example and not a limitation, in the embodiment of the present application, the memory 120 may be a volatile memory. Wherein, the volatile memory may be random access memory (Random Access Memory, RAM). By way of illustration, but not limitation, many forms of RAM are available, such as static random access memory (Static RAM, SRAM), dynamic random access memory (Dynamic RAM, DRAM), and the like.
外存130也可称之为辅存,是指除计算机设备1内除了内存120及缓存以外的存储器。可选地,该外存130可以为断电后仍能保存数据的存储器。且该外存130可具有相对较大的容量,能够存储计算机设备1中的图片、视频、文字等文件数据以及应用程序,满足用户的使用需求。The external memory 130 can also be called auxiliary memory, which refers to the memory in the computer device 1 except the memory 120 and cache. Optionally, the external memory 130 can be a memory that can still save data after power is turned off. And the external memory 130 can have a relatively large capacity and can store file data such as pictures, videos, text, and application programs in the computer device 1 to meet the user's needs.
作为示例而非限定,在本申请实施例中,外存130可以为非易失性存储器、磁盘、光盘、U盘(也称USB闪存盘)或者安全数码卡(Secure Digital Memory Card,SD Card) 等等。其中,非易失性存储器可以包括以下存储器中的至少一种:只读存储器(Read-Only Memory,ROM)、可编程只读存储器(Programmable ROM,PROM)、可擦除可编程只读存储器(Erasable PROM,EPROM)、电可擦除可编程只读存储器(Electrically EPROM,EEPROM)和闪存(FLASH)。另外,磁盘可以是硬盘(Hard Disk)或者是软盘(Soft Disk),该硬盘可以包括:固态硬盘(Solid State Drive,SSD)、混合硬盘(Hybrid Hard Drive,HHD)以及机械硬盘(Hard Disk Drive,HDD)等等。As an example and not a limitation, in the embodiment of the present application, the external storage 130 can be a non-volatile memory, a magnetic disk, an optical disk, a U disk (also called a USB flash disk) or a Secure Digital Memory Card (SD Card) etc. Among them, the non-volatile memory may include at least one of the following memories: read-only memory (Read-Only Memory, ROM), programmable read-only memory (Programmable ROM, PROM), erasable programmable read-only memory ( Erasable PROM, EPROM), electrically erasable programmable read-only memory (Electrically EPROM, EEPROM) and flash memory (FLASH). In addition, the disk can be a hard disk (Hard Disk) or a floppy disk (Soft Disk). The hard disk can include: solid state drive (Solid State Drive, SSD), hybrid hard drive (Hybrid Hard Drive, HHD) and mechanical hard drive (Hard Disk Drive, HDD) and so on.
应理解,以上列举的计算机设备1的结构仅为示例性说明,本申请并未限定于此,本申请实施例的计算机设备1包括现有技术中计算机系统中的各种软件模块或者硬件模块,例如,对于硬件模块来讲,计算机设备1还包括:通信装置、传感器装置以及各种功能的外设装置等等。It should be understood that the structure of the computer device 1 listed above is only an illustrative description, and the application is not limited thereto. The computer device 1 in the embodiment of the application includes various software modules or hardware modules in computer systems in the prior art. For example, in terms of hardware modules, the computer device 1 also includes: communication devices, sensor devices, peripheral devices with various functions, and so on.
对于上述计算机设备1,内存120的存储空间主要影响计算机设备1的运行速度,因此,该内存120也可称之为“运存”。而外存130的存储空间主要影响计算机设备1存储文件数据的能力,该外存130的存储空间可理解为计算机设备1中用于存储文件数据的存储空间。For the above-mentioned computer device 1, the storage space of the memory 120 mainly affects the running speed of the computer device 1. Therefore, the memory 120 can also be called "operation memory". The storage space of the external memory 130 mainly affects the ability of the computer device 1 to store file data. The storage space of the external memory 130 can be understood as the storage space in the computer device 1 for storing file data.
作为一种示例,在计算机设备1为手机的情况下,计算机设备1的应用程序(application,APP)能够通过系统调用的方式实现特定功能。其中:As an example, when the computer device 1 is a mobile phone, the application (APP) of the computer device 1 can implement specific functions by way of system calls. Among them:
在一种具体的示例中,内核201提供了一系列的系统调用,应用程序301通过调用内核201提供的read函数来实现读文件数据的功能,该过程的代码执行流为应用程序301到内核201。In a specific example, the kernel 201 provides a series of system calls. The application program 301 implements the function of reading file data by calling the read function provided by the kernel 201. The code execution flow of this process is from the application program 301 to the kernel 201. .
在另一种具体的示例中,应用程序还可以通过ioctl来实现特定功能。应用程序301定义一套命令码,不同的命令码分别代表不同的功能,然后应用程序301将定义的命令码传递给ioctl,以使得内核201根据该命令码实现该命令码对应的功能,该过程的代码执行流为应用程序301到内核201。In another specific example, the application can also implement a specific function through ioctl. The application 301 defines a set of command codes, and different command codes represent different functions. Then the application 301 passes the defined command code to ioctl, so that the kernel 201 implements the function corresponding to the command code according to the command code. The code execution flow of this process is from the application 301 to the kernel 201.
当然,在其它示例中,计算机设备1也可以为其它类型的设备。Of course, in other examples, the computer device 1 may also be other types of devices.
可见,现有方案中,由于内核接口函数都是编译好的,需要应用层触发后才能进一步执行,因此,均是由应用程序301发起请求,由内核201进行响应;然而,在一些应用场景中(例如:应用程序301读取云磁盘数据),存在由内核201向应用程序301发起请求(例如:读请求、写请求、删请求等)或者传输数据的需求,现有方案无法满足这一需求。It can be seen that in the existing solution, since the kernel interface functions are compiled and need to be triggered by the application layer before further execution, the request is initiated by the application 301 and the kernel 201 responds; however, in some application scenarios, (For example: application 301 reads cloud disk data), there is a need for the kernel 201 to initiate a request (for example: read request, write request, delete request, etc.) or transmit data to the application 301. The existing solution cannot meet this demand. .
鉴于此,本申请实施例提供一种应用于计算机设备的操作方法,该方法能够实现由内核201向应用程序301发起请求或者传输数据。In view of this, embodiments of the present application provide an operating method applied to a computer device, which method enables the kernel 201 to initiate a request or transmit data to the application 301 .
图3示出了本申请实施例提供的一种应用于计算机设备的操作方法300的示意性流程框图。该操作方法300应用于计算机设备的应用层和内核。可选地,该应用层可以包括上文图1所示的应用层30和/或图2中所示的应用程序301;该内核可以包括上文图1和/或图2中所示的内核201。FIG. 3 shows a schematic flow chart of an operating method 300 applied to a computer device provided by an embodiment of the present application. The operation method 300 is applied to the application layer and kernel of the computer device. Optionally, the application layer may include the application layer 30 shown in FIG. 1 above and/or the application program 301 shown in FIG. 2; the kernel may include the kernel shown in FIG. 1 and/or FIG. 2 above. 201.
如图3所示,该操作方法300可以包括如下步骤。As shown in Figure 3, the operation method 300 may include the following steps.
S310:检测内核中是否有待处理请求。S310: Detect whether there are pending requests in the kernel.
其中,可选地,待处理请求位于内核请求链表中,该待处理请求包括第一请求,该第一请求是指在内核请求链表中待处理顺序为1的待处理请求,因此,只要内核请求链表中存在待处理请求,就一定存在第一请求。Optionally, the request to be processed is located in the kernel request list, and the request to be processed includes the first request. The first request refers to the request to be processed with the order of 1 in the kernel request list. Therefore, as long as the kernel request If there is a pending request in the linked list, there must be a first request.
其中,内核请求链表位于计算机设备的内核中,该内核请求链表中有一个或多个数据节点,该一个或多个数据节点中的每一个数据节点都代表一个待处理请求。The kernel request linked list is located in the kernel of the computer device. There are one or more data nodes in the kernel request linked list, and each data node in the one or more data nodes represents a pending request.
可选地,待处理请求的数量可以是一个,也可以是多个。Optionally, the number of pending requests can be one or multiple.
可选地,应用程序通过调用poll函数检测内核中是否有待处理请求。Optionally, the application detects whether there are pending requests in the kernel by calling the poll function.
S320:当检测到内核中有第一请求时,读取该第一请求。S320: When detecting the first request in the kernel, read the first request.
可选地,当检测到内核中没有第一请求(即没有待处理请求)时,应用程序进行阻塞等待,一直等待至内核中出现第一请求(即出现待处理请求),再进一步读取该第一请求。具体地:Optionally, when it is detected that there is no first request in the kernel (ie, no pending request), the application program blocks and waits until the first request appears in the kernel (ie, a pending request appears), and then further reads the first request. Specifically:
应用程序通过调用poll函数检测内核请求链表中是否有待处理请求,当内核请求链表中没有待处理请求时,应用程序对内核请求链表进行阻塞等待(即:poll函数不返回);一旦检测到内核请求链表中存在待处理请求时,poll函数立即返回,进而触发应用程序读取第一请求。The application detects whether there are pending requests in the kernel request list by calling the poll function. When there are no pending requests in the kernel request list, the application blocks and waits for the kernel request list (that is, the poll function does not return); once a kernel request is detected When there is a pending request in the linked list, the poll function returns immediately, triggering the application to read the first request.
可选地,应用程序通过调用read函数读取内核请求链表中的第一请求。Optionally, the application reads the first request in the kernel request list by calling the read function.
S330:执行该第一请求对应的操作。S330: Execute the operation corresponding to the first request.
可选地,应用程序先对第一请求进行解码,再进一步执行该第一请求对应的操作。Optionally, the application program first decodes the first request, and then further performs the operation corresponding to the first request.
S340:响应于该第一请求,向内核发送第一响应。S340: In response to the first request, send a first response to the kernel.
其中,应用程序执行完该第一请求对应的操作后,生成第一响应,并向内核传递该第一响应。After the application program completes the operation corresponding to the first request, it generates a first response and transmits the first response to the kernel.
可选地,应用程序通过调用ioctl函数向内核传递该第一响应。Optionally, the application passes the first response to the kernel by calling an ioctl function.
可选地,第一响应包括第一响应编码,该第一响应编码是指上述第一请求对应的响应编码。Optionally, the first response includes a first response code, which refers to the response code corresponding to the above-mentioned first request.
其中,应用程序通过调用ioctl函数向内核传递该第一响应,可以是:将该第一响应编码作为该ioctl函数对应的函数参数,通过函数调用的方式传递给内核。Wherein, the application program transfers the first response to the kernel by calling the ioctl function, which may be: using the first response encoding as a function parameter corresponding to the ioctl function, and passing it to the kernel through a function call.
可选地,第一响应包括第一响应数据,该第一响应数据是指第一请求对应的响应数据。Optionally, the first response includes first response data, where the first response data refers to response data corresponding to the first request.
具体地,在本申请实施例中,上述各操作步骤由计算机设备中操作系统的应用程序执行。Specifically, in this embodiment of the present application, each of the above operation steps is executed by an application program of the operating system in the computer device.
通过本申请实施例的技术方案,能够实现由计算机设备的内核发起请求,计算机设备的应用程序对该请求进行响应,进而能够实现由计算机内核主动向应用程序传输数据,例如可以应用于应用程序向云磁盘传输云磁盘数据等场景。Through the technical solutions of the embodiments of the present application, it is possible to realize that the kernel of the computer device initiates a request, and the application program of the computer device responds to the request, thereby enabling the computer core to actively transmit data to the application program. For example, it can be applied to the application program sending data to the application program. Scenarios such as cloud disk transmission of cloud disk data.
在图3所示实施例的基础上,示例性地,图4示出了本申请实施例提供的一种应用于计算机设备的操作方法400的示意性流程框图,该操作方法400应用于计算机设备的应用层和内核。Based on the embodiment shown in FIG. 3 , for example, FIG. 4 shows a schematic flow chart of an operating method 400 applied to a computer device provided by an embodiment of the present application. The operating method 400 is applied to a computer device. application layer and kernel.
如图4所示,该操作方法400可以包括如下步骤。As shown in Figure 4, the operation method 400 may include the following steps.
S410:应用程序通过调用poll函数,检测内核中是否存在待处理请求。S410: The application program detects whether there is a pending request in the kernel by calling the poll function.
其中,待处理请求包括第一请求。The pending requests include the first request.
其中,关于上述待处理请求和第一请求的解释在图3所示实施例中已做了详细说明,为了简洁,在此不再赘述。The explanation regarding the above-mentioned pending request and the first request has been described in detail in the embodiment shown in FIG. 3, and will not be repeated here for the sake of brevity.
S420:当检测到内核中存在第一请求时,应用程序通过调用read函数读取该第一请求。S420: When it is detected that the first request exists in the kernel, the application reads the first request by calling a read function.
可选地,当检测到内核中不存在第一请求(即不存在待处理请求)时,应用程序进行阻塞等待,一直等待至内核中出现第一请求,再进一步读取该第一请求。具体地:Optionally, when it is detected that the first request does not exist in the kernel (that is, there is no pending request), the application program blocks and waits until the first request appears in the kernel, and then further reads the first request. specifically:
应用程序通过调用poll函数检测内核请求链表内核中是否有待处理请求,当内核请求链表中没有待处理请求时,应用程序对内核请求链表进行阻塞等待(即:poll函数不返回);一旦检测到内核请求链表中存在待处理请求时,poll函数立即返回,进而触发应用程序调用read函数读取该内核请求链表中的第一请求。The application detects whether there are pending requests in the kernel request list by calling the poll function. When there are no pending requests in the kernel request list, the application blocks and waits for the kernel request list (that is, the poll function does not return); once the kernel is detected When there is a pending request in the request list, the poll function returns immediately, which triggers the application to call the read function to read the first request in the kernel request list.
其中,内核请求链表位于计算机设备的内核中,该内核请求链表中有一个或多个数据节点,该一个或多个数据节点中的每一个数据节点都代表一个待处理请求。The kernel request linked list is located in the kernel of the computer device. There are one or more data nodes in the kernel request linked list, and each data node in the one or more data nodes represents a pending request.
S430:应用程序对该第一请求进行解码。S430: The application decodes the first request.
应用程序通过调用read函数读取内核请求链表中的第一请求后,对所读取的该第一请求进行解码。After the application reads the first request in the kernel request list by calling the read function, it decodes the read first request.
S440:应用程序根据解码后的第一请求执行该第一请求对应的第一操作。S440: The application executes a first operation corresponding to the first request according to the decoded first request.
在一个示例中,若第一请求用于请求获取用户数据,该第一操作可以是:应用程序查询该用户数据,并将查询到的该用户数据压缩或者打包;该第一操作还可以包括验证操作(确定请求对象是否可信等);此外,该第一操作还可以是与第一请求相对应的其他操作,本申请对此不作限定。In one example, if the first request is for obtaining user data, the first operation may be: the application queries the user data and compresses or packages the queried user data; the first operation may also include verification. Operation (determining whether the requested object is trustworthy, etc.); in addition, the first operation may also be other operations corresponding to the first request, which is not limited in this application.
可选地,在应用程序执行上述第一操作后,对内核请求链表进行阻塞,直至该第一请求执行结束。Optionally, after the application program performs the above first operation, the kernel request linked list is blocked until the execution of the first request is completed.
S450:响应于第一请求,应用程序在执行第一操作后向内核发送第一响应。S450: In response to the first request, the application program sends a first response to the kernel after performing the first operation.
可选地,应用程序通过调用ioctl函数向内核发送第一响应。Optionally, the application sends the first response to the kernel by calling an ioctl function.
可选地,第一响应包括第一响应编码,该第一响应编码是指第一请求对应的响应编码。Optionally, the first response includes a first response code, and the first response code refers to a response code corresponding to the first request.
其中,应用程序通过调用ioctl函数向内核传递该第一响应,可以是:将该第一响应编码作为该ioctl函数对应的函数参数,通过函数调用的方式传递给内核。Wherein, the application program transfers the first response to the kernel by calling the ioctl function, which may be: using the first response encoding as a function parameter corresponding to the ioctl function, and passing it to the kernel through a function call.
可选地,第一响应包括第一响应数据,该第一响应数据是指第一请求对应的响应数据。Optionally, the first response includes first response data, where the first response data refers to response data corresponding to the first request.
可选地,在一种情况中,关于第一响应编码和第一响应数据的关系,可以是:第一响应编码中包括用于指示第一响应数据的存储地址的信息;在此情况下,内核可以通过“零拷贝”方案读取第一响应数据,关于该“零拷贝”方案,在后文图6所示的实施例中给出了示例性说明。Optionally, in one case, the relationship between the first response code and the first response data may be: the first response code includes information indicating the storage address of the first response data; in this case, The kernel can read the first response data through a "zero-copy" scheme. Regarding this "zero-copy" scheme, an exemplary explanation is given in the embodiment shown in FIG. 6 below.
具体地,在本申请实施例中,上述各操作步骤由计算机设备中操作系统的应用程序执行。Specifically, in this embodiment of the present application, each of the above operation steps is executed by an application program of the operating system in the computer device.
可选地,在本申请实施例中,步骤S430为可选步骤。Optionally, in this embodiment of the present application, step S430 is an optional step.
可选地,在本申请实施例中,步骤S410和步骤S420分别可以为上文所述实施例中步骤S310和步骤S320的一种实现方式。步骤S430至步骤S440可以为上文所述实施例中步骤S330的一种实现方式。步骤S450可以为上文所述实施例中步骤S340的一种实现方式。Optionally, in the embodiment of the present application, step S410 and step S420 may respectively be an implementation manner of step S310 and step S320 in the above-described embodiment. Steps S430 to S440 may be an implementation manner of step S330 in the embodiment described above. Step S450 may be an implementation of step S340 in the above-described embodiment.
通过本申请实施例的技术方案,能够实现由计算机设备的内核发起请求,计算机设备的应用程序对该请求进行响应,进而能够实现由计算机内核主动向应用程序传输数据,还能够实现应用程序向云磁盘传输云磁盘数据等。Through the technical solutions of the embodiments of the present application, the kernel of the computer device can initiate a request, and the application program of the computer device can respond to the request, thereby enabling the computer core to actively transmit data to the application program, and also enable the application program to send data to the cloud. Disk transfer cloud disk data, etc.
需要说明的是,除了上文图4所示实施例所描述的技术方案以外,本申请实施例还可以通过其它方式实现应用程序读取内核中的请求并做出响应。It should be noted that, in addition to the technical solutions described in the embodiment shown in Figure 4 above, embodiments of the present application can also implement other methods to enable applications to read requests in the kernel and respond.
在图3或者图4所示实施例的基础上,示例性地,图5示出了本申请实施例提供的一种应用于计算机设备的操作方法500的示意性流程框图,该操作方法500应用于计算机设备的应用层和内核。Based on the embodiment shown in Figure 3 or Figure 4, for example, Figure 5 shows a schematic flow diagram of an operating method 500 applied to a computer device provided by an embodiment of the present application. The operating method 500 applies For the application layer and kernel of computer equipment.
如图5所示,该操作方法500可以包括如下步骤。As shown in Figure 5, the operation method 500 may include the following steps.
S510:响应于第一请求,应用程序在执行第一操作后调用ioctl函数,该ioctl函数对应的参数为第一响应编码。S510: In response to the first request, the application program calls the ioctl function after performing the first operation, and the corresponding parameter of the ioctl function is the first response code.
其中,第一响应编码是指应用程序针对第一请求所生成的响应编码。The first response code refers to the response code generated by the application program in response to the first request.
具体地,第一响应编码作为ioctl函数对应的参数,这样,应用程序通过调用ioctl函数,就能够将第一响应编码传递给内核。Specifically, the first response code is used as the corresponding parameter of the ioctl function. In this way, the application program can pass the first response code to the kernel by calling the ioctl function.
S520:内核对该第一响应编码进行解码,得到第一请求的标识ID。S520: The kernel decodes the first response code and obtains the identification ID of the first request.
其中,关于第一响应编码的解释,在后文图8所示的实施例中给出了详细的说明。Among them, the explanation of the first response encoding is given in detail in the embodiment shown in FIG. 8 below.
S530:当第一响应编码中存在关于第一响应数据的描述时,内核读取该第一响应数据。S530: When there is a description about the first response data in the first response encoding, the kernel reads the first response data.
其中,第一响应数据是指应用程序针对第一请求所生成的响应数据。The first response data refers to the response data generated by the application program in response to the first request.
可选地,在一种情况中,关于第一响应编码和第一响应数据的关系,可以是:第一响应编码中包括用于指示第一响应数据的存储地址的信息;在此情况下,内核可以通过“零拷贝”方案读取第一响应数据,关于该“零拷贝”方案,在后文图6所示的实施例中给出了示例性说明。Optionally, in one case, the relationship between the first response code and the first response data may be: the first response code includes information indicating the storage address of the first response data; in this case, The kernel can read the first response data through a "zero-copy" scheme. Regarding this "zero-copy" scheme, an exemplary explanation is given in the embodiment shown in FIG. 6 below.
可选地,在又一种情况中,关于第一响应编码和第一响应数据的关系,还可以是:第一响应编码中包括第一响应数据。Optionally, in yet another situation, regarding the relationship between the first response code and the first response data, it may also be: the first response code includes the first response data.
可选地,第一响应编码中存在关于第一响应数据的描述,可以是存在响应参数(即响应参数不为空),例如:如果编码中有arg描述了数据buf,则表明存在关于第一响应数据的描述,具体示例参见后文图8所示的实施例。Optionally, there is a description about the first response data in the first response encoding, which can be the presence of a response parameter (that is, the response parameter is not empty). For example: if there is arg in the encoding describing the data buf, it indicates that there is a description about the first response data. For a description of the response data, please refer to the embodiment shown in Figure 8 below for specific examples.
S540:内核根据第一请求的ID向第一请求发送该第一响应数据。S540: The kernel sends the first response data to the first request according to the ID of the first request.
可选地,内核根据第一请求的ID向内核请求链表中的待处理请求发送该第一响应数据,当第一请求的ID与内核请求链表中的第一请求的ID成功匹配后,该第一请求从内核请求链表中移除,并基于该第一响应数据,内核进一步执行后续操作。Optionally, the kernel sends the first response data to the pending request in the kernel request list according to the ID of the first request. When the ID of the first request successfully matches the ID of the first request in the kernel request list, the first response data is sent to the pending request in the kernel request list. A request is removed from the kernel request list, and based on the first response data, the kernel further performs subsequent operations.
可选地,在本申请实施例中,步骤S510至步骤S540可以为上文所述实施例中步骤S450的一种实现方式。Optionally, in the embodiment of the present application, steps S510 to S540 may be an implementation manner of step S450 in the embodiment described above.
本申请实施例可以视为在图3或图4所示实施例的基础上的方案延伸。The embodiment of the present application can be regarded as a solution extension based on the embodiment shown in Fig. 3 or Fig. 4.
通过该技术方案,当内核中存在需要发送给应用程序的请求或者数据时,应用程序调用read函数读取该请求或者数据,并进一步执行该请求或者数据对应的操作,以及在操作执行结束后向内核传递该请求或者数据的响应信息,这样,能够实现由内核发起请求,并由应用程序进行响应的方案,进而能够实现由计算机内核主动向应用程序传输数据,还能够实现应用程序向云磁盘传输云磁盘数据等。Through this technical solution, when there is a request or data that needs to be sent to the application program in the kernel, the application program calls the read function to read the request or data, and further performs the operation corresponding to the request or data, and after the operation is completed, The kernel transmits the response information of the request or data. In this way, the kernel can initiate the request and the application program responds. This can further enable the computer kernel to actively transmit data to the application program, and also enable the application program to transmit data to the cloud disk. Cloud disk data, etc.
示例性地,图6示出了本申请实施例提供的一种内核读取第一响应数据的方法600的示意性流程图。该方法600同样应用于计算机设备的应用层和内核。可选地,该应用层可以包括上文图1所示的应用层30和/或图2中所示的应用程序301;该内核可以包括 上文图1和/或图2中所示的内核201。Exemplarily, FIG. 6 shows a schematic flow chart of a method 600 for a kernel to read first response data provided by an embodiment of the present application. The method 600 also applies to the application layer and kernel of the computer device. Optionally, the application layer may include the application layer 30 shown in FIG. 1 above and/or the application program 301 shown in FIG. 2; the kernel may include the kernel shown in FIG. 1 and/or FIG. 2 above. 201.
如图6所示,该方法600包括如下步骤。As shown in Figure 6, the method 600 includes the following steps.
S610:应用程序生成第一响应数据,并将该第一响应数据存储于第一内存,该第一内存为位于应用层的虚拟内存(数据缓冲区)。S610: The application program generates first response data and stores the first response data in the first memory. The first memory is a virtual memory (data buffer) located at the application layer.
可选地,该第一内存可以是buf。Optionally, the first memory may be buf.
S620:内核层从第二内存中获取第一响应数据,该第二内存与第一内存具有映射关系,该第二内存位于内核层。S620: The kernel layer obtains the first response data from the second memory. The second memory has a mapping relationship with the first memory. The second memory is located at the kernel layer.
其中,该第二内存具体可以是页(pages),一个page对应一个buf。The second memory may specifically be pages, and one page corresponds to one buf.
其中,可选地,内核通过get user pages函数建立第二内存到第一内存的映射,该映射建立后,存储于第一内存中的第一响应数据在内核中的第二内存中呈现(以page的形式呈现),因此,内核可以直接通过第二内存读取该第一响应数据。Among them, optionally, the kernel establishes a mapping from the second memory to the first memory through the get user pages function. After the mapping is established, the first response data stored in the first memory is presented in the second memory in the kernel (in the form of pages). Therefore, the kernel can directly read the first response data through the second memory.
可选地,步骤S620之前还可以包括步骤:Optionally, step S620 may also include the following steps:
S630:应用程序向内核传递第一响应编码。S630: The application passes the first response code to the kernel.
当第一响应编码中存在对第一响应数据的描述时,进一步执行上述步骤S620。When the description of the first response data exists in the first response encoding, the above-mentioned step S620 is further performed.
通过本申请实施例的技术方案,基于内核中的第二内存和应用层的第一内存建立的映射关系,内核能够直接在内核中读取应用程序生成的第一响应数据,不需要将第一响应数据从应用层拷贝到内核,节省了拷贝数据过程占用的性能开销,从而提升计算机设备的性能,进而提升用户对计算机设备的使用体验。Through the technical solutions of the embodiments of this application, based on the mapping relationship established between the second memory in the kernel and the first memory in the application layer, the kernel can directly read the first response data generated by the application program in the kernel, without the need to transfer the first response data to the kernel. The response data is copied from the application layer to the kernel, which saves the performance overhead occupied by the process of copying data, thus improving the performance of the computer device and thereby improving the user experience of the computer device.
为了更加清楚地理解本申请实施例中提供的内核产生的待处理请求以及应用程序生成的第一响应,以下,结合图7和图8,分别对第一请求编码和第一响应编码进行说明。其中,第一请求编码为上述图3至图6所示实施例中所述的第一请求对应的编码。并且,以上所述的读取第一请求,实则为读取该第一请求对应的编码。In order to more clearly understand the pending request generated by the kernel and the first response generated by the application program provided in the embodiment of the present application, the first request encoding and the first response encoding will be described below in conjunction with Figures 7 and 8. Wherein, the first request code is the code corresponding to the first request described in the embodiment shown in FIGS. 3 to 6 . Moreover, reading the first request described above is actually reading the code corresponding to the first request.
示例性地,图7示出了本申请实施例提供的一种第一请求编码700的组成示意图。Exemplarily, FIG. 7 shows a schematic diagram of the composition of a first request encoding 700 provided by an embodiment of the present application.
如图7所示,第一请求编码700包括操作码、文件识别码(ID)、请求编码(ID)和请求参数。其中:As shown in Figure 7, the first request code 700 includes an operation code, a file identification code (ID), a request code (ID), and request parameters. in:
操作码例如可以是op,用于描述该第一请求用于执行什么操作,比如读(read)操作,打开(open)操作等。The operation code may be, for example, op, which is used to describe what operation the first request is used to perform, such as a read operation, an open operation, etc.
文件识别码例如可以是fid,用于唯一标识系统内的一个文件。其中,该唯一标识的文件为用户态的文件,也是该第一请求将要访问的文件,例如,当应用程序需要读取云磁盘数据时,该唯一标识的文件可以是云磁盘上的对应文件。The file identification code can be, for example, fid, which is used to uniquely identify a file in the system. The uniquely identified file is a user-mode file and is also the file to be accessed by the first request. For example, when an application needs to read cloud disk data, the uniquely identified file can be a corresponding file on the cloud disk.
请求编码例如可以是rid,用于对该第一请求进行编号,以区分系统内的多个请求,相当于是该第一请求的标识信息。The request code may be, for example, a rid, which is used to number the first request to distinguish multiple requests in the system, and is equivalent to the identification information of the first request.
请求参数例如可以是arg1~argN。The request parameters may be, for example, arg1 to argN.
示例性地,图8示出了本申请实施例提供的一种第一响应编码800的组成示意图。Exemplarily, FIG. 8 shows a schematic diagram of the composition of a first response code 800 provided by the embodiment of the present application.
应理解:第一响应编码是第一请求编码的响应编码。It should be understood that the first response code is the response code of the first request code.
如图8所示,第一响应编码800包括请求编码(ID)、状态码、文件路径、分片信息和响应参数。其中:As shown in Figure 8, the first response code 800 includes a request code (ID), status code, file path, fragmentation information and response parameters. in:
请求编码例如可以是rid,用于对该第一请求进行编号,以区分系统内的多个请求,相当于是该第一请求的标识信息。The request code may be, for example, a rid, which is used to number the first request to distinguish multiple requests in the system, and is equivalent to the identification information of the first request.
状态码例如可以是err,用于描述第一请求的执行状态。The status code may be, for example, err, which is used to describe the execution status of the first request.
可选地,该状态码可以是根据第一请求的类型定义的一些错误码,例如:当第一请求为读请求时,对应的执行状态可以是网络错误、网络差、网络文件不存在等。Optionally, the status code may be some error codes defined according to the type of the first request. For example, when the first request is a read request, the corresponding execution status may be network error, network difference, network file does not exist, etc.
文件路径例如可以是path,用于描述第一请求访问文件的绝对路径。The file path may be, for example, path, which is used to describe the absolute path of the file accessed by the first request.
应理解:如果第一请求没有访问文件,该文件路径对应的字段为空(NULL)。It should be understood that if the first request does not access the file, the field corresponding to the file path will be empty (NULL).
如果第一响应数据比较多,需要分片传输时,分片信息对应的字段可以是frag。If the first response data is relatively large and needs to be transmitted in fragments, the field corresponding to the fragmentation information can be frag.
可选地,如果第一响应数据不需要分片传输时,分片信息对应的字段为空(NULL)。Optionally, if the first response data does not require fragmented transmission, the field corresponding to the fragmentation information is empty (NULL).
响应参数例如可以是arg1~argN:用于描述第一响应数据(即:应用程序针对第一请求的响应数据)。The response parameters may be, for example, arg1 to argN: used to describe the first response data (that is, the response data of the application program for the first request).
其中,第一响应数据包括多个响应数据,该多个响应数据中的每个响应数据分别对应一个arg。The first response data includes multiple response data, and each response data in the multiple response data corresponds to one arg.
可选地,响应参数描述的是第一响应数据的地址信息。Optionally, the response parameter describes the address information of the first response data.
示例性地,图9示出了本申请实施例提供的一种应用于计算机设备的操作方法900的示意图。该方法900同样应用于计算机设备的应用层和内核。可选地,该应用层可以包括上文图1所示的应用层30和/或图2中所示的应用程序301;该内核可以包括上文图1和/或图2中所示的内核201。Exemplarily, FIG. 9 shows a schematic diagram of an operating method 900 applied to a computer device provided by an embodiment of the present application. The method 900 also applies to the application layer and kernel of the computer device. Optionally, the application layer may include the application layer 30 shown in FIG. 1 above and/or the application program 301 shown in FIG. 2; the kernel may include the kernel shown in FIG. 1 and/or FIG. 2 above. 201.
如图9所示,内核请求链表中存放有一个或多个待处理请求,该待处理请求是指需要发送给应用程序301的请求,该一个或多个待处理请求包括第一请求,关于该第一请求的解释在图3至图8所示的实施例中已经做出了详细说明,为了简洁,在此不再赘述。As shown in Figure 9, one or more pending requests are stored in the kernel request list. The pending requests refer to requests that need to be sent to the application program 301. The one or more pending requests include the first request. Regarding the The explanation of the first request has been described in detail in the embodiment shown in FIGS. 3 to 8 , and will not be repeated here for the sake of brevity.
应用程序通过调用poll函数,检测内核请求链表中是否有待处理请求,当检测到该内核请求链表中没有待处理请求时,对该内核请求链表进行阻塞等待,直至检测到该内核请求链表中存在待处理请求(第一请求)时,继续调用read函数,通过该read函数读取该第一请求。The application detects whether there are pending requests in the kernel request list by calling the poll function. When it is detected that there are no pending requests in the kernel request list, the application blocks and waits until it detects that there are pending requests in the kernel request list. When processing the request (the first request), continue to call the read function, and read the first request through the read function.
其中,内核请求链表中的第一请求即为上述图7所示实施例中所述的第一请求编码。The first request in the kernel request list is the first request code described in the embodiment shown in FIG. 7 .
可选地,内核请求链表中的每个待处理请求均对应一个操作(例如:第一请求对应第一操作)。Optionally, each pending request in the kernel request list corresponds to an operation (for example, the first request corresponds to the first operation).
可选地,内核提供了device_create函数,通过调用该device_create函数接口即可以创建一个设备文件,该设备文件的操作集中包括内核提供的poll函数和read函数。Optionally, the kernel provides the device_create function. By calling the device_create function interface, a device file can be created. The operation set of the device file includes the poll function and the read function provided by the kernel.
可选地,内核定义一个struct file_operations变量,然后通过该struct file_operations变量管理上述设备文件的操作函数集,进而实现应用程序对read函数和poll函数的调用。Optionally, the kernel defines a struct file_operations variable, and then manages the operation function set of the above device file through the struct file_operations variable, thereby enabling the application to call the read function and poll function.
上文结合图3至图9说明了本申请提供的应用于计算机设备的操作方法实施例,下面,结合图10和图11,说明本申请提供的应用于计算机设备的操作装置实施例。应理解,装置实施例与方法实施例相互对应,类似的描述可以参照方法实施例。The above describes the embodiment of the operating method applied to the computer equipment provided by the present application with reference to FIGS. 3 to 9 . Next, the embodiment of the operating device provided by the present application applied to the computer equipment is described with reference to FIGS. 10 and 11 . It should be understood that the device embodiments and method embodiments correspond to each other, and similar descriptions may refer to the method embodiments.
图10示出了本申请实施例提供的一种应用于计算机设备的操作装置1000的示意性结构框图。具体地,该操作装置1000位于计算机设备的应用层。例如,该操作装置1000位于上文图1所示实施例中的应用层30和/或图2所示实施例中的应用程序301。Figure 10 shows a schematic structural block diagram of an operating device 1000 applied to computer equipment provided by an embodiment of the present application. Specifically, the operating device 1000 is located at the application layer of the computer equipment. For example, the operating device 1000 is located in the application layer 30 in the embodiment shown in FIG. 1 and/or the application program 301 in the embodiment shown in FIG. 2 .
如图10所示,该操作装置1000包括:第一获取模块1010以及处理模块1020。As shown in Figure 10, the operating device 1000 includes: a first acquisition module 1010 and a processing module 1020.
具体地,该第一获取模块1010用于:检测内核中是否有待处理请求;还用于在检测到内核中有第一请求时,读取该第一请求。Specifically, the first acquisition module 1010 is used to: detect whether there is a pending request in the kernel; and read the first request when it is detected that there is a first request in the kernel.
其中,读取该第一请求可理解为读取该第一请求对应的编码(第一请求编码)。Wherein, reading the first request can be understood as reading the code corresponding to the first request (first request code).
其中,可选地,待处理请求位于内核请求链表中,该待处理请求包括第一请求,该 第一请求是指在内核请求链表中待处理顺序为1的待处理请求,因此,只要内核请求链表中存在待处理请求,就一定存在第一请求。Among them, optionally, the pending request is located in the kernel request linked list, and the pending request includes a first request, and the first request refers to the pending request with a pending order of 1 in the kernel request linked list. Therefore, as long as there are pending requests in the kernel request linked list, there must be a first request.
其中,内核请求链表位于计算机设备的内核中,该内核请求链表中有一个或多个数据节点,该一个或多个数据节点中的每一个数据节点都代表一个待处理请求。The kernel request linked list is located in the kernel of the computer device. There are one or more data nodes in the kernel request linked list, and each data node in the one or more data nodes represents a pending request.
可选地,待处理请求的数量可以是一个,也可以是多个。Optionally, the number of pending requests can be one or multiple.
可选地,第一获取模块1010通过调用poll函数检测内核中是否有待处理请求。Optionally, the first acquisition module 1010 detects whether there are pending requests in the kernel by calling the poll function.
可选地,当第一获取模块1010检测到内核中没有第一请求(待处理请求)时,第一获取模块1010进行阻塞等待,一直等待至内核中出现第一请求,再进一步读取该第一请求。具体地:Optionally, when the first acquisition module 1010 detects that there is no first request (pending request) in the kernel, the first acquisition module 1010 blocks and waits until the first request appears in the kernel, and then further reads the first request. One request. specifically:
第一获取模块1010通过调用poll函数检测内核中是否有待处理请求,当内核请求链表中没有待处理请求时,第一获取模块1010对内核请求链表进行阻塞等待(即:poll函数不返回);一旦检测到内核请求链表中存在待处理请求时,poll函数立即返回,进而触发第一获取模块1010读取第一请求。The first acquisition module 1010 detects whether there are pending requests in the kernel by calling the poll function. When there are no pending requests in the kernel request list, the first acquisition module 1010 blocks and waits for the kernel request list (that is, the poll function does not return); once When it is detected that there is a pending request in the kernel request list, the poll function returns immediately, thereby triggering the first acquisition module 1010 to read the first request.
可选地,检测内核中是否有待处理请求的操作,可以是由单独的检测模块完成;也可以是由检测模块和第一获取模块1010协同完成。Optionally, the operation of detecting whether there is a pending request in the kernel may be completed by a separate detection module; or may be completed by the detection module and the first acquisition module 1010 in collaboration.
可选地,第一获取模块1010通过调用read函数读取内核请求链表中的第一请求。Optionally, the first acquisition module 1010 reads the first request in the kernel request list by calling the read function.
该处理模块1020用于:执行该第一请求对应的操作。The processing module 1020 is configured to perform operations corresponding to the first request.
可选地,处理模块1020先对第一请求进行解码,再进一步执行该第一请求对应的操作。Optionally, the processing module 1020 first decodes the first request, and then further performs the operation corresponding to the first request.
该处理模块1020还用于生成第一响应。The processing module 1020 is also used to generate a first response.
可选地,处理模块1020通过调用ioctl函数向内核发送第一响应。Optionally, the processing module 1020 sends the first response to the kernel by calling the ioctl function.
可选地,第一响应包括第一响应编码,该第一响应编码是指第一请求对应的响应编码。Optionally, the first response includes a first response code, and the first response code refers to a response code corresponding to the first request.
其中,处理模块1020通过调用ioctl函数向内核传递该第一响应,可以是:将该第一响应编码作为该ioctl函数对应的函数参数,通过函数调用的方式传递给内核。The processing module 1020 transfers the first response to the kernel by calling the ioctl function, which may be: using the first response encoding as a function parameter corresponding to the ioctl function, and passing it to the kernel through a function call.
可选地,第一响应包括第一响应数据,该第一响应数据是指第一请求对应的响应数据。Optionally, the first response includes first response data, where the first response data refers to response data corresponding to the first request.
可选地,向内核发送第一响应的操作,可以是由单独的收发模块完成,也可以是由收发模块和处理模块1020协同完成。Optionally, the operation of sending the first response to the kernel may be completed by a separate transceiver module, or may be completed by the transceiver module and the processing module 1020 in collaboration.
通过本申请实施例的操作装置,能够实现由计算机设备的内核发起请求,计算机设备的应用程序对该请求进行响应,进而能够实现由计算机内核主动向应用程序传输数据,还能够实现应用程序向云磁盘传输云磁盘数据等。Through the operating device of the embodiment of the present application, the kernel of the computer device can initiate a request, and the application program of the computer device can respond to the request, thereby enabling the computer core to actively transmit data to the application program, and also enable the application program to send data to the cloud. Disk transfer cloud disk data, etc.
可选地,图11示出了本申请实施例提供的一种应用于计算机设备的操作装置1100的示意性结构框图。Optionally, FIG. 11 shows a schematic structural block diagram of an operating device 1100 applied to computer equipment provided by an embodiment of the present application.
如图11所示,该操作装置1100包括:第一获取模块1110、处理模块1120和第二获取模块1130。其中,第一获取模块1110和处理模块1120位于计算机设备的用户空间中,第二获取模块1130位于计算机设备的内核空间中。具体地:As shown in FIG11 , the operating device 1100 includes: a first acquisition module 1110, a processing module 1120, and a second acquisition module 1130. The first acquisition module 1110 and the processing module 1120 are located in the user space of the computer device, and the second acquisition module 1130 is located in the kernel space of the computer device. Specifically:
第一获取模块1110,用于通过调用poll函数,检测内核中是否存在待处理请求。The first acquisition module 1110 is used to detect whether there is a pending request in the kernel by calling the poll function.
其中,待处理请求包括第一请求。The pending requests include the first request.
其中,关于上述待处理请求和第一请求的解释在图3所示实施例中已做了详细说明, 为了简洁,在此不再赘述。The explanation regarding the above-mentioned pending request and the first request has been described in detail in the embodiment shown in FIG. 3 , and will not be repeated here for the sake of brevity.
第一获取模块1110,还用于当检测到内核中存在第一请求时,通过调用read函数读取该第一请求。The first acquisition module 1110 is also configured to read the first request by calling the read function when detecting that there is a first request in the kernel.
可选地,当检测到内核中不存在第一请求(待处理请求)时,第一获取模块1110进行阻塞等待,一直等待至内核中出现第一请求,再进一步读取该第一请求。具体地:Optionally, when detecting that there is no first request (pending request) in the kernel, the first acquisition module 1110 blocks and waits until the first request appears in the kernel, and then further reads the first request. specifically:
第一获取模块1110通过调用poll函数检测内核中是否有待处理请求,当内核请求链表中没有待处理请求时,应用程序对内核请求链表进行阻塞等待(即:poll函数不返回);一旦检测到内核请求链表中存在待处理请求时,poll函数立即返回,进而触发第一获取模块1110调用read函数读取第一请求。The first acquisition module 1110 detects whether there are pending requests in the kernel by calling the poll function. When there are no pending requests in the kernel request list, the application blocks and waits for the kernel request list (that is, the poll function does not return); once the kernel is detected When there is a pending request in the request list, the poll function returns immediately, which triggers the first acquisition module 1110 to call the read function to read the first request.
处理模块1120,用于对该第一请求进行解码。The processing module 1120 is used to decode the first request.
处理模块1120,还用于根据解码后的第一请求执行该第一请求对应的第一操作。The processing module 1120 is further configured to execute a first operation corresponding to the first request according to the decoded first request.
在一个示例中,若第一请求用于请求获取用户数据,该第一操作可以是:查询该用户数据,并将查询到的该用户数据压缩或者打包;该第一操作还可以包括验证操作(确定请求对象是否可信等);此外,该第一操作还可以是与第一请求相对应的其他操作,本申请对此不作限定。In one example, if the first request is used to request to obtain user data, the first operation may be: query the user data, and compress or package the queried user data; the first operation may also include a verification operation ( Determine whether the request object is trustworthy, etc.); In addition, the first operation may also be other operations corresponding to the first request, which is not limited in this application.
该处理模块1120还用于生成第一响应。The processing module 1120 is further configured to generate a first response.
可选地,处理模块1120还用于在执行第一操作后通过调用ioctl函数向内核传递第一响应。Optionally, the processing module 1120 is further configured to transmit a first response to the kernel by calling an ioctl function after executing the first operation.
可选地,第一响应包括第一响应编码,该第一响应编码是指第一请求对应的响应编码。Optionally, the first response includes a first response code, where the first response code refers to a response code corresponding to the first request.
其中,处理模块1120通过调用ioctl函数向内核传递该第一响应,可以是:将该第一响应编码作为该ioctl函数对应的函数参数,通过函数调用的方式传递给内核。The processing module 1120 transfers the first response to the kernel by calling the ioctl function, which may be: using the first response encoding as a function parameter corresponding to the ioctl function, and passing it to the kernel through a function call.
可选地,第一响应包括第一响应数据,该第一响应数据为第一请求对应的响应数据。Optionally, the first response includes first response data, and the first response data is response data corresponding to the first request.
第二获取模块1130,用于对该第一响应编码进行解码,得到第一请求的标识ID。The second acquisition module 1130 is used to decode the first response code to obtain the identification ID of the first request.
第二获取模块1130,还用于当第一响应编码中存在关于第一响应数据的描述时,读取该第一响应数据。The second acquisition module 1130 is also configured to read the first response data when there is a description of the first response data in the first response code.
可选地,第一响应编码中存在关于第一响应数据的描述,可以是存在响应参数(即响应参数不为空),例如:如果编码中有arg描述了数据buf,则表明存在关于第一响应数据的描述,具体示例参见图8所示的实施例。Optionally, there is a description about the first response data in the first response encoding, which can be the presence of a response parameter (that is, the response parameter is not empty). For example: if there is arg in the encoding describing the data buf, it indicates that there is a description about the first response data. For a description of the response data, see the embodiment shown in Figure 8 for specific examples.
可以理解的是,图10和图11仅作为示意而非限定,该操作装置1000和/或操作装置1100所在的计算机设备除了包括如图中所示的各功能模块以外,还可以包括相关技术中的其它功能模块,例如,在操作装置1000和/或操作装置1100所在的计算机设备的内核中,还可以包括:如图2中所示的内存管理单元220和进程管理程序230。又例如,操作装置1000和/或操作装置1100所在的计算机设备的硬件层还包括:如图2所示的处理器110和内存120。It can be understood that FIG. 10 and FIG. 11 are only illustrative and not limiting. In addition to the functional modules shown in the figures, the operating device 1000 and/or the computer equipment where the operating device 1100 is located may also include functional modules in related technologies. Other functional modules, for example, in the kernel of the computer device where the operating device 1000 and/or the operating device 1100 is located, may also include: a memory management unit 220 and a process management program 230 as shown in FIG. 2 . For another example, the hardware layer of the computer device where the operating device 1000 and/or the operating device 1100 is located also includes: a processor 110 and a memory 120 as shown in FIG. 2 .
示例性地,与图6所示实施例相对应地,图12示出了本申请实施例提供的一种计算机设备1200,该计算机设备1200包括应用程序301和内核201,其中,应用程序301位于计算机设备1200的用户空间,内核201位于计算机设备1200的内核空间,具体地,应用程序301中包括第一内存1210;内核201中包括第二内存1220、映射管理模块1230和映射池1240。更具体地:Exemplarily, corresponding to the embodiment shown in Figure 6, Figure 12 shows a computer device 1200 provided by an embodiment of the present application. The computer device 1200 includes an application program 301 and a kernel 201, where the application program 301 is located in The kernel 201 is located in the user space of the computer device 1200. Specifically, the application program 301 includes a first memory 1210; the kernel 201 includes a second memory 1220, a mapping management module 1230, and a mapping pool 1240. More specifically:
第一内存1210,用于存放应用程序301生成的第一响应数据。The first memory 1210 is used to store the first response data generated by the application program 301.
其中,关于第一响应数据的解释在图3至图11所示的实施例中已经给出了详细说明,为了简洁,在此不再赘述。The explanation of the first response data has been described in detail in the embodiments shown in FIGS. 3 to 11 , and will not be described again for the sake of brevity.
可选地,第一内存为虚拟内存,可以是用户态层的数据缓冲区,该第一内存例如可以是buf。Optionally, the first memory is a virtual memory, which may be a data buffer of the user state layer. The first memory may be, for example, buf.
第二内存1220,与第一内存1210之间建立了映射关系,以使得存储于第一内存1210中的第一响应数据以page的形式呈现于第二内存中。A mapping relationship is established between the second memory 1220 and the first memory 1210, so that the first response data stored in the first memory 1210 is presented in the second memory in the form of a page.
映射管理模块1230,用于建立第二内存1220到第一内存1210的映射。The mapping management module 1230 is used to establish a mapping from the second memory 1220 to the first memory 1210 .
可选地,映射管理模块1230通过调用get user pages函数建立第二内存1220到第一内存1210的映射。Optionally, the mapping management module 1230 establishes a mapping from the second memory 1220 to the first memory 1210 by calling the get user pages function.
映射管理模块1230,还用于控制第二内存1220到第一内存1210的映射的速度。The mapping management module 1230 is also used to control the speed of mapping from the second memory 1220 to the first memory 1210 .
具体地,在映射过程中,每建立一个第二内存1220到第一内存1210的映射关系之前,映射管理模块1230向映射池1240申请一个映射描述符,当映射管理模块1230申请到映射描述符后,完成建立该第二内存1220到第一内存1210的映射关系,此时,该映射描述符用于唯一标识该映射关系,还用于描述该映射关系的映射状态。Specifically, during the mapping process, before each mapping relationship between the second memory 1220 and the first memory 1210 is established, the mapping management module 1230 applies for a mapping descriptor from the mapping pool 1240. When the mapping management module 1230 applies for the mapping descriptor, , the mapping relationship between the second memory 1220 and the first memory 1210 is established. At this time, the mapping descriptor is used to uniquely identify the mapping relationship and is also used to describe the mapping status of the mapping relationship.
其中,映射状态包括已使用状态或未使用状态。Among them, the mapping status includes used status or unused status.
当映射管理模块1230申请不到映射描述符时,也就说明该映射池1240中的映射描述符已用完或者没有可用的映射描述符,此时,映射管理模块1230停止第二内存1220到第一内存1210的映射,待映射池1240中有可用的映射描述符时,再继续第二内存1220到第一内存1210的映射。When the mapping management module 1230 cannot apply for a mapping descriptor, it means that the mapping descriptors in the mapping pool 1240 have been used up or there are no mapping descriptors available. At this time, the mapping management module 1230 stops the second memory 1220 to the third memory. Mapping of a memory 1210. When there is an available mapping descriptor in the mapping pool 1240, mapping of the second memory 1220 to the first memory 1210 is continued.
上述过程也可以描述为:当映射管理模块1230申请不到映射描述符时,也就说明该映射池1240中的映射描述符已用完或者没有可用的映射描述符,此时,映射管理模块1230发起阻塞等待。The above process can also be described as: when the mapping management module 1230 cannot apply for a mapping descriptor, it means that the mapping descriptors in the mapping pool 1240 have been used up or there are no available mapping descriptors. At this time, the mapping management module 1230 Initiate blocking wait.
可选地,当映射描述符对应的映射数据被内核读取并发送给相应请求后,该映射描述符就会被释放出来,成为可用映射描述符。Optionally, when the mapping data corresponding to the mapping descriptor is read by the kernel and sent to the corresponding request, the mapping descriptor will be released and become an available mapping descriptor.
本申请实施例中,位于内核中的第二内存与位于应用层中的第一内存(例如:buf)之间建立映射关系,使得存储于第一内存中的数据以page的形式呈现于第二内存中,该第一内存和第二内存本质上是同一块内存,读写第二内存就相当于读写第一内存,因此,内核能够直接读取应用层的数据,不需要将数据从应用层拷贝到内核中再进行读取或处理,能够明显节省计算机设备的性能开销;并且,还能够通过映射管理模块控制映射的速度,能够避免大量映射占用太多内存。In the embodiment of the present application, a mapping relationship is established between the second memory located in the kernel and the first memory (for example: buf) located in the application layer, so that the data stored in the first memory is presented in the form of a page in the second memory. In the memory, the first memory and the second memory are essentially the same memory. Reading and writing the second memory is equivalent to reading and writing the first memory. Therefore, the kernel can directly read the data of the application layer without the need to transfer the data from the application layer. The layer is copied to the kernel for reading or processing, which can significantly save the performance overhead of computer equipment; moreover, the mapping speed can also be controlled through the mapping management module, which can avoid a large number of mappings from occupying too much memory.
示例性地,图13示出了本申请实施例提供的一种应用于计算机设备的操作方法的应用场景示意图。Exemplarily, FIG. 13 shows a schematic diagram of an application scenario of an operating method applied to a computer device provided by an embodiment of the present application.
如图13所示,本申请实施例提供的应用于计算机设备的操作方法可应用于应用程序APP从网络端的云磁盘读取数据的场景。该过程具体可包括以下步骤:As shown in Figure 13, the operation method for computer equipment provided by the embodiment of the present application can be applied to the scenario where the application APP reads data from the cloud disk on the network side. This process may specifically include the following steps:
S1310:应用程序APP通过调用read函数,发起对云磁盘中的数据的读取。S1310: The application APP initiates reading of data in the cloud disk by calling the read function.
该步骤中,程序的执行流为用户态到内核态。In this step, the execution flow of the program is from user mode to kernel mode.
S1320:响应于APP发起读取云磁盘数据的操作,内核生成read请求,并将该read请求传递给云磁盘,由云磁盘进行响应。S1320: In response to the APP initiating the operation of reading cloud disk data, the kernel generates a read request and passes the read request to the cloud disk, which responds.
具体地,该read请求是传递给云磁盘文件(例如:图13中所示的守护进程),由云 磁盘文件做出响应,该云磁盘文件位于用户态。Specifically, the read request is passed to the cloud disk file (for example: the daemon shown in Figure 13), and the cloud disk file responds, and the cloud disk file is located in user mode.
其中,内核将read请求传递给云磁盘,由云磁盘做出响应的具体实现过程,在图3至图12所示的实施例中已经做出了详细的说明,为了简洁,在此不再赘述。Among them, the kernel passes the read request to the cloud disk, and the specific implementation process of the cloud disk responding has been explained in detail in the embodiments shown in Figures 3 to 12. For the sake of simplicity, it will not be described again here. .
图14示出了本申请实施例提供的另一应用于计算机设备的操作装置1400的示意性结构框图。FIG. 14 shows a schematic structural block diagram of another operating device 1400 applied to a computer device provided in an embodiment of the present application.
如图14所示,该操作装置1400包括:至少一个处理器1410和存储器1420,该存储器1420用于存储程序,该至少一个处理器1410用于从存储器1420中调用并运行该程序以执行上述任一实施例所提供的应用于计算机设备的操作方法。As shown in Figure 14, the operating device 1400 includes: at least one processor 1410 and a memory 1420. The memory 1420 is used to store the program. The at least one processor 1410 is used to call and run the program from the memory 1420 to perform any of the above. An embodiment provides an operating method applied to a computer device.
本申请实施例还提供一种计算机设备,该计算机设备可包括上述任一实施例所提供的应用于计算机设备的操作装置。可选地,该计算机设备包括但不限于是终端设备,例如,手机、个人计算机等等。An embodiment of the present application also provides a computer device, which may include the operating device applied to the computer device provided in any of the above embodiments. Optionally, the computer device includes but is not limited to a terminal device, such as a mobile phone, a personal computer, etc.
本申请实施例还提供一种计算机可读存储介质,计算机可读存储介质存储有计算机程序,当该计算机程序在计算机设备上运行时,使得计算机设备执行上述任一实施例所提供的应用于计算机设备的操作方法。An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed on a computer device, the computer device executes an operating method applied to a computer device provided in any of the above embodiments.
本申请实施例还提供一种包含计算机程序的计算机程序产品,当其在计算机设备上运行时,使得计算机设备执行上述任一实施例所提供的应用于计算机设备的操作方法。Embodiments of the present application also provide a computer program product including a computer program, which, when run on a computer device, causes the computer device to execute the operating method applied to the computer device provided by any of the above embodiments.
本申请实施例还提供一种芯片,该芯片包括处理器与数据接口,其中,处理器通过所述数据接口读取存储器上存储的指令,以执行上述任一实施例所提供的应用于计算机设备的操作方法。An embodiment of the present application also provides a chip. The chip includes a processor and a data interface. The processor reads instructions stored in the memory through the data interface to execute the computer equipment provided by any of the above embodiments. method of operation.
在具体实现过程中,该芯片可以为中央处理器(CPU)、微控制器(Micro Controller Unit,MCU)、微处理器(Micro Processing Unit,MPU)、数字信号处理器(DSP)、片上系统(System On Chip,SoC)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或可编辑逻辑器件(programmable logic device,PLD)的形式实现。In the specific implementation process, the chip can be a central processing unit (CPU), a microcontroller unit (Micro Controller Unit, MCU), a microprocessor (Micro Processing Unit, MPU), a digital signal processor (DSP), a system on a chip ( System On Chip (SoC), application specific integrated circuit (ASIC), field programmable gate array (FPGA) or programmable logic device (programmable logic device, PLD).
可选地,在具体实现中,该处理器的个数不做限制。该处理器是通用处理器,可选地,该通用处理器能够通过硬件来实现或通过软件来实现。当通过硬件实现时,该处理器是逻辑电路、集成电路等;当通过软件来实现时,该处理器是一个通用处理器,通过读取存储器中存储的软件代码来实现,该存储器集成在处理器中,位于该处理器之外,独立存在。Optionally, in specific implementation, the number of processors is not limited. The processor is a general-purpose processor, and optionally, the general-purpose processor can be implemented by hardware or by software. When implemented by hardware, the processor is a logic circuit, integrated circuit, etc.; when implemented by software, the processor is a general processor that is implemented by reading the software code stored in the memory, which is integrated in the processor. In the processor, it is located outside the processor and exists independently.
上述实施例,全部或部分地通过软件、硬件、固件或其他任意组合来实现。当使用软件实现时,上述实施例全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令或计算机程序。在计算机上加载或执行所述计算机指令或计算机程序时,全部或部分地产生按照本申请实施例所述的流程或功能。The above embodiments are implemented in whole or in part by software, hardware, firmware or any other combination. When implemented using software, the above-described embodiments are implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on the computer, the processes or functions described in the embodiments of the present application are generated in whole or in part.
可选地,所述计算机为通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令能够存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令从一个网站站点、计算机、服务器或数据中心通过有线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。Optionally, the computer is a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in or transmitted from one computer-readable storage medium to another, e.g., from a website, computer, server, or data center. Wired (such as infrared, wireless, microwave, etc.) transmission to another website, computer, server or data center.
所述计算机可读存储介质是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集合的服务器、数据中心等数据存储设备。所述可用介质是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质,例如固态硬盘。The computer-readable storage medium is any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more sets of available media. The available media are magnetic media (eg, floppy disks, hard disks, tapes), optical media (eg, DVD), or semiconductor media, such as solid state drives.
应理解,本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示存在三种关系,例如,A和/或B,表示:单独存在A,同时存在A和B,单独存在B这三种情况,其中A,B是单数或者复数。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系,但也可能表示的是一种“和/或”的关系,具体可参考前后文进行理解。It should be understood that the term "and/or" in this article is only an association relationship describing related objects, indicating that there are three relationships, for example, A and/or B, which means: A alone exists, A and B exist simultaneously, alone There are three cases of B, where A and B are singular or plural. In addition, the character "/" in this article generally indicates that the related objects are an "or" relationship, but it may also indicate an "and/or" relationship. For details, please refer to the previous and later contexts for understanding.
本申请中,“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b,或c中的至少一项(个),表示:a,b,c,a-b,a-c,b-c,或a-b-c,其中a,b,c是单个或者多个。In this application, "at least one" refers to one or more, and "plurality" refers to two or more. "At least one of the following" or similar expressions thereof refers to any combination of these items, including any combination of a single item (items) or a plurality of items (items). For example, at least one of a, b, or c means: a, b, c, a-b, a-c, b-c, or a-b-c, where a, b, c are single or multiple.
应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that in the various embodiments of the present application, the size of the sequence numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its functions and internal logic, and should not be used in the embodiments of the present application. The implementation process constitutes any limitation.
本领域普通技术人员能够意识到,结合本文中所公开的实施例描述的各示例的模块及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员能够对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans will be able to implement the described functionality using different methods for each specific application, but such implementations should not be considered beyond the scope of this application.
所属领域的技术人员能够清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和模块的具体工作过程,请参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and simplicity of description, please refer to the corresponding processes in the foregoing method embodiments for the specific working processes of the systems, devices and modules described above, and will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,能够通过其它的方式实现。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways.
例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时能够有另外的划分方式,例如多个模块或组件结合或者集成到另一个系统,或一些特征能够被忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接是通过一些接口,装置或模块的间接耦合或通信连接,是电性,机械或其它的形式。For example, the device embodiments described above are only illustrative. For example, the division of modules is only a logical function division. In actual implementation, there can be other division methods, such as the combination or integration of multiple modules or components. to another system, or some features can be ignored, or not implemented. Another point is that the coupling or direct coupling or communication connection between each other shown or discussed is the indirect coupling or communication connection through some interfaces, devices or modules, which is electrical, mechanical or other forms.
可选地,在本申请各个实施例中的各功能模块能够集成在一个处理装置中,可选地,是各个模块单独物理存在,或者两个或两个以上模块集成在一个模块中。Optionally, each functional module in each embodiment of the present application can be integrated into a processing device. Alternatively, each module physically exists alone, or two or more modules are integrated into one module.
所述功能如果以软件功能模块的形式实现并作为独立的产品销售或使用时,能够存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分能够以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM)、随机存取存储器(RAM)、磁碟或者光盘等各种能够存储程序代码的介质。If the functions are implemented in the form of software function modules 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 application is essentially or the part that contributes to the existing technology 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 are used to cause a computer device (either a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk and other various media that can store program codes.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited thereto. Any person familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application. should be covered by the protection scope of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (24)

  1. 一种应用于计算机设备的操作方法,其特征在于,所述操作方法应用于所述计算机设备的应用层,所述操作方法包括:An operating method applied to computer equipment, characterized in that the operating method is applied to the application layer of the computer equipment, and the operating method includes:
    检测内核中是否存在第一请求,所述第一请求为需要发送给所述应用层的请求;Detect whether there is a first request in the kernel, where the first request is a request that needs to be sent to the application layer;
    当检测到所述内核中存在所述第一请求时,读取所述第一请求;When detecting that the first request exists in the kernel, read the first request;
    响应于所述第一请求,向所述内核发送第一响应。In response to the first request, a first response is sent to the kernel.
  2. 根据权利要求1所述的操作方法,其特征在于,在所述响应于所述第一请求,向所述内核发送第一响应之前,所述方法还包括:The operating method according to claim 1, characterized in that, before sending a first response to the kernel in response to the first request, the method further includes:
    执行所述第一请求对应的第一操作。Execute the first operation corresponding to the first request.
  3. 根据权利要求1或2所述的操作方法,其特征在于,所述检测内核中是否存在第一请求,包括:The operating method according to claim 1 or 2, characterized in that detecting whether there is a first request in the kernel includes:
    通过调用poll函数检测内核请求链表中是否存在所述第一请求,所述内核请求链表位于所述内核中。Detect whether the first request exists in the kernel request list by calling the poll function, and the kernel request list is located in the kernel.
  4. 根据权利要求1至3中任一项所述的操作方法,其特征在于,所述读取所述第一请求,包括:The operating method according to any one of claims 1 to 3, wherein reading the first request includes:
    通过调用read函数读取所述第一请求。Read the first request by calling the read function.
  5. 根据权利要求1至4中任一项所述的操作方法,其特征在于,所述向所述内核发送第一响应,包括:The operating method according to any one of claims 1 to 4, characterized in that sending the first response to the kernel includes:
    通过调用ioctl函数向所述内核发送所述第一响应。The first response is sent to the kernel by calling an ioctl function.
  6. 根据权利要求1至5中任一项所述的操作方法,其特征在于,所述方法还包括:The operating method according to any one of claims 1 to 5, characterized in that the method further includes:
    当检测到所述内核中不存在所述第一请求时,对内核请求链表进行阻塞,并等待所述第一请求。When it is detected that the first request does not exist in the kernel, the kernel request list is blocked and waits for the first request.
  7. 根据权利要求1至6中任一项所述的操作方法,其特征在于,所述方法还包括:The operating method according to any one of claims 1 to 6, characterized in that the method further comprises:
    响应于所述第一请求,生成第一响应数据。In response to the first request, first response data is generated.
  8. 根据权利要求7所述的操作方法,其特征在于,所述第一响应包括所述第一响应数据。The operating method according to claim 7, wherein the first response includes the first response data.
  9. 根据权利要求7所述的操作方法,其特征在于,所述方法还包括:The operating method according to claim 7, characterized in that the method further includes:
    将所述第一响应数据缓存于第一内存,所述第一内存为位于所述用户层中的虚拟内存,所述第一响应包括第一响应编码,所述第一响应编码包括第一指示信息,所述第一指示信息用于指示所述第一内存中存在所述第一响应数据。Caching the first response data in a first memory, the first memory being a virtual memory located in the user layer, the first response including a first response code, and the first response code including a first indication Information, the first indication information is used to indicate that the first response data exists in the first memory.
  10. 根据权利要求9所述的操作方法,其特征在于,所述第一内存与第二内存具有映射关系,所述第二内存位于所述内核中,所述第二内存用于所述内核在根据所述第一指示信息确定所述第一内存中存在所述第一响应数据时,读取所述第一响应数据。The operating method according to claim 9, characterized in that the first memory and the second memory have a mapping relationship, the second memory is located in the kernel, and the second memory is used by the kernel according to When the first indication information determines that the first response data exists in the first memory, the first response data is read.
  11. 根据权利要求1至10中任一项所述的操作方法,其特征在于,所述第一请求包括读请求、写请求、删请求中的任意一项。The operating method according to any one of claims 1 to 10, characterized in that the first request includes any one of a read request, a write request, and a delete request.
  12. 一种应用于计算机设备的操作装置,其特征在于,位于计算机设备的应用层,所述操作装置包括:An operating device applied to computer equipment, characterized in that it is located at the application layer of computer equipment, and the operating device includes:
    检测模块,用于检测内核中是否存在第一请求,所述第一请求为需要发送给所述应用层的请求;A detection module, used to detect whether there is a first request in the kernel, where the first request is a request that needs to be sent to the application layer;
    第一获取模块,用于当检测到所述内核中存在所述第一请求时,读取所述第一请求;A first acquisition module, configured to read the first request when detecting that the first request exists in the kernel;
    处理模块,用于响应于所述第一请求,向所述内核发送第一响应。A processing module configured to send a first response to the kernel in response to the first request.
  13. 根据权利要求12所述的操作装置,其特征在于,所述处理模块还用于:The operating device according to claim 12, characterized in that the processing module is also used to:
    执行所述第一请求对应的第一操作。Execute the first operation corresponding to the first request.
  14. 根据权利要求12或13所述的操作装置,其特征在于,所述检测模块具体用于:The operating device according to claim 12 or 13, characterized in that the detection module is specifically used for:
    通过调用poll函数检测内核请求链表中是否存在所述第一请求,所述内核请求链表位于所述内核中。Detect whether the first request exists in the kernel request list by calling the poll function, and the kernel request list is located in the kernel.
  15. 根据权利要求12至14中任一项所述的操作装置,其特征在于,所述第一获取模块具体用于:The operating device according to any one of claims 12 to 14, characterized in that the first acquisition module is specifically used to:
    通过调用read函数读取所述第一请求。Read the first request by calling the read function.
  16. 根据权利要求12至15中任一项所述的操作装置,其特征在于,所述处理模块具体用于:The operating device according to any one of claims 12 to 15, characterized in that the processing module is specifically used for:
    通过调用ioctl函数向所述内核发送所述第一响应。The first response is sent to the kernel by calling an ioctl function.
  17. 根据权利要求12至16中任一项所述的操作装置,其特征在于,所述检测模块还具体用于:The operating device according to any one of claims 12 to 16, characterized in that the detection module is also specifically used for:
    当检测到所述内核中不存在所述第一请求时,对内核请求链表进行阻塞,并等待所述第一请求。When it is detected that the first request does not exist in the kernel, the kernel request list is blocked and waits for the first request.
  18. 根据权利要求12至17中任一项所述的操作装置,其特征在于,所述处理模块还用于:The operating device according to any one of claims 12 to 17, characterized in that the processing module is also used for:
    响应于所述第一请求,生成第一响应数据。In response to the first request, first response data is generated.
  19. 根据权利要求18所述的操作装置,其特征在于,所述第一响应包括所述第一响应数据。The operating device according to claim 18, wherein the first response includes the first response data.
  20. 根据权利要求18所述的操作装置,其特征在于,所述处理模块还用于:The operating device according to claim 18, characterized in that the processing module is also used for:
    将所述第一响应数据缓存于第一内存,所述第一内存为位于所述用户层中的虚拟内存,所述第一响应包括第一响应编码,所述第一响应编码包括第一指示信息,所述第一指示信息用于指示所述第一内存中存在所述第一响应数据。Caching the first response data in a first memory, the first memory being a virtual memory located in the user layer, the first response including a first response code, and the first response code including a first indication Information, the first indication information is used to indicate that the first response data exists in the first memory.
  21. 根据权利要求20所述的操作装置,其特征在于,所述第一内存与第二内存具有映射关系,所述第二内存位于所述内核中,所述第二内存用于所述内核在根据所述第一指示信息确定所述第一内存中存在所述第一响应数据时,读取所述第一响应数据。The operating device according to claim 20, characterized in that the first memory and the second memory have a mapping relationship, the second memory is located in the kernel, and the second memory is used by the kernel according to When the first indication information determines that the first response data exists in the first memory, the first response data is read.
  22. 根据权利要求12至21中任一项所述的操作装置,其特征在于,所述第一请求包括读请求、写请求、删请求中的任意一项。The operating device according to any one of claims 12 to 21, wherein the first request includes any one of a read request, a write request, and a delete request.
  23. 一种计算机设备,其特征在于,包括:如权利要求12至22中任一项所述的应用于计算机设备的操作装置。A computer device, characterized by comprising: an operating device applied to a computer device as claimed in any one of claims 12 to 22.
  24. 一种计算机可读存储介质,其特征在于,包括计算机程序,当所述计算机程序在计算机上运行时,使得所述计算机执行权利要求1至11中任一项所述的应用于计算机设备的操作方法。A computer-readable storage medium, characterized in that it includes a computer program that, when the computer program is run on a computer, causes the computer to perform the operations applied to the computer device described in any one of claims 1 to 11 method.
PCT/CN2022/120849 2022-09-23 2022-09-23 Operation method and apparatus applied to computer device, and computer device WO2024060193A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/120849 WO2024060193A1 (en) 2022-09-23 2022-09-23 Operation method and apparatus applied to computer device, and computer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2022/120849 WO2024060193A1 (en) 2022-09-23 2022-09-23 Operation method and apparatus applied to computer device, and computer device

Publications (1)

Publication Number Publication Date
WO2024060193A1 true WO2024060193A1 (en) 2024-03-28

Family

ID=90453684

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/120849 WO2024060193A1 (en) 2022-09-23 2022-09-23 Operation method and apparatus applied to computer device, and computer device

Country Status (1)

Country Link
WO (1) WO2024060193A1 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090193251A1 (en) * 2008-01-29 2009-07-30 International Business Machines Corporation Secure request handling using a kernel level cache
CN114817154A (en) * 2022-05-20 2022-07-29 南京酷派软件技术有限公司 Shared file operation method and device, computer equipment and shared file system
CN114936189A (en) * 2022-06-02 2022-08-23 南京酷派软件技术有限公司 Application program operation method and device, computer equipment and readable storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090193251A1 (en) * 2008-01-29 2009-07-30 International Business Machines Corporation Secure request handling using a kernel level cache
CN114817154A (en) * 2022-05-20 2022-07-29 南京酷派软件技术有限公司 Shared file operation method and device, computer equipment and shared file system
CN114936189A (en) * 2022-06-02 2022-08-23 南京酷派软件技术有限公司 Application program operation method and device, computer equipment and readable storage medium

Similar Documents

Publication Publication Date Title
US9727503B2 (en) Storage system and server
US9696942B2 (en) Accessing remote storage devices using a local bus protocol
WO2017008675A1 (en) Method and device for transmitting data in virtual environment
US10133668B2 (en) Technologies for providing cross data storage device communications
EP4220419B1 (en) Modifying nvme physical region page list pointers and data pointers to facilitate routing of pcie memory requests
WO2015070640A1 (en) Remote accessing method for device, thin client, and virtual machine
TW201220197A (en) for improving the safety and reliability of data storage in a virtual machine based on cloud calculation and distributed storage environment
WO2023165400A1 (en) Computing system, memory page fault processing method, and storage medium
KR102365312B1 (en) Storage controller, computational storage device, and operation method of computational storage device
US10275175B2 (en) System and method to provide file system functionality over a PCIe interface
WO2021249059A1 (en) Network card and method for network card to process data
CN113157487B (en) Data recovery method and device
CN116257471A (en) Service processing method and device
US20240086113A1 (en) Synchronous write method and device, storage system and electronic device
CN114238236A (en) Shared file access method, electronic device and computer readable storage medium
CN114296646A (en) Caching method, device, server and storage medium based on IO service
WO2024060193A1 (en) Operation method and apparatus applied to computer device, and computer device
US11983115B2 (en) System, device and method for accessing device-attached memory
US20180267821A1 (en) Virtual machine messaging
WO2022242665A1 (en) Data storage method and related device
JP7497637B2 (en) Information processing device and access control program
CN114840307A (en) Container loading method, device, equipment and storage medium
KR101559929B1 (en) Apparatus and method for virtualization
WO2017177400A1 (en) Data processing method and system
US20240168876A1 (en) Solving submission queue entry overflow using metadata or data pointers

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22959200

Country of ref document: EP

Kind code of ref document: A1