CN110716758A - Program running method, device, equipment and storage medium - Google Patents

Program running method, device, equipment and storage medium Download PDF

Info

Publication number
CN110716758A
CN110716758A CN201810670779.6A CN201810670779A CN110716758A CN 110716758 A CN110716758 A CN 110716758A CN 201810670779 A CN201810670779 A CN 201810670779A CN 110716758 A CN110716758 A CN 110716758A
Authority
CN
China
Prior art keywords
program
module
mirror
mirror image
runtime
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN201810670779.6A
Other languages
Chinese (zh)
Inventor
李成龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Banma Zhixing Network Hongkong Co Ltd
Original Assignee
Alibaba Group Holding Ltd
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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201810670779.6A priority Critical patent/CN110716758A/en
Publication of CN110716758A publication Critical patent/CN110716758A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/63Image based installation; Cloning; Build to order
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44568Immediately runnable code
    • G06F9/44578Preparing or optimising for loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The disclosure provides a program running method, a program running device, a program running equipment and a storage medium. In the process of starting the program, saving the running time of the process by using the time after at least one part of the resource file required by the process loading program so as to obtain the mirror process of the process. And responding to the next starting of the program, and recovering the mirror process to obtain a process entity which is consistent with the running state of the process corresponding to the moment. Therefore, by directly starting the mirror image process stored on the disk, the initialization part of the resource can be reduced or even skipped, the memory distribution of the process does not need to be reconstructed, and the running time of the snapshot process is used, so that the time for processing the program is reduced, and the aim of quickly starting the program is fulfilled.

Description

Program running method, device, equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a program running method, apparatus, device, and storage medium.
Background
When a program is started, some fixed resource files generally need to be loaded, and the resource files need to be initialized when loaded, so that the program starting time is long.
The Linux system provides a hibernate scheme. Fig. 1 is a system architecture diagram showing the hibernate scheme. As can be seen from fig. 1, hibernate involves many modules and requires device driver cooperation and chip vendor support to do so. Specifically, in Swap of a kernel layer, a vendor is required to designate an exchange partition of a pre-reserved mirror; in the suspend and resume process, a manufacturer is required to realize operation aiming at the snapshot. In the snapshot process, a manufacturer is required to store all context information and memory information of a kernel; in the Hibernate process, when the block IO is suspend in advance and the snapshot stores context information, the block equipment needs to be operated, and at the moment, a manufacturer needs to realize independent read-write block equipment operation; for a specific Device driver, a manufacturer is required to implement a safe and stable state retention and recovery mechanism, such as GPU, 3G modem, WIFI firmware, etc. Therefore, the hibernate scheme is used for snapshotting the whole system, and although the whole system can be started more quickly, the hibernate scheme is high in overhead, complex to implement and not flexible enough.
Therefore, a solution with low overhead and flexible usage is needed to increase the program start-up speed.
Disclosure of Invention
One object of the present disclosure is to propose a program running scheme capable of increasing the program start-up speed.
According to a first aspect of the present disclosure, there is provided a program execution method including: in the process of starting the program, saving the running time of the process by using the time after at least one part of the resource file required by the process loading program so as to obtain a mirror process of the process; and responding to the next starting of the program, and recovering the mirror process to obtain a process entity which is consistent with the running state of the process corresponding to the moment.
Optionally, the program execution method further includes: responding to the next starting of the program, and judging whether an available mirror image process exists or not; and executing a step of recovering the mirror process in the case where it is determined that there is an available mirror process.
Optionally, the step of saving the runtime of the process includes: acquiring the current running state of a process; based on the runtime state, collecting thread context in the process; and writing each thread and semaphore in the process into a file one by one according to the thread context and storing to obtain the mirror image process.
Optionally, the step of collecting thread context in the process includes: transmitting the runtime state formation parameter list to the kernel; calling a process entity in the kernel according to the parameter list; and collecting the thread context in the process entity called currently by the kernel as the thread context in the process.
Optionally, the step of recovering the mirroring process includes: analyzing the mirror image process to obtain a runtime structure; creating a process structure according to the runtime structure; and generating a process entity according to the created process structure.
Optionally, the runtime includes an element corresponding to the current running state of the process.
Optionally, the elements include: stacking; a register; memory layout; and a semaphore.
Optionally, the program execution method further includes: and registering a callback and error processing mechanism in the application layer, wherein the callback and error processing mechanism is used for carrying out callback and error processing under the condition that an error occurs during the process of saving the process.
According to a second aspect of the present disclosure, there is also provided a program execution method including: responding to the starting of the program, and judging whether a mirror process corresponding to the program exists or not; under the condition that the mirror image process corresponding to the program exists, constructing a process entity based on the mirror image process; and/or under the condition that the mirror process corresponding to the program does not exist, using the resource file required by the process loading program, and saving the running time of the process at the time after at least one part of the resource file required by the process loading program so as to obtain the mirror process of the process.
According to a third aspect of the present disclosure, there is also provided a program execution device including: the system comprises a mirror image process generation module, a process loading module and a processing module, wherein the mirror image process generation module is used for saving the running time of a process at the moment after at least one part of a resource file required by the process loading program in the process of starting the program so as to obtain a mirror image process of the process; and the mirror image process recovery module is used for responding to the next starting of the program and recovering the mirror image process so as to obtain a process entity with the running state consistent with that of the process corresponding to the moment.
Optionally, the program execution device further includes: and the judging module is used for responding to the next starting of the program, judging whether an available mirror process exists or not, and under the condition that the available mirror process exists, the mirror process recovering module recovers the mirror process.
Optionally, the mirror process generating module includes: the runtime acquisition module is used for acquiring the current runtime state of the process; a thread context collection module for collecting thread contexts in the process based on the runtime state; and the file saving module is used for writing each thread and semaphore in the process into a file one by one according to the thread context and saving the thread and the semaphore to obtain the mirror image process.
Optionally, the thread context collecting module includes: the list generation module is used for forming a parameter list from the runtime state and transmitting the parameter list to a kernel; the process creating module is used for creating and calling a process entity according to the parameter list; and the collection module is used for collecting the thread context in the currently called process entity as the thread context in the process.
Optionally, the mirror process restoring module includes: the runtime structure analysis module is used for analyzing the mirror image process to obtain a runtime structure; the process structure creating module is used for creating a process structure according to the runtime structure; and the process entity generating module is used for generating the process entity according to the created process structure.
Optionally, the runtime includes an element corresponding to the current running state of the process.
Optionally, the elements include: stacking; a register; memory layout; and a semaphore.
Optionally, the program execution device further includes: and the registration module is used for registering a callback and error processing mechanism in an application layer and carrying out callback and error processing under the condition of saving errors in the process running.
According to a fourth aspect of the present disclosure, there is also provided a program execution device including: the judging module is used for responding to the starting of a program and judging whether a mirror process corresponding to the program exists or not; the construction module is used for constructing a process entity based on the mirror image process under the condition that the mirror image process corresponding to the program is judged to exist; and/or a mirror process generation module, configured to, when it is determined that there is no mirror process corresponding to the program, load a resource file required by the program using a process, and save the runtime of the process at a time after the process loads at least a part of the resource file required by the program, to obtain the mirror process of the process.
According to a fifth aspect of the present disclosure, there is also provided a computing device comprising: a processor; and a memory having executable code stored thereon, which when executed by the processor, causes the processor to perform a method as set forth in the first or second aspect of the disclosure.
According to a sixth aspect of the present disclosure, there is also provided a non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to perform a method as set forth in the first or second aspect of the present disclosure.
The method and the device have the advantages that the process for preloading the program is snapshot, so that the mirror image process stored on the disk can be directly started when the program is started next time, the initialization part of the resource can be reduced or even skipped, the memory distribution of the process does not need to be reconstructed, and the time for processing the program is reduced when the snapshot process is used during running, so that the aim of quick starting is fulfilled.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent by describing in greater detail exemplary embodiments thereof with reference to the attached drawings, in which like reference numerals generally represent like parts throughout.
Fig. 1 is a system architecture diagram showing the hibernate scheme.
Fig. 2 is a schematic flow chart diagram illustrating a program execution method according to an embodiment of the present disclosure.
FIG. 3 shows a schematic flow diagram of a mirror process generation process in accordance with an embodiment of the present disclosure.
Fig. 4 shows a schematic diagram of a process runtime.
FIG. 5 shows an illustrative flow diagram of a mirrored process recovery process in accordance with an embodiment of the disclosure.
Fig. 6 is a schematic flow chart diagram illustrating a program execution method according to another embodiment of the present disclosure.
Fig. 7 is a schematic block diagram showing the configuration of a program execution device according to an embodiment of the present invention.
Fig. 8 is a schematic block diagram showing the configuration of a program execution device according to another embodiment of the present invention.
FIG. 9 shows a schematic structural diagram of a computing device according to an embodiment of the invention.
Detailed Description
Preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While the preferred embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
[ term interpretation ]
Preloading: and in the program starting process, loading the resources required by the program by using another process.
Resource files: the resources to be loaded in the program starting process may be resources such as a shared library, a data space, a code space, an opened file, and the like used in the program running.
And (3) running: the corresponding elements of the process in the running process can be a general name of private elements such as stacks, registers, memory layout, semaphores and the like. Through these elements, a complete process can be described.
Snapshot: and carrying out one-time run-time saving process on the running process. The runtime is stored on disk in a special format.
And (3) mirroring process: a snapshot of a process saved on disk is referred to as a mirrored process of the process. The mirror process has all the runtimes of the process at a certain time point, and the runtimes can be independently started.
Thread context: there may be multiple threads in a process that are automatically scheduled by the kernel and each thread has its own thread context, including semaphores such as thread ID, stack pointer, program counter, general purpose registers, and condition codes.
[ scheme overview ]
Fig. 2 is a schematic flow chart diagram illustrating a program execution method according to an embodiment of the present disclosure.
Referring to fig. 2, in step S210, during program startup, the runtime of the process is saved at a time after using at least a portion of the resource file required by the process loader to obtain a mirrored process of the process.
The process mentioned here refers to a process for performing a preload operation during program start-up. When the process is saved, the starting speed of the program can be increased by selecting a proper time point. In practical application, an optimal time point can be determined through continuous debugging. Generally, the time after the resource file loading is completed may be selected as the time when the save process is running. That is, the runtime of the process may be saved, preferably at a time after all of the resource files needed by the process loader are used.
The saved runtime includes all elements corresponding to the current running state of the process, for example, elements such as a stack, a register, a memory layout, and a semaphore may be included.
As an example, the runtime of a process may be saved to obtain a mirrored process for the process as follows. Specifically, at a time after using at least a portion of the resource file required by the process loader, the current runtime state of the process may be obtained, and a thread context (thread context) in the process may be collected based on the runtime state. According to the collected thread context, each thread in the process and the semaphore can be written into a file one by one and stored to obtain the mirror process. Wherein the operation of collecting thread context in a process may be performed by the kernel. For example, the runtime state forming parameter list may be passed to the kernel, and the kernel may create and invoke a process entity according to the parameter list, and then collect, by the kernel, a thread context in the currently invoked process entity as a thread context in the process that needs to be collected.
In step S220, in response to the next startup of the program, the mirroring process is restored to obtain a process entity that is consistent with the running state of the process corresponding to the time at the time of saving.
In response to the next startup of the program, it may be determined whether there is an available mirror process, and in the case where it is determined that there is an available mirror process, the mirror process may be restored. In the case that it is determined that there is no available mirror process, the process creation process may be started according to an existing program, and the resource file required by the created process is loaded to implement initialization of the resource. In addition, in the process running process, step S210 may be executed to obtain the mirror process of the process, so that the mirror process may be directly used when the program is started next time, so as to reduce or even avoid the resource initialization operation, thereby increasing the program starting speed.
After all resource files required by the process loading program are used, under the condition of saving the running time of the process, when the program is started next time, the mirror image process saved on the disk is directly started, the initialization part of the resource is skipped, the memory distribution of the process does not need to be reconstructed, and the running time of the snapshot process is used, so that the time for processing the program is reduced, and the purpose of quick starting is achieved.
Therefore, when the program is started next time, the program can be operated by using the previously saved mirror image process, so that the resource initialization operation can be reduced or even avoided, and the starting time of the program is reduced. This overhead reduction is more significant, particularly when the resources are large and the categories are numerous.
So far, the implementation principle of the program operation scheme of the present disclosure is briefly explained. As can be seen from the above description, the program execution scheme of the present disclosure mainly includes a mirror process generation step and a mirror process recovery step. These two steps are further described below.
[ Generation of mirror image Process ]
FIG. 3 shows a schematic flow diagram of a mirror process generation process in accordance with an embodiment of the present disclosure.
Referring to fig. 3, in response to the start of the program, step S310 may be performed first to load a resource file.
In step S320, resources are initialized. The resource initialization mentioned herein mainly refers to the initialization of the resource file loaded in step S310.
The process of loading the resource file (step S310) and initializing the resource (step S320) belongs to the existing program starting process, and is not described herein again.
In step S330, the snapshot library is initialized.
It is mainly to detect whether the current platform supports the solution of the present disclosure. And under the condition of supporting the scheme of the present disclosure, the snapshot library initialization operation is carried out, so as to facilitate the subsequent processing. The snapshot library is similar to the existing initialization process, and is not described here again.
At step S340, a snapshot callback is registered.
A callback and error handling mechanism may be registered in the application layer for performing callback and error handling in case of an error in the runtime of the save process (i.e., step S395). For example, when an error occurs in the process runtime saving, the process runtime is re-acquired by returning to step S350.
In step S350, the process runtime is acquired.
The method mainly comprises the step of obtaining the runtime state of the current process. As shown in FIG. 4, the retrieved runtime may include a process stack structure, process registers, data space mappings, open file structures, process attributed signals, and resource files, among others.
Step S350 may be executed during the process of loading the resource file by the process, or step S350 may be executed after the process finishes loading the resource file. Preferably, step S350 may be executed after the process finishes loading the resource file.
At step S360, runtime parameters are constructed.
Here, the parameter list is mainly constructed according to the runtime acquired in step S350. The constructed parameter list may be saved as a snapshot.
In step S370, the kernel is notified of the processing runtime parameters.
The constructed parameter list may be passed to the kernel. The kernel can restore the obtained parameter list (i.e. snapshot) according to the obtained parameter list to create a corresponding process entity, and can call the created process entity.
In step S380, the kernel builds a thread data linked list.
Here, mainly the kernel collects the thread context in the current process (i.e. the created process entity), and the collected thread context can be regarded as the thread context in the process runtime acquired when step S350 is executed.
In step S390, the kernel is notified to start recording the snapshot.
The kernel can write the threads and semaphores into the file one by one according to the collected thread context to obtain the recorded snapshot file.
In step S395, the run is saved, and the run program is continued.
The recorded snapshot file may be saved on disk to obtain the mirroring process. Wherein if the saving is successful, the program can continue to run. If the save fails, subsequent processing may be performed based on the previously registered callback and error handling mechanisms. For example, the process runtime may be re-acquired by returning to step S350, or the runtime parameters may be reconstructed by returning to step S360.
[ mirror Process recovery ]
FIG. 5 shows an illustrative flow diagram of a mirrored process recovery process in accordance with an embodiment of the disclosure.
Referring to fig. 5, in step S510, in response to the start of the program (which can be regarded as the next start as compared to fig. 3), the mirroring process is opened. Here, a previously saved mirror process consistent with the program started this time may be designated and opened.
In step S520, the kernel is notified to resolve the process runtime in the mirror process.
The runtime structure can be parsed out according to the format of the saved mirror process.
In step S530, the kernel resumes process runtime.
From the parsed runtime structure, a process structure can be created.
In step S540, the kernel notifies the parent process fork to come out of the new process.
A process entity (i.e., a new process) may be fork based on the newly created process structure (i.e., parent process) described above.
In step S550, the new process notifies the kernel to run the resumed runtime.
The new process out of fork is consistent with the running state of the process corresponding to the previously saved mirror process, so that the recovery of the previously saved running (namely, the mirror process) can be realized based on the new process.
In summary, the recovery of the mirror process involves reading data at runtime and recreating a process structure, the whole process needs to ensure the spatial integrity of the newly created process, and the process cannot be started normally in a place with errors. In principle, is the reverse of the mirror process generation process described above. After the mirror image process is recovered, the mirror image process is directly executed from the last snapshot point, so that the initialization stage of resources can be reduced or even skipped, some unnecessary analysis steps are saved, and the starting time is saved. The advantages of the disclosed solution are even more apparent if a program has a large number of resource loading operations.
[ application example ]
Fig. 6 is a schematic flow chart diagram illustrating a program execution method according to an embodiment of the present disclosure.
Referring to fig. 6, in step S610, in response to the start of the program, it may be first determined whether a corresponding mirroring process exists. I.e. to determine whether a mirrored process consistent with the currently started program has been saved before.
If it is determined that there is no mirroring process, step S650 and step S660 may be executed, according to a conventional program starting procedure, loading a resource file that needs to be used in the program starting process, and performing an initialization operation on the resource file. For example, a separate process may be created, and the steps S650 and S660 may be executed by the process to perform the preloading operation during the program start-up.
In step S670, a mirror process of the process may be generated at a time after at least a portion (preferably all) of the resource files required by the process to load the program. The generation process of the mirror process may refer to the above description, and is not described herein again. Then, the program can be normally run.
In the case that it is determined that the mirror process exists, when the loader starts the required resource file in step S620, the resource initialization step may be skipped, and the mirror process may be loaded (step S630) and restored to restore the runtime corresponding to the mirror process (i.e., step S640). Then, the program can be normally run. The step S630 and the step S640 may refer to the recovery process of the mirror process, which is not described herein again.
Therefore, when the program is started, the mirror image process is used, so that the initialization operation of the resource can be reduced or even skipped, and the starting time of the program is reduced. Therefore, the essence of the program running scheme disclosed by the invention is that in the process of starting the program, the mirror image process stored on the disk is directly started, the initialization part of the resource can be reduced or even skipped, the memory distribution of the process does not need to be reconstructed, and the running of the snapshot process is used, so that the time for processing the program is reduced, and the purpose of quick starting is achieved.
Furthermore, the method and the device have the advantages that the single program process snapshot is realized, the overhead is low, and the use is flexible. And a large amount of hardware drive callbacks similar to hibernate do not exist, and special drive support is not needed.
Through actual project tests, when a container is operated by using a mirror process, the starting time is averaged to be 7s, while the average time is 12s under the conventional starting condition, which is improved by about 40%. The main reason is that about 100 pieces of picture information need to be loaded during startup of the container, and decoding needs to be performed on these picture resources, which takes about 45% of the whole startup time. After the scheme is adopted, the content which is decoded is used, and the efficiency can be obviously improved.
In addition, the program can be started quickly by using the scheme, and the program can be started as required, so that the aim of saving the memory is fulfilled. For example, after the program is snapshot, the original program can be directly exited without running, and when the program is needed next time, the mirror process is directly started, and the starting speed is faster than the restarting speed after the simple process kill.
[ PROGRAM OPERATING DEVICE ]
Fig. 7 is a schematic block diagram showing the configuration of a program execution device according to an embodiment of the present invention. Wherein the functional blocks of the program execution device may be implemented by hardware, software, or a combination of hardware and software that implement the principles of the present invention. It will be appreciated by those skilled in the art that the functional blocks described in fig. 7 may be combined or divided into sub-blocks to implement the principles of the invention described above. Thus, the description herein may support any possible combination, or division, or further definition of the functional modules described herein.
In the following, functional modules that the program execution device can have and operations that each functional module can perform are briefly described, and for the details related thereto, reference may be made to the description above in conjunction with fig. 2 to 5, which is not described again here.
Referring to fig. 7, the program execution device 700 may include a mirror process generating module 710 and a mirror process restoring module 720.
The mirror process generating module 710 is configured to save the runtime of the process at a time after at least a portion of the resource file required by the process loader is used in the process of starting the program, so as to obtain a mirror process of the process. The runtime includes elements corresponding to the current running state of the process, and may include, for example, elements such as stacks, registers, memory layout, and semaphores.
By way of example, the mirror process generation module 710 may include a runtime acquisition module 711, a thread context collection module 713, and a file save module 715.
The runtime acquisition module 711 is used to acquire the current runtime state of the process. The thread context collection module 713 is configured to collect thread contexts in a process based on the runtime state. The file saving module 715 is configured to write and save each thread and semaphore in the process into a file one by one according to the thread context, so as to obtain the mirror process.
Optionally, thread context collection module 713 may include a list generation module 7131, a process creation module 7133, and a collection module 7135.
The list generation module 7131 is used to form and pass the runtime state into a parameter list to the kernel. The process creation module 7133 is used to create and invoke process entities from the parameter list. The collection module 7135 is used to collect thread contexts in currently called process entities as thread contexts in the process to be collected.
The mirror process recovery module 720 is configured to recover the mirror process in response to the next startup of the program, so as to obtain a process entity whose running state is consistent with the process corresponding to the time.
By way of example, the mirrored process recovery module 720 can include a runtime fabric parsing module 721, a process fabric creation module 723, and a process entity generation module 725.
The runtime structure parsing module 721 is configured to parse the mirror process to obtain a runtime structure. The process structure creation module 723 is configured to create a process structure based on the runtime structure. The process entity generation module 725 is used to generate process entities from the created process structure.
As shown in fig. 7, the program execution device 700 may optionally include a determination module 730. The determining module 730 is configured to determine whether an available mirror process exists in response to a next startup of the program. In the event that the decision block 730 determines that there is an available mirror process, the mirror process recovery block 720 recovers the mirror process.
As shown in fig. 7, the program execution device 700 may optionally include a registration module 740. The registration module 740 is configured to register a callback and error handling mechanism in the application layer, and is configured to perform callback and error handling when an error occurs during the process saving operation.
Fig. 8 is a schematic block diagram showing the configuration of a program execution device according to an embodiment of the present invention. Wherein the functional blocks of the program execution device may be implemented by hardware, software, or a combination of hardware and software that implement the principles of the present invention. It will be appreciated by those skilled in the art that the functional blocks described in fig. 8 may be combined or divided into sub-blocks to implement the principles of the invention described above. Thus, the description herein may support any possible combination, or division, or further definition of the functional modules described herein.
In the following, functional modules that the program execution device can have and operations that each functional module can perform are briefly described, and for the details related thereto, reference may be made to the description above in conjunction with fig. 6, which is not described herein again.
Referring to fig. 8, the program execution device 800 may include a determination module 810, a construction module 820, and a mirror process generation module 830.
The determining module 810 is configured to determine whether a mirror process corresponding to the program exists in response to the starting of the program.
The building module 820 is configured to build a process entity based on the mirror process in a case where the determining module 810 determines that the mirror process corresponding to the program exists.
And a mirror process generation module, configured to use the resource file required by the process loader when the determination module 810 determines that the mirror process corresponding to the program does not exist, and save the running time of the process at a time after at least a part of the resource file required by the process loader, so as to obtain the mirror process of the process.
[ calculating device ]
Fig. 9 is a schematic structural diagram of a data processing computing device that can be used to implement the program execution method according to an embodiment of the present invention.
Referring to fig. 9, computing device 900 includes memory 910 and processor 920.
The processor 920 may be a multi-core processor or may include multiple processors. In some embodiments, processor 920 may include a general-purpose main processor and one or more special purpose coprocessors such as a Graphics Processor (GPU), Digital Signal Processor (DSP), or the like. In some embodiments, processor 920 may be implemented using custom circuits, such as Application Specific Integrated Circuits (ASICs) or Field Programmable Gate Arrays (FPGAs).
The memory 910 may include various types of storage units, such as system memory, Read Only Memory (ROM), and permanent storage. Wherein the ROM may store static data or instructions for the processor 920 or other modules of the computer. The persistent storage device may be a read-write storage device. The persistent storage may be a non-volatile storage device that does not lose stored instructions and data even after the computer is powered off. In some embodiments, the persistent storage device employs a mass storage device (e.g., magnetic or optical disk, flash memory) as the persistent storage device. In other embodiments, the permanent storage may be a removable storage device (e.g., floppy disk, optical drive). The system memory may be a read-write memory device or a volatile read-write memory device, such as a dynamic random access memory. The system memory may store instructions and data that some or all of the processors require at runtime. In addition, the memory 910 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), magnetic and/or optical disks, may also be employed. In some embodiments, memory 910 may include a removable storage device that is readable and/or writable, such as a Compact Disc (CD), a digital versatile disc read only (e.g., DVD-ROM, dual layer DVD-ROM), a Blu-ray disc read only, an ultra-dense disc, a flash memory card (e.g., SD card, min SD card, Micro-SD card, etc.), a magnetic floppy disk, or the like. Computer-readable storage media do not contain carrier waves or transitory electronic signals transmitted by wireless or wired means.
The memory 910 stores processable code, which, when processed by the processor 920, causes the processor 920 to perform the above-described program execution methods.
The program execution method, apparatus, and computing device according to the present invention have been described in detail above with reference to the accompanying drawings.
Furthermore, the method according to the invention may also be implemented as a computer program or computer program product comprising computer program code instructions for carrying out the above-mentioned steps defined in the above-mentioned method of the invention.
Alternatively, the invention may also be embodied as a non-transitory machine-readable storage medium (or computer-readable storage medium, or machine-readable storage medium) having stored thereon executable code (or a computer program, or computer instruction code) which, when executed by a processor of an electronic device (or computing device, server, etc.), causes the processor to perform the steps of the above-described method according to the invention.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems and methods according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Having described embodiments of the present invention, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (20)

1. A program execution method, comprising:
in the process of starting a program, saving the running time of the process by using the time after at least one part of a resource file required by the process loading program so as to obtain a mirror process of the process; and
and responding to the next starting of the program, and recovering the mirror process to obtain a process entity with the running state consistent with that of the process corresponding to the moment.
2. The program execution method according to claim 1, further comprising:
responding to the next starting of the program, and judging whether an available mirror image process exists or not; and
and in the case that the available mirror process is judged to exist, executing the step of recovering the mirror process.
3. The program execution method according to claim 1, wherein the step of saving the execution time of the process comprises:
acquiring the current running state of the process;
collecting thread context in the process based on the runtime state; and
and writing each thread and semaphore in the process into a file one by one according to the thread context and storing the thread and the semaphore to obtain the mirror image process.
4. The program execution method of claim 3, wherein the step of collecting thread contexts in the process comprises:
passing the runtime state formation parameter list to a kernel;
creating and calling a process entity by the kernel according to the parameter list; and
and collecting the thread context in the process entity called currently by the kernel as the thread context in the process.
5. The program execution method according to claim 1, wherein the step of recovering the mirrored process comprises:
analyzing the mirror image process to obtain a runtime structure;
creating a process structure according to the runtime structure; and
and generating the process entity according to the created process structure.
6. The program execution method according to claim 1,
the runtime includes elements corresponding to the current running state of the process.
7. The program execution method according to claim 6, wherein the elements include:
stacking;
a register;
memory layout; and
and (4) signal quantity.
8. The program execution method according to claim 1, further comprising:
and registering a callback and error processing mechanism in the application layer, wherein the callback and error processing mechanism is used for carrying out callback and error processing under the condition that an error occurs during the process running.
9. A program execution method, comprising:
responding to the starting of a program, and judging whether a mirror process corresponding to the program exists or not;
under the condition that the mirror image process corresponding to the program exists, constructing a process entity based on the mirror image process; and/or
And under the condition that the mirror process corresponding to the program does not exist, loading the resource file required by the program by using the process, and saving the running time of the process at the moment after the process loads at least one part of the resource file required by the program so as to obtain the mirror process of the process.
10. A program execution device characterized by comprising:
the system comprises a mirror image process generation module, a process loading module and a processing module, wherein the mirror image process generation module is used for saving the running time of a process at the moment after at least one part of a resource file required by the process loading program in the process of starting the program so as to obtain a mirror image process of the process; and
and the mirror image process recovery module is used for responding to the next starting of the program and recovering the mirror image process so as to obtain a process entity with the running state of the process corresponding to the moment consistent with that of the process.
11. The program execution device according to claim 10, further comprising:
a judging module for responding to the next starting of the program and judging whether an available mirror image process exists or not,
and under the condition that the judging module judges that the available mirror image process exists, the mirror image process recovering module recovers the mirror image process.
12. The program execution device according to claim 10, wherein the mirror process generation module includes:
the runtime acquisition module is used for acquiring the current runtime state of the process;
a thread context collection module for collecting thread contexts in the process based on the runtime state; and
and the file storage module is used for writing each thread and semaphore in the process into a file one by one according to the thread context and storing the thread and the semaphore to obtain the mirror image process.
13. The program execution device of claim 12, wherein the thread context collection module comprises:
the list generation module is used for forming a parameter list from the runtime state and transmitting the parameter list to a kernel;
the process creating module is used for creating and calling a process entity according to the parameter list; and
and the collection module is used for collecting the thread context in the currently called process entity as the thread context in the process.
14. The program execution device according to claim 10, wherein the mirrored process recovery module comprises:
the runtime structure analysis module is used for analyzing the mirror image process to obtain a runtime structure;
the process structure creating module is used for creating a process structure according to the runtime structure; and
and the process entity generating module is used for generating the process entity according to the created process structure.
15. The program execution device of claim 10,
the runtime includes elements corresponding to the current running state of the process.
16. The program execution device of claim 15, wherein the elements comprise:
stacking;
a register;
memory layout; and
and (4) signal quantity.
17. The program execution device according to claim 10, further comprising:
and the registration module is used for registering a callback and error processing mechanism in an application layer and carrying out callback and error processing under the condition of saving errors in the process running.
18. A program execution device characterized by comprising:
the judging module is used for responding to the starting of a program and judging whether a mirror process corresponding to the program exists or not;
the construction module is used for constructing a process entity based on the mirror image process under the condition that the judgment module judges that the mirror image process corresponding to the program exists; and/or
And the mirror process generation module is used for loading the resource file required by the program by using a process under the condition that the judging module judges that the mirror process corresponding to the program does not exist, and saving the running time of the process at the moment after the process loads at least one part of the resource file required by the program so as to obtain the mirror process of the process.
19. A computing device, comprising:
a processor; and
a memory having executable code stored thereon, which when executed by the processor, causes the processor to perform the method of any of claims 1-9.
20. A non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to perform the method of any of claims 1-9.
CN201810670779.6A 2018-06-26 2018-06-26 Program running method, device, equipment and storage medium Pending CN110716758A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810670779.6A CN110716758A (en) 2018-06-26 2018-06-26 Program running method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810670779.6A CN110716758A (en) 2018-06-26 2018-06-26 Program running method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN110716758A true CN110716758A (en) 2020-01-21

Family

ID=69208143

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810670779.6A Pending CN110716758A (en) 2018-06-26 2018-06-26 Program running method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110716758A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111786904A (en) * 2020-07-07 2020-10-16 上海道客网络科技有限公司 System and method for realizing container dormancy and awakening
CN112416467A (en) * 2020-12-10 2021-02-26 上海维宏电子科技股份有限公司 Control system, method, device, processor and computer readable storage medium for realizing rapid starting and initialization of numerical control system
WO2023168875A1 (en) * 2022-03-10 2023-09-14 北京百度网讯科技有限公司 Method and apparatus for starting model service, and device, medium and product

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1818869A (en) * 2006-03-15 2006-08-16 浙江大学 Mirror starting optimization of built-in operation system
CN101777018A (en) * 2010-02-08 2010-07-14 北京同有飞骥科技有限公司 Copying and snapshot combined Windows system protection method
CN102467403A (en) * 2011-10-14 2012-05-23 海尔集团技术研发中心 Software fast switching method based on progress emigration/immigration and device thereof
CN102779072A (en) * 2012-06-18 2012-11-14 中国科学院上海微***与信息技术研究所 Embedded system and dormancy and wake-up method of application process thereof
CN104102506A (en) * 2014-04-25 2014-10-15 华南理工大学 ARM (Advanced RISC Machine) platform based Android startup acceleration method
CN104216776A (en) * 2014-08-25 2014-12-17 成都三零凯天通信实业有限公司 Quick starting method for Android operating system based on BLCR (Berkeley lab checkpoint restart) technology
US9032199B1 (en) * 2012-12-28 2015-05-12 Google Inc. Systems, devices, and methods for capturing information, creating loadable images, and providing for restarts in a computer system
CN104636210A (en) * 2013-11-07 2015-05-20 腾讯科技(深圳)有限公司 Method and device for achieving data exchanging between progresses
CN104794399A (en) * 2015-04-23 2015-07-22 北京北信源软件股份有限公司 Terminal protection system and method based on massive program behavior data
CN106959909A (en) * 2017-03-27 2017-07-18 西安电子科技大学 A kind of application software abnormal restoring method in android system
US20180129520A1 (en) * 2016-11-07 2018-05-10 Beijing Baidu Netcom Science And Technology Co., Ltd. Method and apparatus for starting virtual machine

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1818869A (en) * 2006-03-15 2006-08-16 浙江大学 Mirror starting optimization of built-in operation system
CN101777018A (en) * 2010-02-08 2010-07-14 北京同有飞骥科技有限公司 Copying and snapshot combined Windows system protection method
CN102467403A (en) * 2011-10-14 2012-05-23 海尔集团技术研发中心 Software fast switching method based on progress emigration/immigration and device thereof
CN102779072A (en) * 2012-06-18 2012-11-14 中国科学院上海微***与信息技术研究所 Embedded system and dormancy and wake-up method of application process thereof
US9032199B1 (en) * 2012-12-28 2015-05-12 Google Inc. Systems, devices, and methods for capturing information, creating loadable images, and providing for restarts in a computer system
CN104636210A (en) * 2013-11-07 2015-05-20 腾讯科技(深圳)有限公司 Method and device for achieving data exchanging between progresses
CN104102506A (en) * 2014-04-25 2014-10-15 华南理工大学 ARM (Advanced RISC Machine) platform based Android startup acceleration method
CN104216776A (en) * 2014-08-25 2014-12-17 成都三零凯天通信实业有限公司 Quick starting method for Android operating system based on BLCR (Berkeley lab checkpoint restart) technology
CN104794399A (en) * 2015-04-23 2015-07-22 北京北信源软件股份有限公司 Terminal protection system and method based on massive program behavior data
US20180129520A1 (en) * 2016-11-07 2018-05-10 Beijing Baidu Netcom Science And Technology Co., Ltd. Method and apparatus for starting virtual machine
CN106959909A (en) * 2017-03-27 2017-07-18 西安电子科技大学 A kind of application software abnormal restoring method in android system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
张献忠主编;何中胜副主编;周国华,许子辛参编: "操作***教程", 中国电力出版社 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111786904A (en) * 2020-07-07 2020-10-16 上海道客网络科技有限公司 System and method for realizing container dormancy and awakening
CN111786904B (en) * 2020-07-07 2021-07-06 上海道客网络科技有限公司 System and method for realizing container dormancy and awakening
CN112416467A (en) * 2020-12-10 2021-02-26 上海维宏电子科技股份有限公司 Control system, method, device, processor and computer readable storage medium for realizing rapid starting and initialization of numerical control system
WO2023168875A1 (en) * 2022-03-10 2023-09-14 北京百度网讯科技有限公司 Method and apparatus for starting model service, and device, medium and product

Similar Documents

Publication Publication Date Title
JP4489802B2 (en) Multi-CPU computer and system restart method
KR101292429B1 (en) Fast booting an operating system from an off state
US9053065B2 (en) Method for restoring virtual machine state from a checkpoint file
US9053064B2 (en) Method for saving virtual machine state to a checkpoint file
US9218893B2 (en) Memory testing in a data processing system
CN110716758A (en) Program running method, device, equipment and storage medium
JP2012504281A (en) Nested file system support
WO2019242272A1 (en) Bios-based operating system booting method, device, apparatus, and medium
JP2006072931A (en) Program for panic dump collection, method, and mechanism
US20060075274A1 (en) Method and apparatus for enabling run-time recovery of a failed platform
US9158550B2 (en) Caching based operating system installation
US10635554B2 (en) System and method for BIOS to ensure UCNA errors are available for correlation
CN113791934A (en) Data recovery method, computing device and storage medium
US20110202903A1 (en) Apparatus and method for debugging a shared library
JP2009176146A (en) Multi-processor system, failure detecting method and failure detecting program
JP6677021B2 (en) Information processing apparatus, information processing method, and program
JP2004102395A (en) Method for acquiring memory dump data and information processor and its program
CN114756355B (en) Method and device for automatically and quickly recovering process of computer operating system
US10768940B2 (en) Restoring a processing unit that has become hung during execution of an option ROM
CN115421960A (en) UE memory fault recovery method, device, electronic equipment and medium
WO2014024279A1 (en) Memory failure recovery device, method, and program
CN116339908A (en) Virtual machine starting method, device, computer equipment and storage medium
JP5427814B2 (en) Failure analysis information collection device
JP2015118493A (en) Trace device and trace program
US10592329B2 (en) Method and electronic device for continuing executing procedure being aborted from physical address where error occurs

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40021954

Country of ref document: HK

TA01 Transfer of patent application right

Effective date of registration: 20201123

Address after: Room 603, 6 / F, Roche Plaza, 788 Cheung Sha Wan Road, Kowloon, China

Applicant after: Zebra smart travel network (Hong Kong) Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

TA01 Transfer of patent application right
RJ01 Rejection of invention patent application after publication

Application publication date: 20200121

RJ01 Rejection of invention patent application after publication