WO2022213641A1 - 进程接替的方法、装置、电子设备及存储介质 - Google Patents

进程接替的方法、装置、电子设备及存储介质 Download PDF

Info

Publication number
WO2022213641A1
WO2022213641A1 PCT/CN2021/136055 CN2021136055W WO2022213641A1 WO 2022213641 A1 WO2022213641 A1 WO 2022213641A1 CN 2021136055 W CN2021136055 W CN 2021136055W WO 2022213641 A1 WO2022213641 A1 WO 2022213641A1
Authority
WO
WIPO (PCT)
Prior art keywords
main process
sub
new
data processing
main
Prior art date
Application number
PCT/CN2021/136055
Other languages
English (en)
French (fr)
Inventor
张晓谦
田学明
李岩
Original Assignee
中国第一汽车股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中国第一汽车股份有限公司 filed Critical 中国第一汽车股份有限公司
Publication of WO2022213641A1 publication Critical patent/WO2022213641A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/0715Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a system implementing multitasking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes

Definitions

  • the embodiments of the present application relate to the technical field of data processing, for example, to a method, an apparatus, an electronic device, and a storage medium for process succession.
  • the main method is to create a shadow process for the child process through the main process as a backup.
  • the main process wakes up the shadow process to replace the failed child process and continues to execute the program.
  • the shadow process needs to execute the initialization program first in the succession process, and cannot quickly replace the sub-process to continue executing the program, which causes the screen meter of the vehicle terminal to appear stuck and affects the user's experience. Therefore, there is an urgent need for a process replacement method, which can solve the problems such as jamming of the screen instrument of the vehicle terminal when the program fails during the running of the process.
  • the embodiments of the present application provide a method, apparatus, electronic device, and storage medium for process succession, which can ensure the continuity of data transmission to an external controller without affecting user experience.
  • an embodiment of the present application provides a method for process succession, the method comprising:
  • an embodiment of the present application provides an apparatus for taking over a process, and the apparatus includes:
  • a process determination module configured to determine the main process and the auxiliary process corresponding to the target program code according to the process number corresponding to the target program code
  • a request receiving module configured to receive a data processing request sent by at least one external controller corresponding to the target program code through the main process and the secondary process;
  • a request processing module configured to return the data processing result corresponding to the data processing request to the at least one external controller through the main process
  • a process exchange module configured to, in response to detecting that the main process fails, return the data processing result corresponding to the data processing request to the at least one external controller through the secondary process; take the main process as a new A secondary process, using the secondary process as a new main process.
  • an embodiment of the present application provides an electronic device, the electronic device comprising:
  • a storage device configured to store at least one program
  • the at least one processor When the at least one program is executed by the at least one processor, the at least one processor implements the method for process succession described in any embodiment of the present application.
  • an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, wherein, when the program is executed by a processor, the method for process succession described in any embodiment of the present application is implemented.
  • FIG. 1 is a first schematic flowchart of a method for process succession provided by an embodiment of the present application
  • FIG. 2 is a second schematic flowchart of a method for process succession provided by an embodiment of the present application
  • 3A is a third schematic flowchart of a method for process succession provided by an embodiment of the present application.
  • FIG. 3B is a schematic diagram of a solution of a method for process succession provided by an embodiment of the present application
  • FIG. 4 is a schematic structural diagram of an apparatus for process succession provided by an embodiment of the present application.
  • FIG. 5 is a block diagram of an electronic device for implementing the method for process succession according to an embodiment of the present application.
  • FIG. 1 is a first schematic flowchart of a method for process succession provided by an embodiment of the present application. This embodiment can be applied to a situation where a secondary process executes a program instead of the primary process when the primary process fails.
  • the method for process succession provided in this embodiment may be performed by the apparatus for process succession provided in this embodiment of the present application, which may be implemented in software and/or hardware and integrated in an electronic device that executes the method.
  • the electronic device for executing the method may be a vehicle-mounted terminal.
  • the operating system applied in this application can be either a communication software system (embedded system) with high reliability, or an Internet software system, such as Linux operating system, Android operating system, Windows operating system, etc.
  • the operating system may run on the user service processing single board of the communication device, the main control single board, and may also run on the Internet function server, etc., which is not limited here.
  • the method of this embodiment includes but is not limited to the following steps:
  • S110 Determine the main process and the sub-process corresponding to the target program code according to the process number corresponding to the target program code.
  • the target program code refers to the program code running in the process, and the process number refers to a numerical value used to identify a unique process in the operating system.
  • the target program code is placed in two processes located in different partitions, and after the operating system is powered on, the two processes are started. That is, the two processes are located in different partitions, but execute the same program code. Any one of the two processes obtains the process IDs of itself and the other, and compares the obtained two process IDs. Divide the two processes into a main process and a sub-process according to the size of the process number. For example, the process of the two processes with the smaller process number is regarded as the main process, and the process of the two processes with the larger process number is regarded as the sub-process.
  • the external controller refers to a controller that communicates and interacts with the operating system, the number of external controllers is 1-N, and N is a natural number greater than 1.
  • the main process normally runs the target program code, receives a data processing request sent by at least one external controller, and responds to the data processing request.
  • the secondary process also receives a data processing request sent by at least one external controller, and responds to the data processing request. That is, both the main process and the sub-process are synchronized and consistent in receiving data processing requests from the external controller.
  • the main process when the main process receives a data processing request sent by at least one external controller (data processing requester), it responds to it, performs functional operation, and then returns the data processing result obtained by the operation to the data processing requester. . That is, the main process interacts with at least one external controller.
  • the secondary process as a backup process, only receives data processing requests from at least one external controller, and performs functional operations without returning the data processing results obtained by the operations to the data processing requester.
  • the sub process if a failure of the main process is detected, the sub process will take over the main process and continue to execute the target program code, that is, the sub process is regarded as a new main process, and the main process is repaired as a new sub process. .
  • the main process and the auxiliary process are exchanged, and the auxiliary process takes over the main process and continues to execute the target program code, and the cycle is repeated.
  • the sub process and the main process are receiving and processing data processing requests of at least one external controller synchronously and consistently, so when the main process fails, the sub process can The data processing result corresponding to the data processing request is returned to the at least one external controller, and the secondary process acts as a new main process to interact with the at least one external controller.
  • the advantage of this setting is that the main process and the sub-process can be switched quickly, which can ensure the continuity of sending data to the external controller.
  • the sub-process will continue to execute the target program code without affecting the execution of the target program code, so the on-board screen instrument will not be stuck and will not affect the user experience.
  • the fault detection process of the main process is as follows: the main process writes cyclic incremental data to the shared memory at predetermined time intervals; the secondary process reads the cyclic incremental data written by the main process in the shared memory at predetermined time intervals. Add data; if the secondary process fails to read the cyclic incremental data written by the main process in the shared memory for a preset number of consecutive times, it is determined that the main process is faulty. If the secondary process can normally read the cyclic incremental data written by the primary process in the shared memory, indicating that the primary process has not failed, the secondary process still acts as a backup process.
  • the main process writes cyclic incremental data to the shared memory at predetermined time intervals; when the main process fails, the main process does not write cyclic increments to the shared memory Increment data.
  • the secondary process reads the cyclic incremental data written by the main process in the shared memory at predetermined time intervals to monitor whether the main process fails; the predetermined time interval can be set by the user according to the actual situation, such as 2 milliseconds, or It can be set at the factory of the electronic device; the cyclic incremental data can be an integer from 0 to M, where M is a natural number greater than 0.
  • the secondary process does not read the cyclic incremental data written by the main process in the shared memory for a preset number of consecutive times, indicating that the main process has failed, the secondary process acts as the new main process and continues to execute the target program code in place of the main process; , the preset number of times can be set by the user according to the actual situation, such as three times.
  • the main process and the sub-process corresponding to the target program code are determined according to the process number corresponding to the target program code; the data sent by at least one external controller corresponding to the target program code is received through the main process and the sub-process. processing the request; returning the data processing result corresponding to the data processing request to at least one external controller through the main process; if a failure of the main process is detected, returning the data processing result corresponding to the data processing request to at least one external controller through the secondary process;
  • the main process is the new sub-process, and the sub-process is the new main process.
  • the sub-process receives and processes the data processing request of at least one external controller, and when the main process fails, the sub-process replaces the main process and returns to at least one external controller data processing results.
  • the present application can solve the problem of stuck on-board screen instrument caused by process replacement in the related art, can realize fast switching between the main process and the sub-process, can ensure the continuity of data transmission to the external controller, and will not affect the user experience.
  • FIG. 2 is a second schematic flowchart of the method for process succession provided by an embodiment of the present application.
  • the embodiments of the present application are refined on the basis of the above-mentioned embodiments, and detailed explanations are added for the process of writing partition information to the shared memory and the process of upgrading the program.
  • the method of this embodiment includes but is not limited to the following steps:
  • the main process and the auxiliary process need to write their corresponding partition information into the shared memory. If the main process fails, the main process and the sub-process will be exchanged with each other, that is, the main process will be the new sub-process, and the sub-process will be the new main process, so the process ID also needs to be written into the shared memory. Therefore, the corresponding relationship between the process identifier and the partition information of the process is written into the shared memory as a piece of data.
  • the main process writes the main process identifier and the partition information corresponding to the main process into the shared memory
  • the auxiliary process writes the auxiliary process identifier and the partition information corresponding to the auxiliary process into the shared memory.
  • the new main process identifier and the partition information corresponding to the new main process are written into the shared memory through the new main process; the new auxiliary process identifier and the partition corresponding to the new auxiliary process are written through the new auxiliary process.
  • Information is written to shared memory.
  • the main process when the main process fails, the main process acts as a new secondary process, and the secondary process acts as a new primary process. Therefore, the corresponding relationship between the process identifier stored in the shared memory and the partition information of the process may be wrong.
  • the new secondary process identifier corresponds to the partition information of the old main process (the main process before the failure occurred). Therefore, after the failure of the main process, it is necessary to rewrite the correspondence between the process ID and the partition information of the process into the shared memory, and delete the correspondence between the process ID and the partition information of the process before the failure of the main process. relation.
  • a program upgrade request can be initiated to the vehicle terminal. After receiving the program upgrade request sent by the user, the in-vehicle terminal responds to the program upgrade request.
  • the sub-process is controlled by the main process, so that the sub-process can perform program upgrade by the following three sub-steps:
  • the user initiates a program upgrade request to the vehicle terminal.
  • the in-vehicle terminal responds to the program upgrade request to obtain a program upgrade package corresponding to the program upgrade request.
  • the present application does not limit the manner of obtaining the program upgrade package, which may be to obtain the program upgrade package corresponding to the program upgrade request from the database of the server, or may be provided by the program developer.
  • the secondary process before the in-vehicle terminal receives the program upgrade request, the secondary process, as a backup process, has been receiving and processing data processing requests from at least one external controller.
  • the on-board terminal After the on-board terminal receives the program upgrade request and obtains the program upgrade package corresponding to the program upgrade request, the on-board terminal first closes the running sub-process through the main process, and then reads the sub-process program partition information from the shared memory through the sub-process.
  • the sub-process after reading the sub-process program partition information from the shared memory, the sub-process first deletes the data packets in the sub-process corresponding to the sub-process according to the partition information corresponding to the sub-process, and then upgrades the program. Request that the corresponding program upgrade package be updated to the partition corresponding to the secondary process. After updating the data packets of the secondary process, the secondary process is restarted, so that the secondary process continues to receive and process data processing requests from at least one external controller.
  • S250 is the process of continuing to execute the target program code with the sub-process as the new main process when the main process fails
  • S260 is that when the vehicle terminal receives the program upgrade request, the main process controls the sub-process to make the sub-process
  • the process completes the process of program upgrade, and the two processes are independent of each other.
  • This embodiment of the present application does not limit the execution order of the two procedures, and the execution order of the two procedures needs to be determined according to the actual situation. Therefore, the actual execution may be performed in the order described in the above embodiments of the present application, or may be executed first S260, and then execute S250.
  • the main process and the auxiliary process corresponding to the target program code are determined according to the process number corresponding to the target program code; the main process identifier and the partition information corresponding to the main process are written into the shared memory through the main process.
  • the main process runs normally, and the sub-process is upgraded, which can solve the problem of the screen and meter stuck caused by the online upgrade of the program of the process in the related art, so that the program can be Online upgrade will not affect the normal operation of the system.
  • FIG. 3A is a schematic diagram of a third process flow of a method for process succession provided by an embodiment of the present application
  • FIG. 3B is a schematic schematic diagram of a scheme of a process replacement method provided by the third embodiment of the present application.
  • the embodiment of the present application is refined on the basis of the above-mentioned embodiment, and a detailed explanation of the process of upgrading both processes is added.
  • the method of this embodiment includes but is not limited to the following steps:
  • S310 Determine the main process and the sub-process corresponding to the target program code according to the process number corresponding to the target program code.
  • S320 Receive a data processing request sent by at least one external controller corresponding to the target program code through the main process and the sub-process.
  • the update status data includes: upgrade information of the main process and upgrade information of the sub-process.
  • the main process writes update status data into the shared memory, which is used to identify the upgrade status of the two processes.
  • the update status data is 0xAA, it means that the upgrade information of the secondary process has been upgraded, and the upgrade information of the main process is not upgraded; the update status data of 0x55 means that the upgrade information of the secondary process has been upgraded, The upgrade information of the main process is upgraded.
  • the new main process reads the update status data in the shared memory to learn the upgrade status of the new main process and the new sub-process.
  • the read update status data is 0x55, it indicates that both the new main process and the new secondary process have been upgraded, and there is no need to perform an upgrade operation on them; if the read update status data is 0xAA indicates that the new main process has been upgraded as a sub-process before the failure occurs, and the upgrade information of the new sub-process is not upgraded. The reason is: when the main process fails, the main process is regarded as the new sub-process, and the sub-process is regarded as the new main process, and the upgrade information of the new main process is upgraded.
  • the new main process is used to control the new sub process, so that the new sub process
  • the process performs a program upgrade.
  • the process of program upgrade has been explained in detail in S260 in the above embodiment, and will not be introduced here.
  • S310-S330 is the process in which the main process runs normally;
  • S340-S350 is the process in which the main process controls the sub-process when the in-vehicle terminal receives a program upgrade request, so that the sub-process completes the program upgrade process;
  • S360 is the process in which the main process occurs When the fault occurs, the secondary process is used as the new main process to continue the process of executing the target program code;
  • S370-S380 is that after the main process fails, the new main process controls the new secondary process, so that the new secondary process can complete the program upgrade. process.
  • the two processes S340-S350 and S360 are independent of each other, the embodiment of this application does not limit the execution order of the two processes, and the execution order of the two processes needs to be determined according to the actual situation, so the actual execution can be
  • the execution is performed according to the sequence described in the foregoing embodiments of the present application, or S360 may be executed first, and then S340-S350 may be executed.
  • S370-S380 is a step after S340-S350 and S360.
  • the main process when the main process is running normally, it receives a data processing request sent by at least one external controller (data processing requester) and responds to its process, performs functional operation, and then returns the data processing result obtained by the operation to the process.
  • Data Processing Requester The secondary process, as a backup process, receives a data processing request from at least one external controller, and performs functional operation without returning the data processing result obtained by the operation to the data processing requester.
  • the main process writes the cyclic incremental data to the shared memory, and the secondary process reads the cyclic incremental data written by the main process in the shared memory from the shared memory to monitor whether the main process fails.
  • the main process and the sub-process respectively write the corresponding relationship between their respective process identifiers and the partition information of the process into the shared memory, so that when the program is upgraded subsequently, the partition information corresponding to the sub-process is read from the shared memory, and the corresponding partition information of the sub-process is read from the shared memory.
  • the secondary process is updated. After the secondary process is upgraded, the main process writes update status data into the shared memory, which is used to identify the upgrade status of the two processes.
  • the main process and the sub-process corresponding to the target program code are determined according to the process number corresponding to the target program code; the data sent by at least one external controller corresponding to the target program code is received through the main process and the sub-process.
  • the process writes updated status data into the shared memory; if it is detected that the main process fails, the sub-process returns the data processing result corresponding to the data processing request to at least one external controller; the main process is used as a new sub-process, and the sub-process is used as a new sub-process.
  • the new main process read the updated status data in the shared memory through the new main process; if the upgrade information of the new main process is upgraded, and the upgrade information of the new secondary process is not upgraded, the new The main process controls the new sub-process, so that the new sub-process can upgrade the program.
  • the new main process controls the new sub-process to upgrade the program of the new sub-process, so that both processes complete the program upgrade.
  • the present application can solve the problem that the screen meter is stuck due to the online upgrade of the program of the process in the related art, so that the online upgrade of the program will not affect the normal operation of the system.
  • FIG. 4 is a schematic structural diagram of an apparatus for process succession provided by an embodiment of the present application. As shown in FIG. 4 , the apparatus 400 may include:
  • the process determination module 410 is configured to determine the main process and the auxiliary process corresponding to the target program code according to the process number corresponding to the target program code;
  • the request receiving module 420 is configured to receive, through the main process and the secondary process, a data processing request sent by at least one external controller corresponding to the target program code;
  • the request processing module 430 is configured to return the data processing result corresponding to the data processing request to the at least one external controller through the main process;
  • the process exchange module 440 is configured to return the data processing result corresponding to the data processing request to the at least one external controller through the secondary process if a failure of the main process is detected; the main process is used as a new A secondary process, using the secondary process as a new main process.
  • the detecting a failure of the main process includes: writing cyclic incremental data into the shared memory according to a predetermined time interval by the main process; reading the data according to the predetermined time interval by the secondary process.
  • the cyclic incremental data written by the main process in the shared memory if it is detected that the secondary process has not read the cyclic incremental data written in the shared memory by the main process for a preset number of consecutive times , it is determined that the main process is faulty.
  • the above-mentioned process replacement device may further include: a partition information writing module 450 (not shown in the figure);
  • the partition information writing module 450 is configured to write the main process identifier and partition information corresponding to the main process into the shared memory through the main process;
  • the partition information corresponding to the secondary process is written into the shared memory; or, the new main process identifier and the partition information corresponding to the new main process are written into the shared memory through the new main process in; writing the new sub-process identifier and the partition information corresponding to the new sub-process into the shared memory through the new sub-process.
  • the above-mentioned apparatus for process replacement may further include: a program upgrade module 460 (not shown in the figure);
  • the program upgrade module 460 is configured to control the sub-process through the main process if a program upgrade request sent by the user is received, so that the sub-process performs program upgrade.
  • the above-mentioned apparatus for taking over the process may further include: a status data writing module 470 (not shown in the figure);
  • the status data writing module 470 is configured to write update status data into the shared memory through the main process; wherein the update status data includes: the upgrade information of the main process and the update status of the secondary process. Upgrade information.
  • the above-mentioned program upgrade module 460 is configured to: in response to the program upgrade request, obtain a program upgrade package corresponding to the program upgrade request; read the corresponding program upgrade package from the shared memory through the auxiliary process. the partition information; according to the partition information corresponding to the auxiliary process, replace the data package in the partition corresponding to the auxiliary process with the program upgrade package corresponding to the program upgrade request.
  • the above program upgrade module 460 is configured to: after the detection of the failure of the main process, read the update status data in the shared memory through the new main process; if the The upgrade information of the new main process is that it has been upgraded, and the upgrade information of the new sub-process is that it has not been upgraded, then the new sub-process is controlled by the new main process, so that the new sub-process The process performs a program upgrade.
  • the apparatus for taking over a process provided in this embodiment may be applicable to the method for taking over a process provided in any of the foregoing embodiments, and has corresponding functions.
  • FIG. 5 is a block diagram of an electronic device used to implement the method for process succession of the embodiment of the present application
  • FIG. 5 shows a block diagram of an exemplary electronic device suitable for implementing the implementation of the embodiment of the present application.
  • the electronic device shown in FIG. 5 is only an example, and should not impose any limitations on the functions and scope of use of the embodiments of the present application.
  • the electronic device can typically be a smartphone, a tablet computer, a notebook computer, a vehicle-mounted terminal, a wearable device, and the like.
  • electronic device 500 takes the form of a general-purpose computing device.
  • Components of electronic device 500 may include, but are not limited to, at least one processor or processing unit 516 , memory 528 , and bus 518 connecting various system components including memory 528 and processing unit 516 .
  • Bus 518 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of a variety of bus structures.
  • these architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, enhanced ISA bus, Video Electronics Standards Association (Video Electronics Standards Association) Standards Association, VESA) local bus and Peripheral Component Interconnect (PCI) bus.
  • Electronic device 500 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by electronic device 500, including volatile and non-volatile media, removable and non-removable media.
  • Memory 528 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 530 and/or cache memory 532 .
  • Electronic device 500 may include other removable/non-removable, volatile/non-volatile computer system storage media.
  • storage system 534 may be configured to read and write to non-removable, non-volatile magnetic media (not shown in FIG. 5, commonly referred to as a "hard drive”).
  • disk drives may be provided for reading and writing to removable non-volatile magnetic disks (eg, "floppy disks"), as well as removable non-volatile optical disks (eg, compact disk read-only memories).
  • each drive may be connected to bus 518 through at least one data media interface.
  • the memory 528 may include at least one program product having a set of (eg, at least one) program modules configured to perform the functions of the embodiments of the present application.
  • a program/utility 540 having a set (at least one) of program modules 542, which may be stored, for example, in memory 528, such program modules 542 including, but not limited to, an operating system, at least one application program, other program modules, and program data, which An implementation of a network environment may be included in each or some combination of the examples.
  • the program module 542 generally executes the functions and/or methods in the embodiments described in the embodiments of this application.
  • the electronic device 500 may also communicate with at least one external device 514 (eg, keyboard, pointing device, display 524, etc.), may also communicate with at least one device that enables a user to interact with the electronic device 500, and/or communicate with the electronic device 500 can communicate with any device (eg, network card, modem, etc.) that communicates with at least one other computing device. Such communication may take place through an input/output (I/O) interface 522 . And, the electronic device 500 can also communicate with at least one network (such as a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet) through the network adapter 520. As shown in FIG.
  • LAN Local Area Network
  • WAN Wide Area Network
  • public network such as the Internet
  • network adapter 520 communicates with other modules of electronic device 500 via bus 518 .
  • other hardware and/or software modules may be used in conjunction with electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (Redundant Arrays of Independent Disks, RAID) systems, tape drives, and data backup storage systems, etc.
  • the processing unit 516 executes various functional applications and data processing by running the programs stored in the memory 528, for example, implementing the method for process succession provided by any embodiment of the present application.
  • the sixth embodiment of the present application further provides a computer-readable storage medium, on which a computer program (or referred to as a computer-executable instruction) is stored. Provides a method for process succession.
  • the computer storage medium of the embodiments of the present application may adopt any combination of at least one computer-readable medium.
  • the computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium.
  • the computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or a combination of any of the above.
  • a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a propagated data signal in baseband or as part of a carrier wave, with computer-readable program code embodied thereon. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device .
  • Program code embodied on a computer readable medium may be transmitted using any suitable medium, including but not limited to wireless, wire, optical fiber cable, radio frequency (RF), etc., or any suitable combination of the foregoing.
  • RF radio frequency
  • Computer program code for performing the operations of the embodiments of the present application may be written in at least one programming language, including object-oriented programming languages—such as Java, Smalltalk, C++, but also conventional Procedural programming language - such as the "C" language or similar programming language.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server.
  • the remote computer may be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (eg, using an Internet service provider through Internet connection).
  • LAN local area network
  • WAN wide area network

Landscapes

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

Abstract

一种进程接替的方法、装置、电子设备及存储介质。其中,该方法包括:根据目标程序代码所对应的进程号,确定目标程序代码对应的主进程和副进程(S110);通过主进程和副进程接收目标程序代码对应的至少一个外部控制器发送的数据处理请求(S120);通过主进程向至少一个外部控制器返回数据处理请求对应的数据处理结果(S130);响应于检测到主进程发生故障,通过副进程向至少一个外部控制器返回数据处理请求对应的数据处理结果;将主进程作为新的副进程,将副进程作为新的主进程(S140)。

Description

进程接替的方法、装置、电子设备及存储介质
本申请要求在2021年4月8日提交中国专利局、申请号为202110378335.7的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及数据处理技术领域,例如涉及一种进程接替的方法、装置、电子设备及存储介质。
背景技术
近年来,由于LINUX、QNX等操作系统在汽车行业的应用,使得汽车行业的智能化和网联化趋势越来越明显,用户更加注重车辆的安全性和车辆使用体验感受。通过车载终端的屏幕仪表,用户可以直观感受到车载控制器的功能。当车载控制器的程序在运行时出现问题或在线升级时,车载终端的屏幕仪表就会出现闪烁黑屏或者卡顿等现象,会对用户体验造成不良的影响。
相关技术中,主要采用的方法为通过主进程为子进程创建一个影子进程作为备份,当子进程发生故障时,主进程唤醒影子进程接替发生故障的子进程继续执行程序。然而,影子进程在接替流程中需要先执行初始化程序,并不能快速地接替子进程继续执行程序,从而导致车载终端的屏幕仪表出现卡顿现象,影响用户的体验感。因此,亟需一种进程接替的方法,能够解决程序在进程运行时出现故障时车载终端的屏幕仪表出现卡顿等问题。
发明内容
本申请实施例提供了一种进程接替的方法、装置、电子设备及存储介质,可以保证向外部控制器发送数据的连续性,不会影响用户体验。
第一方面,本申请实施例提供了一种进程接替的方法,该方法包括:
根据目标程序代码所对应的进程号,确定所述目标程序代码对应的主进程 和副进程;
通过所述主进程和所述副进程接收所述目标程序代码对应的至少一个外部控制器发送的数据处理请求;
通过所述主进程向所述至少一个外部控制器返回所述数据处理请求对应的数据处理结果;
响应于检测到所述主进程发生故障,通过所述副进程向所述至少一个外部控制器返回所述数据处理请求对应的数据处理结果;将所述主进程作为新的副进程,将所述副进程作为新的主进程。
第二方面,本申请实施例提供了一种进程接替的装置,该装置包括:
进程确定模块,设置为根据目标程序代码所对应的进程号,确定所述目标程序代码对应的主进程和副进程;
请求接收模块,设置为通过所述主进程和所述副进程接收所述目标程序代码对应的至少一个外部控制器发送的数据处理请求;
请求处理模块,设置为通过所述主进程向所述至少一个外部控制器返回所述数据处理请求对应的数据处理结果;
进程交换模块,设置为响应于检测到所述主进程发生故障,通过所述副进程向所述至少一个外部控制器返回所述数据处理请求对应的数据处理结果;将所述主进程作为新的副进程,将所述副进程作为新的主进程。
第三方面,本申请实施例提供了一种电子设备,该电子设备包括:
至少一个处理器;
存储装置,设置为存储至少一个程序;
当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现本申请任意实施例所述的进程接替的方法。
第四方面,本申请实施例提供了一种计算机可读存储介质,其上存储有计算机程序,其中,该程序被处理器执行时实现本申请任意实施例所述的进程接替的方法。
附图说明
图1为本申请实施例提供的进程接替的方法的第一流程示意图;
图2为本申请实施例提供的进程接替的方法的第二流程示意图;
图3A为本申请实施例提供的进程接替的方法的第三流程示意图;
图3B为本申请实施例提供的进程接替的方法的方案示意图
图4为本申请实施例提供的进程接替的装置的结构示意图;
图5是用来实现本申请实施例的进程接替的方法的电子设备的框图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。
实施例一
图1为本申请实施例提供的进程接替的方法的第一流程示意图,本实施例可适用于当主进程出现故障时,副进程接替主进程执行程序的情况。本实施例提供的一种进程接替的方法可以由本申请实施例提供的进程接替的装置来执行,该装置可以通过软件和/或硬件的方式实现,并集成在执行本方法的电子设备中。可选的,执行本方法的电子设备可以是车载终端。
需要说明的是,本申请应用的操作系统,既可以为可靠性高的通信软件系统(嵌入式系统),也可以为互联网软件系统,例如Linux操作系统、Android操作系统、Windows操作系统等,此处不作限定,该操作系统可以运行于通信设备的用户业务处理单板,主控单板,也可以运行于互联网功能服务器等,此处不作限定。
参见图1,本实施例的方法包括但不限于如下步骤:
S110、根据目标程序代码所对应的进程号,确定目标程序代码对应的主进程和副进程。
其中,目标程序代码是指在进程中运行的程序代码,进程号是指操作系统中用于标识唯一进程的数值。
在本申请实施例中,将目标程序代码放置在两个位于不同分区的进程中,操作系统上电之后,便开启了两个进程。也就是,两个进程是位于不同分区,但执行相同的程序代码。两个进程中任意一个进程获取自身以及对方的进程号,并对所获取的两个进程号进行比较。按照进程号的大小将两个进程分为主进程和副进程,例如,将两个进程中的进程号小的作为主进程,将两个进程中的进程号大的作为副进程。
S120、通过主进程和副进程接收目标程序代码对应的至少一个外部控制器发送的数据处理请求。
其中,外部控制器是指与操作系统进行通信交互的控制器,外部控制器的数量为1-N,N为大于1的自然数。
在本申请实施例中,主进程正常运行目标程序代码,接收至少一个外部控制器发送的数据处理请求,并响应数据处理请求。副进程作为备份进程,同时也接收至少一个外部控制器发送的数据处理请求,并响应数据处理请求。也就是,在接收外部控制器的数据处理请求方面,主进程和副进程两者是同步一致的。
S130、通过主进程向至少一个外部控制器返回数据处理请求对应的数据处理结果。
在本申请实施例中,当主进程接收到至少一个外部控制器(数据处理请求方)发送的数据处理请求对其进行响应,进行功能运算,再将运算所得的数据处理结果返回给数据处理请求方。也就是,主进程与至少一个外部控制器进行交互。在主进程正常运行的过程中,而副进程作为备份进程,仅仅接收至少一个外部控制器的数据处理请求,并进行功能运算,而不将运算所得的数据处理结果返回给数据处理请求方。
S140、若检测到主进程发生故障,通过副进程向至少一个外部控制器返回 数据处理请求对应的数据处理结果;将主进程作为新的副进程,将副进程作为新的主进程。
在本申请实施例中,若检测到主进程发生故障,则由副进程接替主进程继续执行目标程序代码,即,将副进程作为新的主进程,对主进程进行检修之后作为新的副进程。当下一次主进程发生故障,再将主进程和副进程进行交换,由副进程接替主进程继续执行目标程序代码,重复循环。
在本申请实施例中,由于在主进程正常运行的过程中,副进程与主进程同步一致地在接收并处理至少一个外部控制器的数据处理请求,所以当主进程发生故障时,可以通过副进程向至少一个外部控制器返回数据处理请求对应的数据处理结果,由副进程作为新的主进程与至少一个外部控制器进行交互。这样设置的好处在于,主进程和副进程可以快速得切换,可以保证向外部控制器发送数据的连续性。在主进程发生故障时,由副进程继续执行目标程序代码,不会影响目标程序代码的执行,因而车载的屏幕仪表不会出现卡顿现象,不会影响用户体验。
可选的,主进程的故障检测过程为:通过主进程按照预定时间间隔向共享内存中写入循环递加数据;通过副进程按照预定时间间隔读取主进程在共享内存中写入的循环递加数据;若副进程连续预设次数未读取到主进程在共享内存中写入的循环递加数据,则判定主进程发生故障。若副进程能够正常读取主进程在共享内存中写入的循环递加数据,表明主进程未发生故障,则副进程仍作为备份进程。
在本申请实施例中,在主进程正常运行的过程中,主进程按照预定时间间隔向共享内存中写入循环递加数据;当主进程出现故障时,主进程不会向共享内存中写入循环递加数据。副进程按照预定时间间隔读取主进程在共享内存中写入的循环递加数据,用于监测主进程是否出现故障;其中,预定时间间隔可以是用户根据实际情况设定,如2毫秒,也可以在电子设备出厂时设置;循环递加数据可以是0-M的整数,M为大于0的自然数。若副进程连续预设次数未 读取到主进程在共享内存中写入的循环递加数据,表明主进程发生故障,则副进程作为新的主进程,接替主进程继续执行目标程序代码;其中,预设次数可以是用户根据实际情况设定,如三次。
本实施例提供的技术方案,根据目标程序代码所对应的进程号,确定目标程序代码对应的主进程和副进程;通过主进程和副进程接收目标程序代码对应的至少一个外部控制器发送的数据处理请求;通过主进程向至少一个外部控制器返回数据处理请求对应的数据处理结果;若检测到主进程发生故障,通过副进程向至少一个外部控制器返回数据处理请求对应的数据处理结果;将主进程作为新的副进程,将副进程作为新的主进程。本申请通过设置主进程和副进程,在主进程正常运行时,副进程接收并处理至少一个外部控制器的数据处理请求,当主进程发生故障时,副进程接替主进程向至少一个外部控制器返回数据处理结果。本申请可以解决相关技术中由于进程接替所导致的车载的屏幕仪表出现卡顿的问题,可以实现主进程与副进程之间快速得切换,可以保证向外部控制器发送数据的连续性,不会影响用户体验。
实施例二
图2为本申请实施例提供的进程接替的方法的第二流程示意图。本申请实施例是在上述实施例的基础上进行细化,增加了对将分区信息写入至共享内存的过程和对程序进行升级的过程进行详细的解释说明。
参见图2,本实施例的方法包括但不限于如下步骤:
S210、根据目标程序代码所对应的进程号,确定目标程序代码对应的主进程和副进程。
S220、通过主进程将主进程标识和主进程对应的分区信息写入至共享内存中;通过副进程将副进程标识和副进程对应的分区信息写入至共享内存中。
在本申请实施例中,在确定了目标程序代码对应的主进程和副进程之后,需要主进程和副进程将各自所对应的分区信息写入至共享内存中。由于若主进 程发生故障时,主进程和副进程会互相交换,也就是,主进程会作为新的副进程,副进程会作为新的主进程,所以也需要将进程标识写进共享内存中。因此,将进程标识与进程的分区信息之间的对应关系作为一条数据,写进共享内存中。示例性的,主进程将主进程标识和主进程对应的分区信息写入至共享内存中,副进程将副进程标识和副进程对应的分区信息写入至共享内存中。
S230、通过主进程和副进程接收目标程序代码对应的至少一个外部控制器发送的数据处理请求。
S240、通过主进程向至少一个外部控制器返回数据处理请求对应的数据处理结果。
S250、若检测到主进程发生故障,通过副进程向至少一个外部控制器返回数据处理请求对应的数据处理结果;将主进程作为新的副进程,将副进程作为新的主进程。
可选的,通过新的主进程将新的主进程标识和新的主进程对应的分区信息写入至共享内存中;通过新的副进程将新的副进程标识和新的副进程对应的分区信息写入至共享内存中。
在本申请实施例中,当主进程发生故障时,主进程会作为新的副进程,副进程会作为新的主进程。因此,共享内存中所存储的进程标识与进程的分区信息之间的对应关系会出现错误,如,新的副进程标识对应的是旧的主进程(故障发生之前的主进程)的分区信息。因此,在主进程发生故障之后,需要重新将进程标识与进程的分区信息之间的对应关系写入至共享内存中,并删除主进程发生故障之前的进程标识与进程的分区信息之间的对应关系。
S260、若接收到用户发送的程序升级请求,则通过主进程控制副进程,以使副进程进行程序升级。
在本申请实施例中,如果用户需要对目标程序代码进行升级,可以向车载终端发起程序升级请求。车载终端接收到用户发送的程序升级请求之后,响应程序升级请求。
可选的,本步骤若接收到用户发送的程序升级请求,则通过主进程控制副进程,以使副进程进行程序升级可由以下三个子步骤来实现:
S2601、响应于程序升级请求获取程序升级请求对应的程序升级包。
在本申请实施例中,用户向车载终端发起程序升级请求。车载终端接收到用户发送的程序升级请求之后,响应程序升级请求获取程序升级请求对应的程序升级包。其中,本申请对获取程序升级包的方式不做限定,可以是从服务器的数据库中获取程序升级请求对应的程序升级包,还可以是由程序开发商提供。
S2602、通过副进程从共享内存中读取副进程对应的分区信息。
在本申请实施例中,在车载终端接收到程序升级请求之前,副进程作为备份进程,一直在接收并处理至少一个外部控制器的数据处理请求。当车载终端接收到程序升级请求并获取到程序升级请求对应的程序升级包之后,车载终端先通过主进程关闭正在运行的副进程,再通过副进程从共享内存中读取副进程程序分区信息。
S2603、根据副进程对应的分区信息,将程序升级请求对应的程序升级包替换副进程对应的分区中的数据包。
在本申请实施例中,经上述步骤,副进程从共享内存中读取副进程程序分区信息之后,根据副进程对应的分区信息,先删除副进程对应的分区中的数据包,再将程序升级请求对应的程序升级包更新到副进程对应的分区中。对副进程的数据包进行更新之后,重启副进程,以使副进程继续接收并处理至少一个外部控制器的数据处理请求。
需要说明的是,S250是主进程发生故障时,由副进程作为新的主进程,继续执行目标程序代码的过程,S260是车载终端接收到程序升级请求时,主进程控制副进程,以使副进程完成程序升级的过程,这两个过程是相互独立的。本申请实施例不对这两个过程的执行顺序进行限定,需要根据实际情况来确定两个过程的执行顺序,所以实际执行时可以是按照本申请上述实施例介绍的顺序执行,也可以是先执行S260,再执行S250。
本实施例提供的技术方案,根据目标程序代码所对应的进程号,确定目标程序代码对应的主进程和副进程;通过主进程将主进程标识和主进程对应的分区信息写入至共享内存中;通过副进程将副进程标识和副进程对应的分区信息写入至共享内存中;通过主进程和副进程接收目标程序代码对应的至少一个外部控制器发送的数据处理请求;通过主进程向至少一个外部控制器返回数据处理请求对应的数据处理结果;若检测到主进程发生故障,通过副进程向至少一个外部控制器返回数据处理请求对应的数据处理结果;将主进程作为新的副进程,将副进程作为新的主进程;若接收到用户发送的程序升级请求,则通过主进程控制副进程,以使副进程进行程序升级。本申请在接收到用户发送的程序升级请求时,主进程正常运行,对副进程进行程序升级,可以解决相关技术中因进程的程序在线升级时所造成的屏幕仪表卡顿的问题,使得对程序在线升级时不会影响系统的正常运行。
实施例三
图3A为本申请实施例提供的进程接替的方法的第三流程示意图;图3B为本申请实施例三提供的一种进程接替的方法的方案示意图。本申请实施例是在上述实施例的基础上进行细化,增加了对两个进程都进行升级的过程进行详细的解释说明。
参考图3A,本实施例的方法包括但不限于如下步骤:
S310、根据目标程序代码所对应的进程号,确定目标程序代码对应的主进程和副进程。
S320、通过主进程和副进程接收目标程序代码对应的至少一个外部控制器发送的数据处理请求。
S330、通过主进程向至少一个外部控制器返回数据处理请求对应的数据处理结果。
S340、若接收到用户发送的程序升级请求,则通过主进程控制副进程,以 使副进程进行程序升级。
S350、通过主进程向共享内存中写入更新状态数据。
其中,更新状态数据包括:主进程的升级信息和副进程的升级信息。
在本申请实施例中,对副进程进行程序升级之后,主进程向共享内存中写入更新状态数据,用于标识两个进程的升级状态。示例性的,更新状态数据为0xAA表示的是副进程的升级信息为已被升级,主进程的升级信息为未被升级;更新状态数据为0x55表示的是副进程的升级信息为已被升级,主进程的升级信息为已被升级。
S360、若检测到主进程发生故障,通过副进程向至少一个外部控制器返回数据处理请求对应的数据处理结果;将主进程作为新的副进程,将副进程作为新的主进程。
S370、通过新的主进程读取共享内存中的更新状态数据。
在本申请实施例中,对故障处理结束之后,通过新的主进程读取共享内存中的更新状态数据,了解新的主进程和新的副进程的升级状态。示例性的,若所读取到的更新状态数据为0x55,则表明新的主进程和新的副进程都已被升级,无需再对其进行升级操作;若所读取到的更新状态数据为0xAA,则表明新的主进程在故障发生之前作为副进程时已经被升级,新的副进程的升级信息为未被升级。原因为:当主进程发生故障时,将主进程作为新的副进程,将副进程作为新的主进程,则新的主进程的升级信息为已被升级。
S380、若新的主进程的升级信息为已被升级,并且新的副进程的升级信息为未被升级,则通过新的主进程控制新的副进程,以使新的副进程进行程序升级。
在本申请实施例中,若新的主进程的升级信息为已被升级,并且新的副进程的升级信息为未被升级,则通过新的主进程控制新的副进程,以使新的副进程进行程序升级。程序升级的过程在上述实施例中的S260中已详细解释过,在此不做介绍。
需要说明的是,S310-S330是主进程正常运行的过程;S340-S350是车载终端接收到程序升级请求时,主进程控制副进程,以使副进程完成程序升级的过程;S360是主进程发生故障时,由副进程作为新的主进程,继续执行目标程序代码的过程;S370-S380是主进程发生故障之后,新的主进程控制新的副进程,以使新的副进程完成程序升级的过程。其中,S340-S350和S360这两个过程是相互独立的,本申请实施例不对这两个过程的执行顺序进行限定,需要根据实际情况来确定两个过程的执行顺序,所以实际执行时可以是按照本申请上述实施例介绍的顺序执行,也可以是先执行S360,再执行S340-S350。但是,S370-S380是在S340-S350和S360之后才会有的步骤。
需要说明的是,若执行了S340-S350(主进程控制副进程,以使副进程完成程序升级)之后,主进程没有发生故障(即没有发生S360),则不会发生S370-S380,那么车载终端始终使用的是未被升级的主进程在运行。当断电再重新上电之后,先执行S370(读取共享内存中的更新状态数据),然后将已被升级的进程作为新的主进程,最后执行S380(通过新的主进程控制新的副进程,以使新的副进程进行程序升级),以使两个进程都完成程序升级。
如图3B所示,主进程在正常运行时,接收到至少一个外部控制器(数据处理请求方)发送的数据处理请求对其进程响应,进行功能运算,再将运算所得的数据处理结果返回给数据处理请求方。副进程作为备份进程,接收至少一个外部控制器的数据处理请求,并进行功能运算,而不将运算所得的数据处理结果返回给数据处理请求方。主进程向共享内存中写入循环递加数据,副进程从共享内存中读取主进程在共享内存中写入的循环递加数据,用于监控主进程是否出现故障。主进程和副进程分别将各自的进程标识与进程的分区信息之间的对应关系写入至共享内存中,以使后续在程序升级时,从共享内存中读取副进程对应的分区信息,对副进程进行更新。对副进程进行程序升级之后,主进程向共享内存中写入更新状态数据,用于标识两个进程的升级状态。
本实施例提供的技术方案,根据目标程序代码所对应的进程号,确定目标 程序代码对应的主进程和副进程;通过主进程和副进程接收目标程序代码对应的至少一个外部控制器发送的数据处理请求;通过主进程向至少一个外部控制器返回数据处理请求对应的数据处理结果;若接收到用户发送的程序升级请求,则通过主进程控制副进程,以使副进程进行程序升级;通过主进程向共享内存中写入更新状态数据;若检测到主进程发生故障,通过副进程向至少一个外部控制器返回数据处理请求对应的数据处理结果;将主进程作为新的副进程,将副进程作为新的主进程;通过新的主进程读取共享内存中的更新状态数据;若新的主进程的升级信息为已被升级,并且新的副进程的升级信息为未被升级,则通过新的主进程控制新的副进程,以使新的副进程进行程序升级。本申请在上述实施例的基础上,在主进程发生故障之后,通过新的主进程控制新的副进程,对新的副进程进行程序升级,以使两个进程都完成程序升级。本申请可以解决相关技术中因进程的程序在线升级时所造成的屏幕仪表卡顿的问题,使得对程序在线升级而不会影响系统的正常运行。
实施例四
图4为本申请实施例提供的进程接替的装置的结构示意图,如图4所示,该装置400可以包括:
进程确定模块410,设置为根据目标程序代码所对应的进程号,确定所述目标程序代码对应的主进程和副进程;
请求接收模块420,设置为通过所述主进程和所述副进程接收所述目标程序代码对应的至少一个外部控制器发送的数据处理请求;
请求处理模块430,设置为通过所述主进程向所述至少一个外部控制器返回所述数据处理请求对应的数据处理结果;
进程交换模块440,设置为若检测到所述主进程发生故障,通过所述副进程向所述至少一个外部控制器返回所述数据处理请求对应的数据处理结果;将所述主进程作为新的副进程,将所述副进程作为新的主进程。
可选的,所述检测到所述主进程发生故障,包括:通过所述主进程按照预定时间间隔向共享内存中写入循环递加数据;通过所述副进程按照所述预定时间间隔读取所述主进程在所述共享内存中写入的循环递加数据;若检测到所述副进程连续预设次数未读取到所述主进程在所述共享内存中写入的循环递加数据,则判定所述主进程发生故障。
可选的上述进程接替的装置,还可以包括:分区信息写入模块450(图中未示出);
所述分区信息写入模块450,设置为通过所述主进程将主进程标识和所述主进程对应的分区信息写入至所述共享内存中;通过所述副进程将副进程标识和所述副进程对应的分区信息写入至所述共享内存中;或者,通过所述新的主进程将所述新的主进程标识和所述新的主进程对应的分区信息写入至所述共享内存中;通过所述新的副进程将所述新的副进程标识和所述新的副进程对应的分区信息写入至所述共享内存中。
可选的,上述进程接替的装置,还可以包括:程序升级模块460(图中未示出);
所述程序升级模块460,设置为若接收到用户发送的程序升级请求,则通过所述主进程控制所述副进程,以使所述副进程进行程序升级。
可选的,上述进程接替的装置,还可以包括:状态数据写入模块470(图中未示出);
所述状态数据写入模块470,设置为通过所述主进程向所述共享内存中写入更新状态数据;其中,所述更新状态数据包括:所述主进程的升级信息和所述副进程的升级信息。
可选的,上述程序升级模块460,设置为:响应于所述程序升级请求获取所述程序升级请求对应的程序升级包;通过所述副进程从所述共享内存中读取所述副进程对应的分区信息;根据所述副进程对应的分区信息,将所述程序升级请求对应的程序升级包替换所述副进程对应的分区中的数据包。
可选的,上述程序升级模块460,设置为:在所述检测到所述主进程发生故障之后,通过所述新的主进程读取所述共享内存中的所述更新状态数据;若所述新的主进程的升级信息为已被升级,并且所述新的副进程的升级信息为未被升级,则通过所述新的主进程控制所述新的副进程,以使所述新的副进程进行程序升级。
本实施例提供的进程接替的装置可适用于上述任意实施例提供的进程接替的方法,具备相应的功能。
实施例五
图5是用来实现本申请实施例的进程接替的方法的电子设备的框图,图5示出了适于用来实现本申请实施例实施方式的示例性电子设备的框图。图5显示的电子设备仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。该电子设备典型可以是智能手机、平板电脑、笔记本电脑、车载终端以及可穿戴设备等。
如图5所示,电子设备500以通用计算设备的形式表现。电子设备500的组件可以包括但不限于:至少一个处理器或者处理单元516,存储器528,连接不同系统组件(包括存储器528和处理单元516)的总线518。
总线518表示几类总线结构中的一种或多种,包括存储器总线或者存储器控制器,外围总线,图形加速端口,处理器或者使用多种总线结构中的任意总线结构的局域总线。举例来说,这些体系结构包括但不限于工业标准体系结构(Industry Standard Architecture,ISA)总线,微通道体系结构((Micro Channel Architecture,MCA)总线,增强型ISA总线、视频电子标准协会(Video Electronics Standards Association,VESA)局域总线以及外围组件互连(Peripheral Component Interconnect,PCI)总线。
电子设备500典型地包括多种计算机系统可读介质。这些介质可以是任何能够被电子设备500访问的可用介质,包括易失性和非易失性介质,可移动的 和不可移动的介质。
存储器528可以包括易失性存储器形式的计算机系统可读介质,例如随机存取存储器(Random Access Memory,RAM)530和/或高速缓存存储器532。电子设备500可以包括其它可移动/不可移动的、易失性/非易失性计算机系统存储介质。仅作为举例,存储系统534可以设置为读写不可移动的、非易失性磁介质(图5未显示,通常称为“硬盘驱动器”)。尽管图5中未示出,可以提供用于对可移动非易失性磁盘(例如“软盘”)读写的磁盘驱动器,以及对可移动非易失性光盘(例如紧凑型磁盘只读存储器(Compact Disc-Read Only Memory,CD-ROM),数字视盘(Digital Video Disc-Read Only Memory,DVD-ROM)或者其它光介质)读写的光盘驱动器。在这些情况下,每个驱动器可以通过至少一个数据介质接口与总线518相连。存储器528可以包括至少一个程序产品,该程序产品具有一组(例如至少一个)程序模块,这些程序模块被配置以执行本申请实施例各实施例的功能。
具有一组(至少一个)程序模块542的程序/实用工具540,可以存储在例如存储器528中,这样的程序模块542包括但不限于操作系统、至少一个应用程序、其它程序模块以及程序数据,这些示例中的每一个或某种组合中可能包括网络环境的实现。程序模块542通常执行本申请实施例所描述的实施例中的功能和/或方法。
电子设备500也可以与至少一个外部设备514(例如键盘、指向设备、显示器524等)通信,还可与至少一个使得用户能与该电子设备500交互的设备通信,和/或与使得该电子设备500能与至少一个其它计算设备进行通信的任何设备(例如网卡,调制解调器等等)通信。这种通信可以通过输入/输出(Input/Output,I/O)接口522进行。并且,电子设备500还可以通过网络适配器520与至少一个网络(例如局域网(Local Area Network,LAN),广域网(Wide Area Network,WAN)和/或公共网络,例如因特网)通信。如图5所示,网络适配器520通过总线518与电子设备500的其它模块通信。应当明白,尽管图5中未示出,可 以结合电子设备500使用其它硬件和/或软件模块,包括但不限于:微代码、设备驱动器、冗余处理单元、外部磁盘驱动阵列、磁盘阵列(Redundant Arrays of Independent Disks,RAID)系统、磁带驱动器以及数据备份存储系统等。
处理单元516通过运行存储在存储器528中的程序,从而执行各种功能应用以及数据处理,例如实现本申请任一实施例所提供的进程接替的方法。
实施例六
本申请实施例六还提供一种计算机可读存储介质,其上存储有计算机程序(或称为计算机可执行指令),该程序被处理器执行时可以用于执行本申请上述任一实施例所提供的进程接替的方法。
本申请实施例的计算机存储介质,可以采用至少一个计算机可读的介质的任意组合。计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:具有至少一个导线的电连接、便携式计算机磁盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器((Erasable Programmable Read-Only Memory,EPROM)或闪存)、光纤、便携式紧凑型磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本文件中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。
计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用 或者与其结合使用的程序。
计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括——但不限于无线、电线、光缆、射频(Radio Frequency,RF)等等,或者上述的任意合适的组合。
可以以至少一种程序设计语言或其组合来编写用于执行本申请实施例操作的计算机程序代码,所述程序设计语言包括面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。

Claims (10)

  1. 一种进程接替的方法,包括:
    根据目标程序代码所对应的进程号,确定所述目标程序代码对应的主进程和副进程;
    通过所述主进程和所述副进程接收所述目标程序代码对应的至少一个外部控制器发送的数据处理请求;
    通过所述主进程向所述至少一个外部控制器返回所述数据处理请求对应的数据处理结果;
    响应于检测到所述主进程发生故障,通过所述副进程向所述至少一个外部控制器返回所述数据处理请求对应的数据处理结果;将所述主进程作为新的副进程,将所述副进程作为新的主进程。
  2. 根据权利要求1所述的方法,其中,所述检测到所述主进程发生故障,包括:
    通过所述主进程按照预定时间间隔向共享内存中写入循环递加数据;
    通过所述副进程按照所述预定时间间隔读取所述主进程在所述共享内存中写入的循环递加数据;
    响应于检测到所述副进程连续预设次数未读取到所述主进程在所述共享内存中写入的循环递加数据,判定所述主进程发生故障。
  3. 根据权利要求2所述的方法,还包括:
    通过所述主进程将主进程标识和所述主进程对应的分区信息写入至所述共享内存中;通过所述副进程将副进程标识和所述副进程对应的分区信息写入至所述共享内存中;
    或者,通过所述新的主进程将所述新的主进程标识和所述新的主进程对应的分区信息写入至所述共享内存中;通过所述新的副进程将所述新的副进程标识和所述新的副进程对应的分区信息写入至所述共享内存中。
  4. 根据权利要求1所述的方法,还包括:
    响应于接收到用户发送的程序升级请求,通过所述主进程控制所述副进程, 以使所述副进程进行程序升级。
  5. 根据权利要求4所述的方法,还包括:
    通过所述主进程向所述共享内存中写入更新状态数据;其中,所述更新状态数据包括:所述主进程的升级信息和所述副进程的升级信息。
  6. 根据权利要求4所述的方法,其中,所述通过所述主进程控制所述副进程,以使所述副进程进行程序升级,包括:
    响应于所述程序升级请求获取所述程序升级请求对应的程序升级包;
    通过所述副进程从所述共享内存中读取所述副进程对应的分区信息;
    根据所述副进程对应的分区信息,将所述程序升级请求对应的程序升级包替换所述副进程对应的分区中的数据包。
  7. 根据权利要求5所述的方法,在所述检测到所述主进程发生故障之后,所述方法还包括:
    通过所述新的主进程读取所述共享内存中的所述更新状态数据;
    响应于所述新的主进程的升级信息为已被升级,并且所述新的副进程的升级信息为未被升级,通过所述新的主进程控制所述新的副进程,以使所述新的副进程进行程序升级。
  8. 一种进程接替的装置,包括:
    进程确定模块,设置为根据目标程序代码所对应的进程号,确定所述目标程序代码对应的主进程和副进程;
    请求接收模块,设置为通过所述主进程和所述副进程接收所述目标程序代码对应的至少一个外部控制器发送的数据处理请求;
    请求处理模块,设置为通过所述主进程向所述至少一个外部控制器返回所述数据处理请求对应的数据处理结果;
    进程交换模块,设置为响应于检测到所述主进程发生故障,通过所述副进程向所述至少一个外部控制器返回所述数据处理请求对应的数据处理结果;将所述主进程作为新的副进程,将所述副进程作为新的主进程。
  9. 一种电子设备,包括:
    至少一个处理器;
    存储装置,设置为存储至少一个程序;
    当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如权利要求1-7中任一项所述的进程接替的方法。
  10. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1-7中任一项所述的进程接替的方法。
PCT/CN2021/136055 2021-04-08 2021-12-07 进程接替的方法、装置、电子设备及存储介质 WO2022213641A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110378335.7 2021-04-08
CN202110378335.7A CN113064748B (zh) 2021-04-08 2021-04-08 进程接替的方法、装置、电子设备及存储介质

Publications (1)

Publication Number Publication Date
WO2022213641A1 true WO2022213641A1 (zh) 2022-10-13

Family

ID=76566300

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/136055 WO2022213641A1 (zh) 2021-04-08 2021-12-07 进程接替的方法、装置、电子设备及存储介质

Country Status (2)

Country Link
CN (1) CN113064748B (zh)
WO (1) WO2022213641A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116820527A (zh) * 2023-08-31 2023-09-29 腾讯科技(深圳)有限公司 程序升级方法、装置、计算机设备和存储介质

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113064748B (zh) * 2021-04-08 2023-02-28 中国第一汽车股份有限公司 进程接替的方法、装置、电子设备及存储介质
CN114740825A (zh) * 2022-04-13 2022-07-12 中国第一汽车股份有限公司 数据测量标定方法、装置、车用控制器、车辆及介质
CN114860347A (zh) * 2022-05-27 2022-08-05 上海联影医疗科技股份有限公司 一种孪生进程重启方法、设备、医疗系统及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050149942A1 (en) * 2000-01-14 2005-07-07 Microsoft Corporation Cross-process common system resource data sharing
CN106462455A (zh) * 2015-06-16 2017-02-22 华为技术有限公司 进程接替的方法和装置
CN109324977A (zh) * 2018-10-31 2019-02-12 北京微播视界科技有限公司 应用程序卡顿的检测方法、装置及电子设备
CN111813550A (zh) * 2020-07-08 2020-10-23 深圳市腾讯网域计算机网络有限公司 数据处理方法、装置、服务器和存储介质
CN113064748A (zh) * 2021-04-08 2021-07-02 中国第一汽车股份有限公司 进程接替的方法、装置、电子设备及存储介质

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH07306794A (ja) * 1994-05-12 1995-11-21 Mitsubishi Electric Corp 分散システム及び分散システムの高信頼化方法
CN104850456A (zh) * 2015-05-27 2015-08-19 苏州科达科技股份有限公司 多进程解码方法和系统
CN105138409B (zh) * 2015-08-25 2019-03-05 西南交通大学 基于多进程的铁路列车运行图编制系统及方法
CN107729178A (zh) * 2017-09-28 2018-02-23 郑州云海信息技术有限公司 一种元数据服务进程接替方法及装置
CN110071880B (zh) * 2018-01-24 2021-06-18 北京金山云网络技术有限公司 报文转发方法、转发装置、服务器及存储介质
CN111988150B (zh) * 2020-09-03 2023-04-18 深圳壹账通智能科技有限公司 区块链证书更新方法、装置、计算机设备及存储介质
CN112346925A (zh) * 2020-09-25 2021-02-09 南京恩瑞特实业有限公司 一种进程级双机热备冗余系统及方法
CN112286656B (zh) * 2020-10-21 2023-08-29 百度在线网络技术(北京)有限公司 小程序模拟方法、装置、电子设备和计算机可读存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050149942A1 (en) * 2000-01-14 2005-07-07 Microsoft Corporation Cross-process common system resource data sharing
CN106462455A (zh) * 2015-06-16 2017-02-22 华为技术有限公司 进程接替的方法和装置
CN109324977A (zh) * 2018-10-31 2019-02-12 北京微播视界科技有限公司 应用程序卡顿的检测方法、装置及电子设备
CN111813550A (zh) * 2020-07-08 2020-10-23 深圳市腾讯网域计算机网络有限公司 数据处理方法、装置、服务器和存储介质
CN113064748A (zh) * 2021-04-08 2021-07-02 中国第一汽车股份有限公司 进程接替的方法、装置、电子设备及存储介质

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116820527A (zh) * 2023-08-31 2023-09-29 腾讯科技(深圳)有限公司 程序升级方法、装置、计算机设备和存储介质
CN116820527B (zh) * 2023-08-31 2024-01-02 腾讯科技(深圳)有限公司 程序升级方法、装置、计算机设备和存储介质

Also Published As

Publication number Publication date
CN113064748A (zh) 2021-07-02
CN113064748B (zh) 2023-02-28

Similar Documents

Publication Publication Date Title
WO2022213641A1 (zh) 进程接替的方法、装置、电子设备及存储介质
CN108958787B (zh) 区块链系统升级方法、装置、设备及存储介质
US20170046152A1 (en) Firmware update
US20110179211A1 (en) Bios architecture
US20110307639A1 (en) Virtual serial port management system and method
CN110908682B (zh) 一种车辆控制器的固件升级方法、系统、车辆和存储介质
US20060224723A1 (en) Data updating system and method
WO2021098485A1 (zh) PCIe设备的上下电控制方法以及系统
CN107168829B (zh) 一种确保服务器系统双bios安全可信运行的方法及系统
JP2013530441A (ja) 記憶ボリュームのディスマウント
CN110597229A (zh) 一种车辆诊断互斥方法、装置、车辆和存储介质
CN108964977B (zh) 节点异常处理方法及系统,存储介质和电子设备
CN111694684A (zh) 存储设备的异常构造方法、装置、电子设备及存储介质
CN111198832B (zh) 一种处理方法和电子设备
CN112713964A (zh) 数据校验加速方法、装置、计算机设备及存储介质
US8738816B2 (en) Management of detected devices coupled to a host machine
CN116300780B (zh) 零部件配置方法、装置、电子设备及存储介质
CN113660123B (zh) 虚拟交换机升级方法、装置、电子设备以及存储介质
CN114036218A (zh) 一种数据模型切换方法、装置、服务器和存储介质
TWI757606B (zh) 伺服器裝置及其基板管理控制器與可程式邏輯單元之間的通訊協定方法
CN115529332B (zh) 一种用于车机中控的云车机系统及远程访问方法
US20210373766A1 (en) Method facilitating data transmission, apparatus, and storage medium thereof
CN110888665B (zh) 一种变更内容提交方法、装置、设备及存储介质
WO2024000535A1 (zh) 分区表更新方法、装置、电子设备及存储介质
CN115766783A (zh) 基于车机多操作系统的数据传输方法和计算机设备

Legal Events

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

Ref document number: 21935858

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21935858

Country of ref document: EP

Kind code of ref document: A1