Executable file loading method and device, equipment, storage medium and program product

By suspending the main thread of the application and setting user state context information in the kernel space, the problem of resource waste during the loading of executable files in the prior art is solved, and efficient resource utilization is achieved.

CN119938165APending Publication Date: 2025-05-06ZEBRED NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411959504.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-27
Publication Date
2025-05-06

AI Technical Summary

Technical Problem

The prior art wastes computing resources during executable file loading.

Method used

By receiving the program loading operation information sent by the application, sending the main thread suspending instruction to the application, causing the application to suspend the main thread, and setting the user-state context information of the application in the kernel space to complete the reconstruction of the application corresponding to the executable file.

Benefits of technology

Avoid resource occupation of new processes and realize the loading of executable files without wasting computing resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119938165A_ABST
    Figure CN119938165A_ABST
Patent Text Reader

Abstract

The invention provides an executable file loading method and device, equipment, a storage medium and a program product, and belongs to the technical field of computers. The method comprises the steps that program loading operation information sent by an application program is received, the application program comprises a main thread, and the program loading operation information corresponds to an executable file; sending a main thread hanging instruction to the application program to enable the application program to hang up the main thread; receiving notification information sent by a kernel module, wherein the notification information is sent after the kernel module detects that the application program suspends the main thread; and according to the notification information, setting the user state context information of the application program in a kernel space by adopting the program loading operation information, and completing the reconstruction of the application program corresponding to the executable file. According to the method provided by the invention, the problem that resources are wasted in the loading process of the executable file is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to an executable file loading method, device, equipment, storage medium and program product. Background Art

[0002] With the continuous development of computer technology, more and more matters can be processed on computers. In the process of computer processing matters, there will be situations where the application needs to load executable files.

[0003] At present, in the prior art, a new process is usually created first, an executable file is loaded by the new process, and then the resources of the old process are completely recovered, and the new process is used to replace the old process and restart execution.

[0004] However, the inventors have discovered that the prior art has at least the following technical problems: the current process of loading executable files wastes computing resources. Summary of the invention

[0005] The present application provides an executable file loading method, device, equipment, storage medium and program product to solve the problem of wasting resources in the current executable file loading process.

[0006] In a first aspect, the present application provides an executable file loading method, which is applied to a process management module, and the method includes: receiving program loading and running information sent by an application, wherein the application includes a main thread, and the program loading and running information corresponds to the executable file; sending a main thread suspend instruction to the application to cause the application to suspend the main thread; receiving notification information sent by a kernel module, wherein the notification information is sent by the kernel module after detecting that the application has suspended the main thread; according to the notification information, using the program loading and running information to set the user state context information of the application in the kernel space, and completing the reconstruction of the application corresponding to the executable file.

[0007] In one possible implementation, the application also includes at least one sub-thread; accordingly, after receiving the program loading and running information sent by the application, it also includes: sending a main thread suspend instruction to the application running in the kernel module to make the application suspend the main thread and terminate each sub-thread.

[0008] In one possible implementation, based on the notification information, the program loading and running information is used to set the user state context information of the application in the kernel space, including: if the notification information includes the identifier of the main thread and the identifiers of each sub-thread, the program loading and running information is used to set the user state context information of the application in the kernel space.

[0009] In a possible implementation, the notification information is sent after the kernel module detects that the application suspends the main thread and / or terminates the child thread.

[0010] In a possible implementation, after sending the main thread suspension instruction to the application, the method further includes: receiving main thread suspension notification information sent by the application, wherein the main thread suspension notification information is used to enable the process management module to determine that the main thread has been suspended.

[0011] In one possible implementation, after sending a main thread suspension instruction to an application, it also includes: receiving notification information of the main thread suspension and notification information of the termination of each sub-thread sent by the application, wherein the notification information of the main thread suspension is used to enable the process management module to determine that the main thread has been suspended, and the notification information of the sub-thread termination is used to enable the process management module to determine that the sub-thread has been terminated in response to the notification information.

[0012] In a possible implementation, after receiving the notification information sent by the kernel module, the method further includes: reclaiming the original user-mode memory space of the application; and setting a user stack of the application.

[0013] In one possible implementation, after using the program loading running information to set the user state context information of the application in the kernel space and completing the reconstruction of the application corresponding to the executable file, it also includes: using the application identifier to call the kernel interface, so that the kernel module receives the application identifier and puts the application back into the running queue to run the application.

[0014] In the second aspect, the present application provides an executable file loading device, including: a first receiving module, used to receive program loading and running information sent by an application, wherein the application includes a main thread, and the program loading and running information corresponds to the executable file; an instruction sending module, used to send a main thread suspend instruction to the application, so that the application suspends the main thread; a second receiving module, used to receive notification information sent by a kernel module, wherein the notification information is sent after the kernel module detects that the application suspends the main thread; an information setting module, used to set the user state context information of the application in the kernel space according to the notification information, using the program loading and running information to complete the reconstruction of the application corresponding to the executable file.

[0015] In a third aspect, the present application provides an electronic device comprising: a processor, and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory, so that the processor executes the executable file loading method described in the first aspect.

[0016] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the executable file loading method described in the first aspect.

[0017] In a fifth aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the executable file loading method described in the first aspect.

[0018] The executable file loading method, apparatus, device, storage medium and program product provided by the present application receive program loading and running information sent by an application, send a main thread suspend instruction to the application, thereby causing the application to suspend the main thread, and use the program loading and running information to set the user state context information of the application in the kernel space to complete the reconstruction of the application corresponding to the executable file. Since only the main thread is suspended, the loading of the executable file is completed without creating a new process, so no additional resources are occupied. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0020] Figure 1 A schematic diagram of an application scenario of the executable file loading method provided in an embodiment of the present application;

[0021] Figure 2 A flowchart of an executable file loading method provided in an embodiment of the present application;

[0022] Figure 3 A schematic diagram of the overall process of the executable file loading method provided in the embodiment of the present application;

[0023] Figure 4 A schematic diagram of the structure of an executable file loading device provided in an embodiment of the present application;

[0024] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0025] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0026] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0027] First, let’s explain the terms:

[0028] User space: A part of virtual memory. Virtual memory is divided into user space and kernel space, which stores data related to user-mode applications.

[0029] User state: refers to the application running in user space, in a non-privileged state. In this state, the application is limited by the hardware and cannot perform specific operations.

[0030] Kernel space: As explained above, it is another part of virtual memory, associated with kernel state, storing operating system code, device drivers, and various data structures required for system operation.

[0031] Kernel state: It is the highest-privileged execution mode in the operating system, allowing direct access to hardware resources and execution of various privileged operations. Applications can switch between user state and kernel state.

[0032] With the continuous development of computer technology, the number of programs running in computers is also increasing, and an application program requires at least one thread when running.

[0033] When a program needs to use a new executable file, it usually needs to create a new process to load the executable file, and then completely recycle the resources of the old process so that the new process can run and complete the loading of the executable file. However, this method will cause more resource usage.

[0034] In response to the above technical problems, the inventors proposed the following technical concept: after the application process sends the program loading and running information to the process management module, the main thread of the application is suspended, and the executable file data corresponding to the program loading and running information is used to set the user state context information of the application in the kernel space, rebuild the application, and complete the loading of the executable file.

[0035] Figure 1 Schematic diagram of an application scenario of the executable file loading method provided in the embodiment of the present application. Figure 1 As shown, the application scenario of the executable file loading method includes: an application program 101, a process management module 102 and a kernel module 103.

[0036] The user application module 101, the process management module 102 and the kernel module 103 may be installed in the same computing device such as a server, a computer, a mobile phone or a tablet computer, or may be installed in the same computing unit.

[0037] The application 101 may be any application, which runs in the kernel module 103 and may be composed of a main thread or a main thread and at least one sub-thread.

[0038] The process management module 102 is similar to the process manager in the QNX (Quick UNIX) system, and is used to manage the operation of each application process.

[0039] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0040] Figure 2 The following is a flow chart of the method for loading an executable file provided in the embodiment of the present application. Figure 2 As shown, the executable file loading method includes: step S201 to step S204.

[0041] S201: receiving program loading and running information sent by an application, wherein the application includes a main thread, and the program loading and running information corresponds to an executable file.

[0042] In this step, when the application calls the preset interface to try to load the executable file, the program loading and running information is sent to the process management module in the form of inter-process communication.

[0043] The program loading and running information may include the path information of the executable file, the parameters and environment variable information required during the execution of the executable file.

[0044] S202: Send a main thread suspend instruction to the application program, so that the application program suspends the main thread.

[0045] In this step, the application is in kernel state at this time, and the process management module enters the kernel state by calling the interface to send a suspend instruction to the application. After receiving the main thread suspend instruction, the application suspends its own main thread.

[0046] S203: receiving notification information sent by the kernel module, wherein the notification information is sent by the kernel module after detecting that the main thread of the application program is suspended.

[0047] In this step, the kernel module may use a separate thread to monitor the running status of each thread of the application program, and send a notification message to the process management module after detecting that the main thread is suspended.

[0048] The notification information includes the identifier of the main thread, that is, the PID (Process ID) of the main thread.

[0049] S204: According to the notification information, the user state context information of the application is set in the kernel space using the program loading and running information, so as to complete the reconstruction of the application corresponding to the executable file.

[0050] In this step, it can include, when determining that the notification information contains the identifiers of all threads of the application, reading the executable file corresponding to the program loading and running information, parsing the executable file, using the parsed data, the parameters and environment variable information required during the execution of the executable file in the program loading and running information, calling a preset interface to enter the kernel to set the user state context of the application, and realizing the reconstruction of the application corresponding to the executable file.

[0051] From the description of the above embodiments, it can be seen that in the case where the application only includes the main thread, the embodiment of the present disclosure receives program loading and running information sent by the application, sends a main thread suspend instruction to the application, thereby causing the application to suspend the main thread, and uses the program loading and running information to set the user state context information of the application in the kernel space to complete the reconstruction of the application corresponding to the executable file. Since only the main thread is suspended, the loading of the executable file is completed without creating a new process, and therefore no additional resources are occupied.

[0052] In a possible implementation, the application further includes at least one sub-thread.

[0053] The child thread is a thread of an application that is established after the main thread is established.

[0054] Correspondingly, after the above step S201 of receiving the program loading and running information sent by the application, the method further includes: step S220.

[0055] S220: Send a main thread suspension instruction to the application program running in the kernel module, so that the application program suspends the main thread and terminates each sub-thread.

[0056] In this step, when the application contains a main thread and sub-threads, the operation of the main thread is suspended, and the operation of each sub-thread is forcibly terminated. The main thread can be suspended by combining a preset command with the identifier of the main thread to obtain a suspension instruction, and the suspension instruction is executed to complete the suspension of the main thread. The sub-thread can be terminated by combining a preset termination command with the identifier of the sub-thread to obtain a termination instruction of the sub-thread, and the termination instruction is executed to terminate the sub-thread.

[0057] From the description of the above embodiments, it can be seen that in the embodiment of the present disclosure, when the application contains a main thread and at least one child thread, the main thread is suspended and the child thread is terminated, so as to avoid the child thread before the new executable file is loaded from affecting the loading and running of the executable file.

[0058] In a possible implementation, in the above step S204, according to the notification information, the user state context information of the application is set in the kernel space using the program loading and running information, including:

[0059] S2041: If the notification information includes the identifier of the main thread and the identifiers of each sub-thread, the user state context information of the application program is set in the kernel space using the program loading and running information.

[0060] In this step, there may be one or at least two notification messages. Only when there is an identifier of the main thread and identifiers of each sub-thread in all notification messages, the user state context information of the application is set in the kernel space using the program loading and running information. The process of setting the user state context information of the application in the kernel space using the program loading and running information is as described in the above step S204, and will not be repeated here.

[0061] From the description of the above embodiments, it can be seen that the embodiment of the present disclosure sets the user state context only when the notification information includes the main thread identifier and the identifiers of each child thread, thereby setting the user state context only after confirming that the main thread is suspended and the child thread is terminated, thereby avoiding interference of the original thread with the loading of the executable file.

[0062] In a possible implementation, the notification information is sent after the kernel module detects that the application suspends the main thread and / or terminates the child thread.

[0063] Specifically, the kernel module may use a specific thread to detect whether the main thread of the application is suspended and whether the child thread is terminated. The kernel module may send a notification message containing the main thread identifier after detecting that the main thread is suspended, or send a termination message containing the child thread identifier after detecting that the child thread is terminated, or send a notification message containing the main thread identifier and each child thread identifier only when detecting that the main thread is suspended and each child thread has terminated.

[0064] From the description of the above embodiments, it can be seen that the embodiments of the present disclosure detect the suspension or termination of each thread in the application through the kernel module, and send corresponding notification information to inform the process management module of the running status of each thread of the application.

[0065] In a possible implementation, after the above step S202 sends the main thread suspend instruction to the application, the method further includes: step S230.

[0066] S230: receiving the main thread suspension notification information sent by the application, wherein the main thread suspension notification information is used to enable the process management module to determine that the main thread has been suspended.

[0067] In this step, the notification information of the main thread suspension may include the identifier of the main thread and the identifier of the application program.

[0068] The notification information of the main thread suspension may be sent by the main thread of the application before or during the suspension.

[0069] From the description of the above embodiments, it can be seen that the embodiment of the present disclosure receives the notification information of the main thread suspension sent by the application when the application has only the main thread, thereby determining that the main thread has been suspended and determining whether the step of setting the user state context can be executed.

[0070] In a possible implementation, after the above step S202 sends the main thread suspend instruction to the application, the method further includes:

[0071] S240: Receive the main thread suspension notification information and each sub-thread termination notification information sent by the application, wherein the main thread suspension notification information is used to enable the process management module to determine that the main thread has been suspended, and the sub-thread termination notification information is used to enable the process management module to determine that the sub-thread has been terminated.

[0072] In this step, the notification information of the main thread suspension is similar to that in the above step S230, and will not be repeated here. The notification information of the child thread termination can be sent by the child thread of the application before or when it is terminated, and can include the identifier of the child thread and the identifier of the application.

[0073] From the description of the above embodiments, it can be seen that the embodiments of the present disclosure, when the application program includes both a main thread and at least one child thread, sends corresponding notification information to the process management module when the main thread is suspended or the child thread is terminated, so that the process management module knows which processes are suspended or terminated. When all threads have completed the suspension or termination accordingly, the user-mode context information of the application program is rebuilt to avoid the original process affecting the loading of the executable file.

[0074] In a possible implementation, after receiving the notification information sent by the kernel module in step S203, the method further includes:

[0075] S250: Reclaiming the original user-mode memory space of the application.

[0076] This step may include releasing the mapping relationship between the application and the original user-mode memory space.

[0077] S251: Setting the user stack of the application.

[0078] This step may include allocating a memory space for the application to store function call information and other related data.

[0079] From the description of the above embodiments, it can be seen that the embodiments of the present disclosure recycle the original user-state memory space of the application and set the user stack of the application to update the memory space occupied by the application, thereby facilitating the subsequent use of executable files to set the user-state context information of the application.

[0080] In a possible implementation, after the above step S204 uses the program loading and running information to set the user state context information of the application in the kernel space to complete the reconstruction of the application corresponding to the executable file, it also includes:

[0081] S260: Using the identification of the application to call the kernel interface, so that the kernel module receives the identification of the application and puts the application back into the running queue to run the application.

[0082] In this step, a system call is made by calling the kernel interface, and the application with the loaded executable file is put into the running queue. The kernel will schedule the application in the running queue to run, and then run the application.

[0083] From the description of the above embodiments, it can be seen that the embodiments of the present disclosure transmit the identification of the application to the kernel by calling the kernel interface, rewrite the application into the running queue, and run the application again to schedule the running of the application with the executable file loaded.

[0084] Figure 3 The overall flow diagram of the executable file loading method provided in the embodiment of the present application is as follows. Figure 3 As shown, the overall process of the executable file loading method includes:

[0085] S301: The application program calls a preset interface to send program loading and running information to the process management module.

[0086] S302: The process management module sends a main thread suspend instruction to the application.

[0087] S303: The kernel module sends notification information to the process management module, wherein the notification information is sent by the kernel module after detecting that the application program suspends the main thread.

[0088] S304: If all child threads of the application have been terminated and the main thread has been suspended, the process management module reclaims the user state memory space of the application.

[0089] S305: The process management module parses and loads the executable file corresponding to the running information of the program, and sets the user stack of the application.

[0090] S306: The process management module calls a preset interface to set context information of the application in the kernel space and initialize the task object of the application in the kernel.

[0091] S307: The process management module calls a preset kernel interface to put the loaded application process back into the running queue, waiting for the kernel to schedule the application process to start running.

[0092] Figure 4 This is a schematic diagram of the structure of the executable file loading device provided in the embodiment of the present application. Figure 4 As shown, the executable file loading device 400 includes: a first receiving module 401, an instruction sending module 402, a second receiving module 403 and an information setting module 404.

[0093] A first receiving module 401 is used to receive program loading and running information sent by an application, wherein the application includes a main thread, and the program loading and running information corresponds to an executable file;

[0094] The instruction sending module 402 is used to send a main thread suspension instruction to the application program so as to cause the application program to suspend the main thread;

[0095] The second receiving module 403 is used to receive notification information sent by the kernel module, wherein the notification information is sent by the kernel module after detecting that the main thread of the application is suspended;

[0096] The information setting module 404 is used to set the user state context information of the application program in the kernel space according to the notification information and the program loading and running information, so as to complete the reconstruction of the application program corresponding to the executable file.

[0097] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0098] In a possible implementation, the application further includes at least one sub-thread; accordingly, the executable file loading device 400 further includes: a thread processing module 405 .

[0099] The thread processing module 405 is used to send a main thread suspension instruction to the application program running in the kernel module, so that the application program suspends the main thread and terminates each sub-thread.

[0100] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0101] In a possible implementation, the information setting module 404 is used to set the user state context information of the application program in the kernel space using the program loading and running information if the notification information includes the identifier of the main thread and the identifiers of each sub-thread.

[0102] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0103] In a possible implementation, the notification information is sent after the kernel module detects that the application suspends the main thread and / or terminates the child thread.

[0104] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0105] In a possible implementation, the second receiving module 403 is further used to receive the main thread suspension notification information sent by the application, wherein the main thread suspension notification information is used to enable the process management module to determine that the main thread has been suspended.

[0106] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0107] In one possible implementation, the second receiving module 403 is also used to receive notification information of the main thread suspension and notification information of the termination of each sub-thread sent by the application, wherein the notification information of the main thread suspension is used to enable the process management module to determine that the main thread has been suspended, and the notification information of the sub-thread termination is used to enable the process management module to determine that the sub-thread has been terminated.

[0108] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0109] In a possible implementation, the executable file loading device 400 further includes: a space processing module 406 .

[0110] The space processing module 406 is used to reclaim the original user-mode memory space of the application program and to set the user stack of the application program.

[0111] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0112] In a possible implementation, the executable file loading device 400 further includes: a program running module 407 .

[0113] The program running module 407 is used to call the kernel interface using the identification of the application program, so that the kernel module receives the identification of the application program and puts the application program back into the running queue to run the application program.

[0114] The device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.

[0115] In order to implement the above embodiment, the embodiment of the present application also provides an electronic device.

[0116] refer to Figure 5 , which shows a schematic diagram of the structure of an electronic device 500 suitable for implementing the embodiment of the present application, and the electronic device 500 may be a terminal device or a server. The terminal device may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, personal digital assistants (PDAs), tablet computers (Portable Android Devices, PADs), portable multimedia players (Portable Media Players, PMPs), vehicle terminals (such as vehicle navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 5 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0117] like Figure 5As shown, the electronic device 500 may include a processor (such as a central processing unit, a graphics processing unit, etc.) 501, and a memory 502 that is communicatively connected to the processor, which can perform various appropriate actions and processes according to the program stored in the memory 502, the computer execution instruction, or the program loaded from the storage device 508 to the random access memory (Random Access Memory, referred to as RAM) 503, to implement the executable file loading method in any of the above embodiments, wherein the memory may be a read-only memory (Read Only Memory, referred to as ROM). In the RAM 503, various programs and data required for the operation of the electronic device 500 are also stored. The processing device 501, the memory 502, and the RAM 503 are connected to each other via a bus 504. The input / output (I / O) interface 505 is also connected to the bus 504.

[0118] Typically, the following devices may be connected to the I / O interface 505: input devices 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; output devices 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 508 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Figure 5 The electronic device 500 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.

[0119] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the memory 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present application are executed.

[0120] It should be noted that the computer-readable storage medium mentioned above in the present application may be a computer-readable signal medium or a computer storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer readable signal medium may also be any computer readable storage medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0121] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.

[0122] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device executes the method shown in the above embodiment.

[0123] The computer program code for performing the operation of the present application can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).

[0124] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0125] The modules involved in the embodiments of the present application may be implemented by software or hardware. The name of the unit does not limit the module itself in some cases. For example, the process management module may also be described as an "application process management module".

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

[0127] The present application also provides a computer-readable storage medium, which stores computer-executable instructions. When the processor executes the computer-executable instructions, the technical solution of the executable file loading method in any of the above-mentioned embodiments is implemented. The implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the executable file loading method. Please refer to the implementation principle and beneficial effects of the executable file loading method, which will not be repeated here.

[0128] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0129] The present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the technical solution of the executable file loading method in any of the above-mentioned embodiments. Its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the executable file loading method. Please refer to the implementation principle and beneficial effects of the executable file loading method, and no further details will be given here.

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

[0131] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0132] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A method for loading an executable file, characterized in that: Applied to the process management module, the method comprises: Receiving program loading and running information sent by an application, wherein the application includes a main thread, and the program loading and running information corresponds to an executable file; Sending a main thread suspend instruction to the application program so that the application program suspends the main thread; Receiving notification information sent by the kernel module, wherein the notification information is sent by the kernel module after detecting that the application program suspends the main thread; According to the notification information, the user state context information of the application is set in the kernel space using the program loading and running information, thereby completing the reconstruction of the application corresponding to the executable file.

2. The method according to claim 1, characterized in that The application further includes at least one sub-thread; Accordingly, after receiving the program loading and running information sent by the application, the method further includes: A main thread suspension instruction is sent to the application program running in the kernel module, so that the application program suspends the main thread and terminates each sub-thread.

3. The method according to claim 2, characterized in that The step of setting the user state context information of the application program in the kernel space according to the notification information and using the program loading and running information includes: If the notification information includes the identifier of the main thread and the identifiers of each sub-thread, the user state context information of the application program is set in the kernel space using the program loading and running information.

4. The method according to claim 2, characterized in that: The notification information is sent after the kernel module detects that the application program suspends the main thread and / or terminates the child thread.

5. The method according to claim 1, characterized in that After sending the main thread suspend instruction to the application, the method further includes: Receive the main thread suspension notification information sent by the application, wherein the main thread suspension notification information is used to enable the process management module to determine that the main thread has been suspended.

6. The method according to claim 2 or 3, characterized in that: After sending the main thread suspend instruction to the application, the method further includes: Receive the main thread suspension notification information and each child thread termination notification information sent by the application, wherein the main thread suspension notification information is used to enable the process management module to determine that the main thread has been suspended, and the notification information in response to the child thread termination is used to enable the process management module to determine that the child thread has been terminated.

7. The method according to any one of claims 1 to 4, characterized in that: After receiving the notification information sent by the kernel module, the method further includes: Reclaiming the original user-mode memory space of the application; Sets the user stack for the application.

8. The method according to any one of claims 1 to 5, characterized in that: After the user state context information of the application program is set in the kernel space by using the program loading and running information to complete the reconstruction of the application program corresponding to the executable file, the method further includes: The kernel interface is called with the identification of the application program, so that the kernel module receives the identification of the application program and puts the application program back into the running queue to run the application program.

9. An executable file loading device, characterized in that: include: A first receiving module, configured to receive program loading and running information sent by an application, wherein the application includes a main thread, and the program loading and running information corresponds to an executable file; An instruction sending module, used for sending a main thread suspension instruction to the application program, so that the application program suspends the main thread; A second receiving module is used to receive notification information sent by the kernel module, wherein the notification information is sent by the kernel module after detecting that the application program suspends the main thread; The information setting module is used to set the user state context information of the application program in the kernel space according to the notification information and adopt the program loading and running information to complete the reconstruction of the application program corresponding to the executable file.

10. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor executes the executable file loading method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the executable file loading method according to any one of claims 1 to 8.

12. A computer program product, characterized in that The invention comprises a computer program, which implements the executable file loading method according to any one of claims 1 to 8 when being executed by a processor.