CN115220990B - Multi-core system program flow monitoring method, device, equipment and storage medium - Google Patents

Multi-core system program flow monitoring method, device, equipment and storage medium Download PDF

Info

Publication number
CN115220990B
CN115220990B CN202111502127.XA CN202111502127A CN115220990B CN 115220990 B CN115220990 B CN 115220990B CN 202111502127 A CN202111502127 A CN 202111502127A CN 115220990 B CN115220990 B CN 115220990B
Authority
CN
China
Prior art keywords
program
monitoring
sub
kernel
core system
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.)
Active
Application number
CN202111502127.XA
Other languages
Chinese (zh)
Other versions
CN115220990A (en
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.)
Guangzhou Automobile Group Co Ltd
Original Assignee
Guangzhou Automobile Group Co 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 Guangzhou Automobile Group Co Ltd filed Critical Guangzhou Automobile Group Co Ltd
Priority to CN202111502127.XA priority Critical patent/CN115220990B/en
Publication of CN115220990A publication Critical patent/CN115220990A/en
Application granted granted Critical
Publication of CN115220990B publication Critical patent/CN115220990B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a multi-core system program flow monitoring method, which comprises the following steps: distributing a monitoring program in each kernel in the multi-kernel system; the monitoring program is used for monitoring a plurality of subroutines corresponding to specific functions, and the specific functions correspond to a preset target execution sequence; establishing an association relation between the monitoring program in each kernel and the subprograms in the other kernels; when the execution of the sub-programs is completed, acquiring the sub-execution sequence of the sub-program monitored by the monitoring program; when the sub-execution sequence of any sub-program is not matched with the target execution sequence, determining that the program flow of the multi-core system is abnormal. The invention also discloses a multi-core system program flow monitoring device, equipment and a storage medium. According to the embodiment of the invention, the monitoring programs are arranged in the cores to monitor other subprograms outside the cores, so that the situation that the subprograms in the cores of the monitoring programs cannot be executed due to the fact that the subprograms in the cores of the monitoring programs are trapped in the dead loops is avoided, and the monitoring coverage is improved.

Description

Multi-core system program flow monitoring method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for monitoring program flow of a multi-core system.
Background
With the explosive growth of information, in order to process information in time and increase the running speed of a single-core chip, a computer system needs to process more and more information in the same time, but the single-core chip generates excessive heat when running a large number of programs rapidly, so that the performance of the chip is reduced. Therefore, in order to better adapt to explosive growth of information, the prior art proposes a multi-core technology, wherein a program to be operated is divided into a plurality of subroutines, and the application of the multi-core technology enables the subroutines to operate and process in different cores, so that the operating pressure of each core is reduced, and the overheating of the cores is avoided.
In the running process of the multi-core technology, the realization of a certain function is realized through a series of sub-program combinations distributed on the same core or different cores, and when the execution of the sub-program is wrong or not called, the corresponding function is abnormal, so that the program flow under the multi-core system needs to be monitored. In the prior art, a monitoring program is arranged on one kernel to monitor all the subroutines, but when the subroutines of the kernel where the monitoring program is arranged are in a dead loop, the monitoring program can not be executed, and abnormal running of the program can not be monitored.
Disclosure of Invention
The embodiment of the invention provides a method, a device, equipment and a storage medium for monitoring program flow of a multi-core system, which can be used for monitoring other subprograms outside a core by arranging monitoring programs in a plurality of cores, so that the condition that the monitoring programs cannot be executed due to the fact that the subprograms in the core are trapped in a dead loop is avoided, and the monitoring coverage is improved.
To achieve the above object, an embodiment of the present invention provides a method for monitoring a program flow of a multi-core system, including:
Distributing a monitoring program in each kernel in the multi-kernel system; the monitoring program is used for monitoring a plurality of subroutines corresponding to specific functions, and the specific functions correspond to a preset target execution sequence;
Establishing an association relation between the monitoring program in each kernel and the subprograms in the rest kernels;
When the execution of the sub-programs is completed, acquiring the sub-execution sequence of the sub-program monitored by the monitoring program;
and when the sub-execution sequence of any sub-program is not matched with the target execution sequence, judging that the program flow of the multi-core system is abnormal.
As an improvement of the foregoing solution, before each core in the multi-core system allocates one monitor, the method further includes:
Distributing sub-program IDs to the plurality of sub-programs according to the target execution sequence;
and assigning a kernel ID to the kernel.
As an improvement of the above solution, the establishing an association between the monitor program in each kernel and the subroutines in the other kernels specifically includes:
Distributing a monitor ID for the monitor;
establishing an association relation between the kernel ID and a monitor ID of a monitor in the kernel;
establishing an association relation between the kernel ID and the subprogram ID of the subprogram in the kernel;
And establishing an association relation between the monitor program ID corresponding to each kernel ID and the subprogram IDs corresponding to the rest kernel IDs.
As an improvement of the above solution, the establishing an association between the monitor ID corresponding to each kernel ID and the subroutine IDs corresponding to the remaining kernel IDs specifically includes:
Setting a detection point in each subroutine, and distributing a detection point ID for the detection point;
establishing an association relation between the subprogram ID and a detection point ID of a detection point in the subprogram;
And establishing an association relation between the monitoring program ID and a detection point ID corresponding to the subprogram ID according to the association relation between the monitoring program ID and the subprogram ID.
As an improvement of the above solution, the acquiring the sub-execution sequence of the sub-program monitored by the monitor program specifically includes:
Acquiring the sub-execution sequence of the detection points detected by the monitoring program;
And generating the sub-execution sequence of the subprogram according to the sub-execution sequence of the detection point based on the association relation between the subprogram ID and the detection point ID.
As an improvement of the above scheme, the method further comprises: and when the sub-execution sequences of all the sub-programs are matched with the target execution sequence, judging that the program flow is normal.
To achieve the above object, an embodiment of the present invention further provides a device for monitoring a program flow of a multi-core system, including:
The monitoring program distribution module is used for distributing a monitoring program to each core in the multi-core system; the monitoring program is used for monitoring a plurality of subroutines corresponding to specific functions, and the specific functions correspond to a preset target execution sequence;
The relation establishing module is used for establishing an association relation between the monitoring program in each kernel and the subprograms in the rest kernels;
The sub-execution sequence monitoring module is used for acquiring the sub-execution sequence of the sub-program monitored by the monitoring program when the execution of the plurality of sub-programs is completed;
and the program flow judging module is used for judging that the program flow of the multi-core system is abnormal when the sub-execution sequence of any sub-program is not matched with the target execution sequence.
As an improvement of the above solution, the program flow determining module is further configured to determine that the program flow is normal when the sub-execution order of all the sub-programs matches the target execution order.
To achieve the above object, an embodiment of the present invention further provides a multi-core system program flow monitoring device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, where the processor executes the computer program to implement the multi-core system program flow monitoring method according to any one of the embodiments above.
To achieve the above object, an embodiment of the present invention further provides a computer readable storage medium, where the computer readable storage medium includes a stored computer program, where when the computer program runs, a device where the computer readable storage medium is controlled to execute the multi-core system program flow monitoring apparatus according to any one of the embodiments.
Compared with the prior art, the method, the device, the equipment and the storage medium for monitoring the program flow of the multi-core system disclosed by the embodiment of the invention are characterized in that the sub-execution sequence of the sub-program monitored by the monitoring program is obtained when the execution of the plurality of sub-programs is completed by distributing the monitoring program for each core of the multi-core system and establishing the association relation between the monitoring program in each core and the sub-program in the rest cores; the monitoring program is used for monitoring a plurality of subroutines corresponding to specific functions, and the specific functions correspond to a preset target execution sequence; and when the sub-execution sequence of any sub-program is not matched with the target execution sequence, judging that the program flow of the multi-core system is abnormal. Therefore, the embodiment of the invention can be used for monitoring other subprograms outside the kernel by arranging the monitoring programs in a plurality of kernels, so that the condition that the subprograms in the kernel cannot be executed due to the fact that the monitoring programs are trapped in the dead loop is avoided, and the monitoring coverage is improved.
Drawings
FIG. 1 is a flowchart of a method for monitoring program flow of a multi-core system according to an embodiment of the present invention;
FIG. 2 is a flowchart of another method for monitoring program flow of a multi-core system according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a multi-core system program flow monitoring device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a multi-core system program flow monitoring device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1, a flowchart of a method for monitoring a program flow of a multi-core system according to an embodiment of the present invention includes:
S11, distributing a monitoring program in each kernel in the multi-kernel system; the monitoring program is used for monitoring a plurality of subroutines corresponding to specific functions, and the specific functions correspond to a preset target execution sequence;
s12, establishing an association relation between the monitoring program in each kernel and the subprograms in the rest kernels;
S13, when all the sub-programs are executed, acquiring the sub-execution sequence of the sub-program monitored by the monitoring program;
S14, when the sub-execution sequence of any sub-program is not matched with the target execution sequence, judging that the program flow of the multi-core system is abnormal.
In step S11, for example, in the multi-core system, a monitor program is allocated to each core in response to the monitor instruction, so as to monitor the execution sequence of several subroutines corresponding to the specific function; the monitoring instruction may be automatically generated after the multi-core system is powered on, that is, the monitoring program is distributed immediately after the multi-core system is powered on, or the monitoring instruction may be a specific function starting instruction input by a user, that is, when the instruction for starting the specific function is received, the monitoring program is distributed to each core, which is not limited herein; the specific function may be a music playing function or a video playing function, which is not limited herein; the monitoring program may be stored in a local memory or a cloud server in advance, and when a monitoring instruction is received, the monitoring program is directly obtained from the local server or downloaded from the cloud server through networking, which is not limited herein.
Before step S12, calling a plurality of subroutines corresponding to a specific function by responding to a specific function starting instruction input by a user, and distributing the subroutines into a kernel; the specific function start instruction may be input by means of a keyboard, a mouse, a touch screen, or voice, etc., which is not limited herein.
In step S12, it should be noted that the monitoring program does not monitor the subroutines on the kernel where the monitoring program is located, but monitors all the subroutines on the remaining kernels, so as to avoid the situation that the monitoring program cannot execute when monitoring that the subroutines in the kernel where the monitoring program is located falls into a dead loop, and therefore, only the monitoring program in each kernel and the subroutines in the remaining kernels need to be associated.
In step S13, for example, based on the association relationship between the monitor program and the sub-program, the execution process of the sub-program is monitored by the monitor program, when a certain sub-program is executed, the running sub-program is recorded by the monitor program, and when all the sub-programs are executed, the sub-execution sequence of a plurality of sub-programs associated with the monitor program is obtained.
In step S14, for example, the target sub-execution order of the sub-program associated with the monitor program may be obtained from the preset target execution order corresponding to the specific function and the sub-program associated with the monitor program; comparing the sub-execution sequences of the sub-programs obtained by monitoring by all the monitoring programs with the target sub-execution sequences of the sub-programs related to the monitoring programs, and judging that the program flow of the multi-core system is abnormal if a comparison result is not matched.
In this embodiment, by allocating a monitor program to each core of the multi-core system and establishing an association relationship between the monitor program in each core and the subroutines in the other cores, when all the subroutines are executed, the subroutines monitored by the monitor program are obtained; the monitoring program is used for monitoring a plurality of subroutines corresponding to specific functions, and the specific functions correspond to a preset target execution sequence; and when the sub-execution sequence of any sub-program is not matched with the target execution sequence, judging that the program flow of the multi-core system is abnormal. Therefore, the embodiment of the invention can be used for monitoring other subprograms outside the kernel by arranging the monitoring programs in a plurality of kernels, so that the condition that the subprograms in the kernel cannot be executed due to the fact that the monitoring programs are trapped in the dead loop is avoided, and the monitoring coverage is improved.
In one embodiment, before allocating one monitor in each core in the multi-core system in step S11, the method further includes:
Distributing sub-program IDs to the plurality of sub-programs according to the target execution sequence;
and assigning a kernel ID to the kernel.
It should be noted that, since the monitor program of each kernel needs to establish an association relationship with the subroutines in the other kernels, ID allocation needs to be performed on the kernels and the subroutines for the subsequent monitor program to determine the corresponding monitored object.
For example, it is assumed that the specific function a includes three subroutines S1, S2, and S3, where S1, S2, and S3 are subroutine IDs assigned to the three subroutines in a preset target execution order, S1 is a subroutine executed first, and S3 is a subroutine executed last. Assuming that there are three cores, numbered CPU1, CPU2, and CPU3, respectively.
Note that, the ID assignment of the subroutine is not limited to the ascending number according to the target execution order, but may be the descending number according to the target execution order, or may be another number, and is not limited thereto.
In one embodiment, the establishing an association between the monitor program in each kernel and the subroutines in the other kernels in step S12 specifically includes:
Distributing a monitor ID for the monitor;
establishing an association relation between the kernel ID and a monitor ID of a monitor in the kernel;
establishing an association relation between the kernel ID and the subprogram ID of the subprogram in the kernel;
And establishing an association relation between the monitor program ID corresponding to each kernel ID and the subprogram IDs corresponding to the rest kernel IDs.
It should be noted that, in order to enable the monitor program in each core to monitor the subroutines in the other cores, a monitor program ID is allocated to the monitor program, and after each core is allocated with a monitor program, a one-to-one association relationship between the core ID and the monitor program ID is established, so as to achieve association between the core and the monitor program.
By way of example, assume that there are three cores, numbered CPU1, CPU2, and CPU3, respectively, and that a particular function A includes three subroutines S1, S2, and S3, where S1 is assigned to CPU1, S2 is assigned to CPU2, and S3 is assigned to CPU 3. Each kernel is allocated with a monitoring program, the number of the kernel where the monitoring program is located is referred to, the monitoring program is numbered, namely, the ID allocated to the monitoring program in the CPU1 is M1, the ID allocated to the monitoring program in the CPU2 is M2, and the ID allocated to the monitoring program in the CPU3 is M3; respectively establishing one-to-one association relation of the CPU1 and the M1, the CPU2 and the M2 and the CPU3 and the M3; establishing association relations of the CPU1 and S1 in the CPU1, the CPU2 and S2 in the CPU2, and the CPU3 and S3 in the CPU3 respectively; according to the one-to-one association relationship of the CPU1 and the M1, the CPU2 and the M2 and the CPU3 and the one-to-one association relationship of the CPU1 and the S1, the CPU2 and the S2 and the CPU3 and the S3, the association of the M1 and the S2 and the S3 is established, the association of the M2 and the S1 and the S3 is established, and the association of the M3 and the S1 and the S2 is established, so that the purposes of monitoring the S2 and the S3 by the M1, monitoring the S1 and the S3 by the M2 and monitoring the S1 and the S2 by the M3 are realized.
It should be noted that the number of cores, the number of subroutines, and the number of supervisory programs are not limited to the specific settings described above; the allocation of the monitor IDs of the monitors is not limited to the allocation rule described above, and in practical applications, it is only necessary to ensure that the monitor IDs of each monitor are different.
In one embodiment, the establishing an association between the monitor ID corresponding to each kernel ID and the subroutine IDs corresponding to the remaining kernel IDs specifically includes:
Setting a detection point in each subroutine, and distributing a detection point ID for the detection point;
establishing an association relation between the subprogram ID and a detection point ID of a detection point in the subprogram;
And establishing an association relation between the monitoring program ID and a detection point ID corresponding to the subprogram ID according to the association relation between the monitoring program ID and the subprogram ID.
It should be noted that, the detection points required by the monitoring program are placed in the corresponding subprogram, and the detection of the execution sequence of the subprogram is realized by monitoring the detection points.
By way of example, assuming that there are three monitoring programs M1, M2 and M3, a particular function a comprises three subroutines S1, S2 and S3, M1 being associated with S2, S3, M2 being associated with S1, S3, M3 being associated with S1, S2; at the set detection point CP1 at S1, at the set detection point CP2 at S2, at the set detection point CP3 at S3, and respectively establishing the association relation between S1 and CP1, S2 and CP2, and S3 and CP3, and further establishing the association relation between M1 and CP2, CP3, M2 and CP1, CP3, and M3 and CP1, CP 2.
In one embodiment, the acquiring the sub-execution sequence of the sub-program monitored by the monitor program specifically includes:
Acquiring the sub-execution sequence of the detection points detected by the monitoring program;
And generating the sub-execution sequence of the subprogram according to the sub-execution sequence of the detection point based on the association relation between the subprogram ID and the detection point ID.
Specifically, when the subprogram is executed to a detection point set on the subprogram, the corresponding monitoring program records the detection point ID of the detection point, and when all the subprograms are executed, the subprogram execution sequence of the detection point is obtained, and the subprogram execution sequence is obtained by combining the association relation of the subprogram ID and the detection point ID.
Illustratively, assuming that subroutines S1, S2, S3, and S4 exist, detecting points CP1, CP2, CP3, and CP4, monitor programs M1, M2, M3, and M4; wherein S1 is associated with CP1, S2 is associated with CP2, S3 is associated with CP3, and S4 is associated with CP 4; m1 is associated with CP2, CP3, CP4, M2 is associated with CP1, CP3, CP4, M3 is associated with CP1, CP2, CP4, and M4 is associated with CP1, CP2, CP3. After the actual execution of the subroutine is completed, the sub-execution sequence CP 2- & gt CP 3- & gt CP4 of the detection point detected by M1, the sub-execution sequence CP 1- & gt CP 3- & gt CP4 of the detection point detected by M2, the sub-execution sequence CP 1- & gt CP 2- & gt CP4 of the detection point detected by M3, the sub-execution sequence CP 1- & gt 2- & gt CP3 of the detection point detected by M4 are obtained; the sub-execution sequence of the detection points is converted into the sub-execution sequence of the sub-program, and S2- & gtS 3- & gtS 4, S1- & gtS 2- & gtS 4 and S1- & gtS 2- & gtS 3 are obtained.
In one embodiment, the method further comprises: and when the sub-execution sequences of all the sub-programs are matched with the target execution sequence, judging that the program flow is normal.
Illustratively, assuming that there are subroutines S1, S2, S3, and S4, which are executed by the cores CPU1, CPU2, CPU3, and CPU4, respectively, the target execution order is S1→S2→S3→S4; with the monitoring programs M1 on the CPU1 monitoring S2, S3 and S4, the monitoring program M2 on the CPU2 monitoring S1, S3 and S4, the monitoring program M3 on the CPU3 monitoring S1, S2 and S4, and the monitoring program M4 on the CPU4 monitoring S1, S2 and S3, when the sub-execution order outputted by the CPU1 is s2→s3→s4, the sub-execution order outputted by the CPU2 is s1→s3→s4, the sub-execution order outputted by the CPU3 is s1→s2→s4, and the sub-execution order outputted by the CPU2 is s1→s2→s3, all the sub-execution orders are matched with the target execution order s1→s2→s3→s4, and it is determined that the program flow is correct.
Compared with the prior art, the embodiment of the invention can be used for monitoring other subprograms outside the kernel by arranging the monitoring programs in a plurality of kernels, so that the condition that the subprograms in the kernel cannot be executed due to the fact that the monitoring programs are trapped in the dead loop is avoided, and the monitoring coverage is improved.
The specific flow of the multi-core system program flow monitoring method in the embodiment of the invention can also be referred to fig. 2.
Referring to fig. 3, a schematic structural diagram of a multi-core system program flow monitoring device provided by an embodiment of the present invention, where the multi-core system program flow monitoring device includes:
A monitor distribution module 11, configured to distribute a monitor to each core in the multi-core system; the monitoring program is used for monitoring a plurality of subroutines corresponding to specific functions, and the specific functions correspond to a preset target execution sequence;
A relationship establishing module 12, configured to establish an association between the monitor program in each kernel and the subroutines in the remaining kernels;
the sub-execution sequence monitoring module 13 is configured to obtain a sub-execution sequence of the sub-program monitored by the monitoring program when the plurality of sub-programs are all executed;
Program flow determination module 14 is configured to determine that an abnormality exists in a program flow of the multi-core system when a sub-execution order of any one of the sub-programs does not match the target execution order.
The monitor distribution module 11 distributes a monitor to each kernel to monitor the execution sequence of a plurality of subroutines corresponding to a specific function, for example, by responding to a monitor instruction; the monitoring instruction may be automatically generated after the multi-core system is powered on, that is, the monitoring program is distributed immediately after the multi-core system is powered on, or the monitoring instruction may be a specific function starting instruction input by a user, that is, when the instruction for starting the specific function is received, the monitoring program is distributed to each core, which is not limited herein; the specific function may be a music playing function or a video playing function, which is not limited herein; the monitoring program may be stored in a local memory or a cloud server in advance, and when a monitoring instruction is received, the monitoring program is directly obtained from the local server or downloaded from the cloud server through networking, which is not limited herein.
The relationship establishing module 12, for example, calls a plurality of subroutines corresponding to a specific function by responding to a specific function starting instruction input by a user, and distributes the plurality of subroutines into the kernel; the specific function start instruction may be input by means of a keyboard, a mouse, a touch screen, or voice, etc., which is not limited herein.
In the relationship establishing module 12, it should be noted that the monitoring program does not monitor the subroutines on the kernel where the monitoring program is located, but monitors all the subroutines on the remaining kernels, so as to avoid the situation that the monitoring program cannot execute when monitoring that the subroutines in the kernel where the monitoring program is located falls into a dead loop, so that the monitoring program in each kernel only needs to establish an association relationship with the subroutines in the remaining kernels.
In the sub-execution sequence monitoring module 13, for example, based on the association relationship between the monitoring program and the sub-program, the execution process of the sub-program is monitored by the monitoring program, when a certain sub-program is executed, the running sub-program is recorded by the monitoring program, and when all the sub-programs are executed, the sub-execution sequence of a plurality of sub-programs associated with the monitoring program is obtained.
In the program flow determination module 14, for example, a target sub-execution order of a sub-program associated with a monitor program may be obtained from a preset target execution order corresponding to a specific function and the sub-program associated with the monitor program; comparing the sub-execution sequences of the sub-programs obtained by monitoring by all the monitoring programs with the target sub-execution sequences of the sub-programs related to the monitoring programs, and judging that the program flow of the multi-core system is abnormal if a comparison result is not matched.
In this embodiment, by allocating a monitor program to each core of the multi-core system and establishing an association relationship between the monitor program in each core and the subroutines in the other cores, when all the subroutines are executed, the subroutines monitored by the monitor program are obtained; the monitoring program is used for monitoring a plurality of subroutines corresponding to specific functions, and the specific functions correspond to a preset target execution sequence; and when the sub-execution sequence of any sub-program is not matched with the target execution sequence, judging that the program flow of the multi-core system is abnormal. Therefore, the embodiment of the invention can be used for monitoring other subprograms outside the kernel by arranging the monitoring programs in a plurality of kernels, so that the condition that the subprograms in the kernel cannot be executed due to the fact that the monitoring programs are trapped in the dead loop is avoided, and the monitoring coverage is improved.
In one embodiment, the apparatus further comprises:
A sub-program ID allocation module, configured to allocate sub-program IDs to the plurality of sub-programs according to the target execution order;
and the kernel ID distribution module is used for distributing kernel IDs for the kernels.
It should be noted that, since the monitor program of each kernel needs to establish an association relationship with the subroutines in the other kernels, ID allocation needs to be performed on the kernels and the subroutines for the subsequent monitor program to determine the corresponding monitored object.
For example, it is assumed that the specific function a includes three subroutines S1, S2, and S3, where S1, S2, and S3 are subroutine IDs assigned to the three subroutines in a preset target execution order, S1 is a subroutine executed first, and S3 is a subroutine executed last. Assuming that there are three cores, numbered CPU1, CPU2, and CPU3, respectively.
Note that, the ID assignment of the subroutine is not limited to the ascending number according to the target execution order, but may be the descending number according to the target execution order, or may be another number, and is not limited thereto.
In one embodiment, the relationship establishment module 12 specifically includes:
A monitor ID allocation unit for allocating a monitor ID to the monitor;
the kernel and monitor mapping unit is used for establishing an association relation between the kernel ID and the monitor ID of the monitor in the kernel;
The kernel and subprogram mapping unit is used for establishing an association relation between the kernel ID and the subprogram ID of the subprogram in the kernel;
and the monitor program and subprogram mapping unit is used for establishing an association relation between the monitor program ID corresponding to each kernel ID and the subprogram IDs corresponding to the rest kernel IDs.
It should be noted that, in order to enable the monitor program in each core to monitor the subroutines in the other cores, monitor program IDs are allocated to the monitor programs, after each core is allocated with a monitor program, the association between the core ID and the monitor program ID is achieved by establishing a one-to-one association relationship between the core ID and the monitor program ID,
By way of example, assume that there are three cores, numbered CPU1, CPU2, and CPU3, respectively, and that a particular function A includes three subroutines S1, S2, and S3, where S1 is assigned to CPU1, S2 is assigned to CPU2, and S3 is assigned to CPU 3. Each kernel is allocated with a monitoring program, the number of the kernel where the monitoring program is located is referred to, the monitoring program is numbered, namely, the ID allocated to the monitoring program in the CPU1 is M1, the ID allocated to the monitoring program in the CPU2 is M2, and the ID allocated to the monitoring program in the CPU3 is M3; respectively establishing one-to-one association relation of the CPU1 and the M1, the CPU2 and the M2 and the CPU3 and the M3; establishing association relations of the CPU1 and S1 in the CPU1, the CPU2 and S2 in the CPU2, and the CPU3 and S3 in the CPU3 respectively; according to the one-to-one association relationship of the CPU1 and the M1, the CPU2 and the M2 and the CPU3 and the one-to-one association relationship of the CPU1 and the S1, the CPU2 and the S2 and the CPU3 and the S3, the association of the M1 and the S2 and the S3 is established, the association of the M2 and the S1 and the S3 is established, and the association of the M3 and the S1 and the S2 is established, so that the purposes of monitoring the S2 and the S3 by the M1, monitoring the S1 and the S3 by the M2 and monitoring the S1 and the S2 by the M3 are realized.
It should be noted that the number of cores, the number of subroutines, and the number of supervisory programs are not limited to the specific settings described above; the allocation of the monitor IDs of the monitors is not limited to the allocation rule described above, and in practical applications, it is only necessary to ensure that the monitor IDs of each monitor are different.
In one embodiment, the monitor and subroutine mapping unit specifically includes:
a detection point ID allocation subunit, configured to set a detection point in each of the subroutines, and allocate a detection point ID to the detection point;
A subroutine and detection point mapping subunit, configured to establish an association relationship between the subroutine ID and a detection point ID of a detection point in the subroutine;
And the monitoring program and detection point mapping subunit is used for establishing an association relation between the monitoring program ID and the detection point ID corresponding to the subprogram ID according to the association relation between the monitoring program ID and the subprogram ID.
It should be noted that, the detection points required by the monitoring program are placed in the corresponding subprogram, and the detection of the execution sequence of the subprogram is realized by monitoring the detection points.
By way of example, assuming that there are three monitoring programs M1, M2 and M3, a particular function a comprises three subroutines S1, S2 and S3, M1 being associated with S2, S3, M2 being associated with S1, S3, M3 being associated with S1, S2; at the set detection point CP1 at S1, at the set detection point CP2 at S2, at the set detection point CP3 at S3, and respectively establishing the association relation between S1 and CP1, S2 and CP2, and S3 and CP3, and further establishing the association relation between M1 and CP2, CP3, M2 and CP1, CP3, and M3 and CP1, CP 2.
In one embodiment, the sub-execution sequence monitoring module 13 specifically includes:
the detection point sub-execution sequence monitoring unit is used for acquiring the sub-execution sequence of the detection point detected by the monitoring program when the plurality of sub-programs are executed;
and the sub-program sub-execution sequence generating unit is used for generating the sub-execution sequence of the sub-program according to the sub-execution sequence of the detection point based on the association relation between the sub-program ID and the detection point ID.
Specifically, when the subprogram is executed to a detection point set on the subprogram, the corresponding monitoring program records the detection point ID of the detection point, and when all the subprograms are executed, the subprogram execution sequence of the detection point is obtained, and the subprogram execution sequence is obtained by combining the association relation of the subprogram ID and the detection point ID.
Illustratively, assuming that subroutines S1, S2, S3, and S4 exist, detecting points CP1, CP2, CP3, and CP4, monitor programs M1, M2, M3, and M4; wherein S1 is associated with CP1, S2 is associated with CP2, S3 is associated with CP3, and S4 is associated with CP 4; m1 is associated with CP2, CP3, CP4, M2 is associated with CP1, CP3, CP4, M3 is associated with CP1, CP2, CP4, and M4 is associated with CP1, CP2, CP3. After the actual execution of the subroutine is completed, the sub-execution sequence CP 2- & gt CP 3- & gt CP4 of the detection point detected by M1, the sub-execution sequence CP 1- & gt CP 3- & gt CP4 of the detection point detected by M2, the sub-execution sequence CP 1- & gt CP 2- & gt CP4 of the detection point detected by M3, the sub-execution sequence CP 1- & gt 2- & gt CP3 of the detection point detected by M4 are obtained; the sub-execution sequence of the detection points is converted into the sub-execution sequence of the sub-program, and S2- & gtS 3- & gtS 4, S1- & gtS 2- & gtS 4 and S1- & gtS 2- & gtS 3 are obtained.
In one embodiment, the program flow determining module 14 is further configured to determine that the program flow is normal when the sub-execution order of all the sub-programs matches the target execution order.
Illustratively, assuming that there are subroutines S1, S2, S3, and S4, which are executed by the cores CPU1, CPU2, CPU3, and CPU4, respectively, the target execution order is S1→S2→S3→S4; with the monitoring programs M1 on the CPU1 monitoring S2, S3 and S4, the monitoring program M2 on the CPU2 monitoring S1, S3 and S4, the monitoring program M3 on the CPU3 monitoring S1, S2 and S4, and the monitoring program M4 on the CPU4 monitoring S1, S2 and S3, when the sub-execution order outputted by the CPU1 is s2→s3→s4, the sub-execution order outputted by the CPU2 is s1→s3→s4, the sub-execution order outputted by the CPU3 is s1→s2→s4, and the sub-execution order outputted by the CPU2 is s1→s2→s3, all the sub-execution orders are matched with the target execution order s1→s2→s3→s4, and it is determined that the program flow is correct.
It should be noted that, the working process of the multi-core system program flow monitoring device may refer to the working process of the multi-core system program flow monitoring method in the above embodiment.
Compared with the prior art, the embodiment of the invention can be used for monitoring other subprograms outside the kernel by arranging the monitoring programs in a plurality of kernels, so that the condition that the subprograms in the kernel cannot be executed due to the fact that the monitoring programs are trapped in the dead loop is avoided, and the monitoring coverage is improved.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a multi-core system program flow monitoring device according to an embodiment of the present invention, where the multi-core system program flow monitoring device includes a processor 21, a memory 22, and a computer program stored in the memory 22 and configured to be executed by the processor 21, and steps in the embodiment of the multi-core system program flow monitoring method are implemented when the processor 21 executes the computer program, for example, steps S1 to S4 shown in fig. 1. Or the processor 21, when executing the computer program, performs the functions of the modules of the device embodiments described above, such as the monitor distribution module 11.
Illustratively, the computer program may be split into one or more modules that are stored in the memory 22 and executed by the processor 21 to complete the present invention. The one or more modules may be a series of computer program instruction segments capable of performing particular functions to describe the execution of the computer program in the multi-core oriented program flow monitoring device. For example, the computer program may be divided into a monitor distribution module 11, a relationship creation module 12, a sub-execution order monitoring module 13, and a program flow determination module 14, each of which functions specifically as follows:
A monitor distribution module 11, configured to distribute a monitor to each core in the multi-core system; the monitoring program is used for monitoring a plurality of subroutines corresponding to specific functions, and the specific functions correspond to a preset target execution sequence;
A relationship establishing module 12, configured to establish an association between the monitor program in each kernel and the subroutines in the remaining kernels;
the sub-execution sequence monitoring module 13 is configured to obtain a sub-execution sequence of the sub-program monitored by the monitoring program when the plurality of sub-programs are all executed;
Program flow determination module 14 is configured to determine that an abnormality exists in a program flow of the multi-core system when a sub-execution order of any one of the sub-programs does not match the target execution order.
The specific working process of each module may refer to the working process of the multi-core system program flow monitoring device described in the foregoing embodiment, and will not be described herein.
The multi-core system program flow monitoring device can be a computing device such as a desktop computer, a notebook computer, a palm computer and a cloud server. The multi-core system program flow monitoring device may include, but is not limited to, a processor 21, a memory 22. Those skilled in the art will appreciate that the schematic diagram is merely an example of a multi-core system program flow monitoring device and does not constitute a limitation of the multi-core system program flow monitoring device, and may include more or less components than illustrated, or may combine certain components, or different components, e.g., the multi-core system program flow monitoring device may also include input and output devices, network access devices, buses, etc.
The processor 21 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), off-the-shelf programmable gate array (field-programmable GATE ARRAY, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, and the processor 21 is a control center of the multi-core system program flow monitoring device, and connects various parts of the entire multi-core system program flow monitoring device using various interfaces and lines.
The memory 22 may be used to store the computer program and/or modules, and the processor 21 may implement various functions of the multi-core system program flow monitoring device by executing or executing the computer program and/or modules stored in the memory 22, and invoking data stored in the memory 22. The memory 22 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data (such as audio data, phonebook, etc.) created according to the use of the handset, etc. In addition, the memory 22 may include high-speed random access memory, and may also include non-volatile memory, such as a hard disk, memory, plug-in hard disk, smart memory card (SMART MEDIA CARD, SMC), secure Digital (SD) card, flash memory card (FLASH CARD), at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
Wherein the modules integrated by the multi-core system program flow monitoring device can be stored in a computer readable storage medium if implemented in the form of software functional units and sold or used as independent products. Based on such understanding, the present invention may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM), a random access memory (RAM, random Access Memory), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth.
While the foregoing is directed to the preferred embodiments of the present invention, it will be appreciated by those skilled in the art that changes and modifications may be made without departing from the principles of the invention, such changes and modifications are also intended to be within the scope of the invention.

Claims (10)

1. A method for monitoring program flow of a multi-core system, comprising:
Distributing a monitoring program in each kernel in the multi-kernel system; the monitoring program is used for monitoring a plurality of subroutines corresponding to specific functions, and the specific functions correspond to a preset target execution sequence; a program for realizing the specific function is divided into a plurality of the subprograms to be distributed into cores of the multi-core system;
Establishing an association relation between the monitoring program in each kernel and the subprograms in the rest kernels;
When the execution of the sub-programs is completed, acquiring the sub-execution sequence of the sub-program monitored by the monitoring program;
and when the sub-execution sequence of any sub-program is not matched with the target execution sequence, judging that the program flow of the multi-core system is abnormal.
2. The method for monitoring program flow in a multi-core system according to claim 1, wherein before each core in the multi-core system is allocated with one monitor, the method further comprises:
Distributing sub-program IDs to the plurality of sub-programs according to the target execution sequence;
and assigning a kernel ID to the kernel.
3. The method for monitoring program flow of multi-core system according to claim 2, wherein said establishing an association between the monitor program in each core and the subroutines in the remaining cores specifically comprises:
Distributing a monitor ID for the monitor;
establishing an association relation between the kernel ID and a monitor ID of a monitor in the kernel;
establishing an association relation between the kernel ID and the subprogram ID of the subprogram in the kernel;
And establishing an association relation between the monitor program ID corresponding to each kernel ID and the subprogram IDs corresponding to the rest kernel IDs.
4. The method for monitoring program flow of multi-core system according to claim 3, wherein said establishing an association between the monitor ID corresponding to each core ID and the subroutine IDs corresponding to the remaining core IDs specifically comprises:
Setting a detection point in each subroutine, and distributing a detection point ID for the detection point;
establishing an association relation between the subprogram ID and a detection point ID of a detection point in the subprogram;
And establishing an association relation between the monitoring program ID and a detection point ID corresponding to the subprogram ID according to the association relation between the monitoring program ID and the subprogram ID.
5. The method for monitoring program flow of multi-core system according to claim 4, wherein the step of obtaining the sub-execution sequence of the sub-program monitored by the monitor specifically comprises:
Acquiring the sub-execution sequence of the detection points detected by the monitoring program;
And generating the sub-execution sequence of the subprogram according to the sub-execution sequence of the detection point based on the association relation between the subprogram ID and the detection point ID.
6. The multi-core system program flow monitoring method of any of claims 1 to 5, further comprising: and when the sub-execution sequences of all the sub-programs are matched with the target execution sequence, judging that the program flow is normal.
7. A multi-core system program flow monitoring device, comprising:
the monitoring program distribution module is used for distributing a monitoring program to each core in the multi-core system; the monitoring program is used for monitoring a plurality of subroutines corresponding to specific functions, and the specific functions correspond to a preset target execution sequence; a program for realizing the specific function is divided into a plurality of the subprograms to be distributed into cores of the multi-core system;
The relation establishing module is used for establishing an association relation between the monitoring program in each kernel and the subprograms in the rest kernels;
The sub-execution sequence monitoring module is used for acquiring the sub-execution sequence of the sub-program monitored by the monitoring program when the execution of the plurality of sub-programs is completed;
and the program flow judging module is used for judging that the program flow of the multi-core system is abnormal when the sub-execution sequence of any sub-program is not matched with the target execution sequence.
8. The multi-core system program flow monitoring device of claim 7, wherein the program flow determination module is further configured to determine that the program flow is normal when the sub-execution order of all sub-programs matches the target execution order.
9. A multi-core system program flow monitoring device, characterized by comprising a processor, a memory and a computer program stored in the memory and configured to be executed by the processor, the processor implementing the multi-core system program flow monitoring method according to any of claims 1 to 6 when executing the computer program.
10. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored computer program, wherein the computer program, when run, controls a device in which the computer readable storage medium is located to perform the multi-core system program flow monitoring method according to any one of claims 1 to 6.
CN202111502127.XA 2021-12-09 2021-12-09 Multi-core system program flow monitoring method, device, equipment and storage medium Active CN115220990B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111502127.XA CN115220990B (en) 2021-12-09 2021-12-09 Multi-core system program flow monitoring method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111502127.XA CN115220990B (en) 2021-12-09 2021-12-09 Multi-core system program flow monitoring method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115220990A CN115220990A (en) 2022-10-21
CN115220990B true CN115220990B (en) 2024-04-19

Family

ID=83606934

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111502127.XA Active CN115220990B (en) 2021-12-09 2021-12-09 Multi-core system program flow monitoring method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115220990B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013054625A (en) * 2011-09-06 2013-03-21 Toyota Motor Corp Information processor and information processing method
WO2014202825A1 (en) * 2013-06-20 2014-12-24 Nokia Corporation Microprocessor apparatus
JP2017073083A (en) * 2015-10-09 2017-04-13 株式会社デンソー Parallelization method, parallelization tool, and on-vehicle device
CN108646708A (en) * 2018-05-02 2018-10-12 阳光电源股份有限公司 A kind of program flow monitoring method and system
DE102019202228A1 (en) * 2018-02-21 2019-08-22 Denso Corporation Parallelization method, parallelization tool, multi-core microcomputer and in-vehicle device
JP2019145065A (en) * 2018-02-21 2019-08-29 株式会社デンソー Parallelizing method, parallelizing tool, multi-core microcomputer and on-vehicle unit
CN112799729A (en) * 2021-01-29 2021-05-14 苏州浪潮智能科技有限公司 Uboot starting method, device, equipment and storage medium of multi-core system on chip
CN113722143A (en) * 2021-09-24 2021-11-30 中国第一汽车股份有限公司 Program flow monitoring method and device, electronic equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2013054625A (en) * 2011-09-06 2013-03-21 Toyota Motor Corp Information processor and information processing method
WO2014202825A1 (en) * 2013-06-20 2014-12-24 Nokia Corporation Microprocessor apparatus
JP2017073083A (en) * 2015-10-09 2017-04-13 株式会社デンソー Parallelization method, parallelization tool, and on-vehicle device
DE102019202228A1 (en) * 2018-02-21 2019-08-22 Denso Corporation Parallelization method, parallelization tool, multi-core microcomputer and in-vehicle device
JP2019145065A (en) * 2018-02-21 2019-08-29 株式会社デンソー Parallelizing method, parallelizing tool, multi-core microcomputer and on-vehicle unit
CN108646708A (en) * 2018-05-02 2018-10-12 阳光电源股份有限公司 A kind of program flow monitoring method and system
CN112799729A (en) * 2021-01-29 2021-05-14 苏州浪潮智能科技有限公司 Uboot starting method, device, equipment and storage medium of multi-core system on chip
CN113722143A (en) * 2021-09-24 2021-11-30 中国第一汽车股份有限公司 Program flow monitoring method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN115220990A (en) 2022-10-21

Similar Documents

Publication Publication Date Title
US10108458B2 (en) System and method for scheduling jobs in distributed datacenters
TWI516059B (en) Setup method and system for client and server environment
EP3355187A1 (en) Loading method and device for terminal application (app)
US7581047B2 (en) Usage of keyboard driver in extensible firmware interface for adding new hot keys at firmware level
CN109669775B (en) Distributed task scheduling method, system and storage medium
CN108021400B (en) Data processing method and device, computer storage medium and equipment
CN110083399B (en) Applet running method, computer device and storage medium
CN109684080B (en) Centralized task scheduling method, system and storage medium
CN112416353A (en) Channel package packaging method and device and computer equipment
CN111596927B (en) Service deployment method and device and electronic equipment
JP6893531B2 (en) Request processing method and equipment
WO2021121407A1 (en) Capacity changing method and apparatus for virtual machine
JP2019144727A (en) Virtual resource management device and virtual resource allocation method and virtual resource allocation program
WO2022222537A1 (en) Ai application deployment method, and related platform, cluster, medium and program product
EP3637252A1 (en) Virtual machine deployment method and omm virtual machine
CN111831411A (en) Task processing method and device, storage medium and electronic equipment
CN105491003A (en) System and method for prioritizing on access scan and on demand scan tasks
CN113285843B (en) Container network configuration method and device, computer readable medium and electronic equipment
CN115220990B (en) Multi-core system program flow monitoring method, device, equipment and storage medium
CN104700255B (en) Multi-process processing method, device and system
CN111277626B (en) Server upgrading method and device, electronic equipment and medium
CN112600931A (en) API gateway deployment method and device
US9348667B2 (en) Apparatus for managing application program and method therefor
CN113608847A (en) Task processing method, device, equipment and storage medium
CN115794384A (en) Code compiling task allocation method, device, equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant