CN117234746A - Deadlock detection method and system for interrupt driver under concurrency environment - Google Patents

Deadlock detection method and system for interrupt driver under concurrency environment Download PDF

Info

Publication number
CN117234746A
CN117234746A CN202311023139.3A CN202311023139A CN117234746A CN 117234746 A CN117234746 A CN 117234746A CN 202311023139 A CN202311023139 A CN 202311023139A CN 117234746 A CN117234746 A CN 117234746A
Authority
CN
China
Prior art keywords
lock
interrupt
graph
deadlock
processing function
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311023139.3A
Other languages
Chinese (zh)
Inventor
刘关俊
张瑜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tongji University
Original Assignee
Tongji University
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 Tongji University filed Critical Tongji University
Priority to CN202311023139.3A priority Critical patent/CN117234746A/en
Publication of CN117234746A publication Critical patent/CN117234746A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a deadlock detection method and a system for an interrupt driver under a concurrency environment, which relate to the technical field of embedding, and comprise the steps of identifying an interrupt processing function, an interrupt priority and interrupt shielding operation, recording operation sentences related to locks in the interrupt processing function, and generating an interrupt processing function abstract; performing context-sensitive lock set analysis, and constructing a lock graph based on the lock set analysis result; based on the abstract of the interrupt processing function, adding edges and nodes in the original lock graph; and identifying the lock graph cycle, using the lock graph cycle as a potential deadlock, carrying out concurrency analysis on the lock graph cycle, detecting the occurrence of the deadlock, and outputting a result. The occurrence condition of interruption is judged more accurately, and the stability of the system is improved; the dependency relationship between functions and the service condition of the lock are rapidly and accurately determined, so that the detection efficiency is improved, and invalid detection operation is reduced; and the lock graph is circularly and concurrently analyzed, so that false alarms and missing alarms can be reduced, and the reliability and stability of the system are improved.

Description

Deadlock detection method and system for interrupt driver under concurrency environment
Technical Field
The invention relates to the technical field of embedded systems, in particular to a deadlock detection method and system for an interrupt driver in a concurrent environment.
Background
The interrupt-driven embedded software is typical concurrent software, the main concurrent system structure is a main loop and interrupt structure or a multi-task and interrupt structure, the system data streams are driven by interrupts, the interrupt-driven embedded software can timely respond to interrupt requests from external events or hardware equipment and immediately execute corresponding interrupt service programs, and the concurrent processing mode enables the software to effectively process a plurality of tasks and events in an application scene requiring high real-time performance.
Interrupt drivers and multithreaded programs vary widely in concurrency control, concurrency scheduling, and preemption relationships. The interrupt driver is not like a multithread program, and an explicit synchronization mechanism is used for realizing concurrency control, and the concurrency control is mostly carried out by adopting an Ad-hoc synchronization mode, for example, synchronization and mutual exclusion are carried out through a custom variable, each thread in the multithread program can mutually preempt, but in the interrupt driver, the preemption mode is asymmetric, only high-priority interrupts can preempt low-priority interrupts, and the interrupts can preempt a main program. Therefore, if the traditional multi-thread deadlock detection method is directly applied to the interrupt driver, the phenomena of missing report and false report can occur.
The invention realizes a static deadlock detection tool for an interrupt driver, fully considers interrupt concurrency semantics on the basis of a traditional static deadlock detection method based on lock set analysis, firstly identifies an interrupt processing function, interrupt priority and interrupt shielding operation, records operation sentences related to locks in the interrupt processing function, and generates an interrupt processing function abstract; then performing context-sensitive lock set analysis on functions except the interrupt processing function, and constructing a lock graph based on a lock set analysis result; then adding edges and nodes in the original lock graph according to the obtained interrupt processing function abstract; and identifying lock graph loops, wherein each loop is a potential deadlock, carrying out concurrent analysis on the lock graph loops, detecting whether the deadlock is actually possible, and finally outputting a result, wherein the test experimental result shows the effectiveness of the method.
Disclosure of Invention
The present invention has been made in view of the above-described problems.
Therefore, the technical problems solved by the invention are as follows: the existing concurrent defect detection method has false alarm,
the problem of false negatives, inefficiency, and how to effectively detect potential deadlocks in an interrupt driver and indicate the path of occurrence of the potential deadlocks.
In order to solve the technical problems, the invention provides the following technical scheme: a deadlock detection method for an interrupt driver under a concurrent environment comprises the steps of identifying an interrupt processing function, interrupt priority and interrupt shielding operation, recording operation sentences related to locks in the interrupt processing function, and generating an interrupt processing function abstract; performing context-sensitive lock set analysis, and constructing a lock graph based on the lock set analysis result; based on the abstract of the interrupt processing function, adding edges and nodes in the original lock graph; and identifying the lock graph cycle, using the lock graph cycle as a potential deadlock, carrying out concurrency analysis on the lock graph cycle, detecting the occurrence of the deadlock, and outputting a result.
As a preferable scheme of the deadlock detection method for the interrupt driver in the concurrency environment, the invention comprises the following steps: the method comprises the steps of generating an interrupt processing function abstract, identifying interrupt processing function information according to an interrupt processing function name, including interrupt priority and interrupt shielding operation, recording operation of each lock in the interrupt processing function, wherein the operation of the lock comprises locking only, unlocking only, locking first and unlocking first and locking second, and adding an interrupt edge and node in an original lock graph according to an operation mode of the lock in the record.
As a preferable scheme of the deadlock detection method for the interrupt driver in the concurrency environment, the invention comprises the following steps: the context-sensitive lock set analysis includes building a program control flow graph that represents control flow migration relationships of basic blocks in a program.
Context-sensitive lock set analysis is performed on each basic block, and sentences in the basic blocks are analyzed sequentially from the entry of the basic block.
When the statement is a lock application statement, a lock is added to the lock set of the statement.
When the statement is a lock release statement, the lock is deleted from the lock set of the statement.
For a function call statement in a basic block, lock set information of the call statement needs to be transferred to a called function, the lock set is updated in the basic block, and the information is transmitted to a subsequent step of the basic block.
Iterative analysis is performed on each basic block to reach a fixed point, and the lock set of the sentence is not changed.
As a preferable scheme of the deadlock detection method for the interrupt driver in the concurrency environment, the invention comprises the following steps: constructing the lock graph includes constructing the lock graph based on the lock set analysis results, and lock variables are represented as nodes in the lock graph.
Lock B is applied with lock a in place, and is represented in the lock graph as an edge pointing from node a to node B.
As a preferable scheme of the deadlock detection method for the interrupt driver in the concurrency environment, the invention comprises the following steps: the adding of the edges and the nodes comprises the step of adding the edges according to the operation mode for each lock X based on the recorded abstract of the interrupt processing function, wherein each edge records the name of the interrupt processing function, and the nodes in the lock graph are expressed as Vi.
When only locking X, adding Vi to X edge and X to Vi edge, outputting warning information to remind user to check statement omission error in interrupt processing function.
When only unlocking X, no edges are added.
When unlocking after locking X, add Vi to X's edge.
When X is unlocked and then locked, adding Vi to the X side and X to Vi side, outputting warning information to remind a user to check statement omission errors in the interrupt processing function.
As a preferable scheme of the deadlock detection method for the interrupt driver in the concurrency environment, the invention comprises the following steps: the concurrency analysis comprises the steps of detecting loops, eliminating false loops, detecting statement concurrency execution conditions related to the loops, wherein the loops in the lock graph represent potential deadlocks.
When two sentences are in the same task, the two sentences are sequentially executed, and no deadlock is generated.
When the sentences related to the cycle are in different tasks but hold a common lock, the lock is used as a door lock, and under the condition of door lock protection, the sentences are not executed concurrently, and no deadlock is generated.
And checking interrupt shielding and interrupt priority for the interrupt lock graph circulation, and judging the occurrence condition of the interrupt.
As a preferable scheme of the deadlock detection method for the interrupt driver in the concurrency environment, the invention comprises the following steps: the concurrency analysis also comprises that when the lock graph loops only has one lock, the lock graph loops are repeatedly applied for deadlock caused by the lock, and statement information is directly output.
When the lock graph loops with two locks, detection is needed to detect the concurrent execution of the statements on the edges.
When the statement is a statement of the interrupt processing function, the real occurrence of the interrupt needs to be detected.
Another object of the present invention is to provide a deadlock detection system for an interrupt driver in a concurrent environment, which can construct a lock graph based on the lock set analysis result by performing context-sensitive lock set analysis, so as to solve the problem that the current concurrent defect detection technology has low detection efficiency.
As a preferred scheme of the deadlock detection system for interrupt drivers in the concurrency environment, the invention comprises the following steps: the system comprises a function processing module, a lock graph construction module, a lock graph processing module and a deadlock detection module; the function processing module is used for identifying an interrupt processing function, an interrupt priority and interrupt shielding operation, recording operation sentences related to locks in the interrupt processing function and generating an interrupt processing function abstract; the lock graph construction module is used for carrying out context-sensitive lock set analysis on each basic block and constructing a lock graph based on a lock set analysis result; the lock graph processing module is used for processing the function abstract based on the recorded interrupt, and adding edges and nodes to the lock according to the operation mode; the deadlock detection module is used for identifying a lock graph cycle, using the lock graph cycle as a potential deadlock, carrying out concurrency analysis on the lock graph cycle, detecting the occurrence of the deadlock and outputting a result.
A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that execution of the computer program by the processor is a step of implementing a deadlock detection method for an interrupt driver in a concurrent environment.
A computer readable storage medium having stored thereon a computer program, characterized in that the computer program when executed by a processor implements the steps of a deadlock detection method for an interrupt driver in a concurrent environment.
The invention has the beneficial effects that: the deadlock detection method for the interrupt driver provided by the invention identifies the interrupt processing function, the interrupt priority and the interrupt shielding operation in the concurrent environment, generates the abstract of the interrupt processing function, and can more accurately judge the occurrence condition of the interrupt, thereby improving the stability and the reliability of the system; context-sensitive lock set analysis is carried out on functions except the interrupt processing functions, and a lock graph is constructed based on the lock set analysis result, so that the dependency relationship between functions and the service condition of the locks can be rapidly and accurately determined, the detection efficiency is improved, and invalid detection operation is reduced; according to the obtained abstract of the interrupt processing function, edges and nodes are added in an original lock graph, lock graph loops are identified, each loop is a potential deadlock, the lock graph loops are subjected to concurrent analysis, whether the deadlock is true or not is detected, finally, a result is output, the conditions of false alarm and false alarm can be reduced, the accuracy of deadlock detection is improved, and therefore the reliability and stability of a system are improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. Wherein:
fig. 1 is an overall flowchart of a deadlock detection method for an interrupt driver in a concurrent environment according to a first embodiment of the present invention.
Fig. 2 is a program control flow diagram of a deadlock detection method for an interrupt driver in a concurrent environment according to a second embodiment of the present invention.
Fig. 3 is a diagram illustrating a lock graph of an output of a deadlock detection method for an interrupt driver in a concurrent environment according to a second embodiment of the present invention.
Fig. 4 is a diagram of a lock graph cycle example of an output of a deadlock detection method for an interrupt driver in a concurrent environment according to a second embodiment of the present invention.
Fig. 5 is a diagram of lock graph cycle information of output of a deadlock detection method for an interrupt driver in a concurrent environment according to a second embodiment of the present invention.
Fig. 6 is a diagram of a final detection result of the output of the deadlock detection method for an interrupt driver in a concurrent environment according to the second embodiment of the present invention.
Fig. 7 is a flowchart of a deadlock detection system for an interrupt driver in a concurrent environment according to a third embodiment of the present invention.
Detailed Description
So that the manner in which the above recited objects, features and advantages of the present invention can be understood in detail, a more particular description of the invention, briefly summarized above, may be had by reference to the embodiments, some of which are illustrated in the appended drawings. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present invention, but the present invention may be practiced in other ways other than those described herein, and persons skilled in the art will readily appreciate that the present invention is not limited to the specific embodiments disclosed below.
Further, reference herein to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic can be included in at least one implementation of the invention. The appearances of the phrase "in one embodiment" in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments.
While the embodiments of the present invention have been illustrated and described in detail in the drawings, the cross-sectional view of the device structure is not to scale in the general sense for ease of illustration, and the drawings are merely exemplary and should not be construed as limiting the scope of the invention. In addition, the three-dimensional dimensions of length, width and depth should be included in actual fabrication.
Also in the description of the present invention, it should be noted that the orientation or positional relationship indicated by the terms "upper, lower, inner and outer", etc. are based on the orientation or positional relationship shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the apparatus or elements referred to must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first, second, or third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
The terms "mounted, connected, and coupled" should be construed broadly in this disclosure unless otherwise specifically indicated and defined, such as: can be fixed connection, detachable connection or integral connection; it may also be a mechanical connection, an electrical connection, or a direct connection, or may be indirectly connected through an intermediate medium, or may be a communication between two elements. The specific meaning of the above terms in the present invention will be understood in specific cases by those of ordinary skill in the art.
Example 1
Referring to fig. 1, for one embodiment of the present invention, a method for detecting deadlock for an interrupt driver in a concurrent environment is provided, including:
s1: and identifying an interrupt processing function, an interrupt priority and an interrupt masking operation, recording operation sentences related to locks in the interrupt processing function, and generating an interrupt processing function abstract.
Further, interrupt handling functions are operative to respond to and handle interrupt events, and generally include saving a scene, executing specific interrupt handling logic, and resuming a scene; interrupt priority refers to the order in which a plurality of interrupt events are preferentially responded and processed when the interrupt events occur simultaneously; different interrupt events may have different priorities, and interrupts with high priorities will be responded to and processed preferentially; the interrupt priority is set to ensure that critical tasks are processed in time and avoid that certain interrupts occupy processor resources for a long time; the interrupt masking operation refers to an operation of masking or opening an interrupt; the role of the interrupt mask is to prevent certain interrupt events from occurring, making them unresponsive and unprocessed during masking; interrupt masking may be used to temporarily mask certain interrupts to ensure that execution of certain critical code is not disturbed, or to globally mask interrupts to stop the occurrence of all interrupt events.
It should be noted that generating the abstract of the interrupt handling function includes identifying interrupt handling function information including interrupt priority and interrupt mask operations according to the name of the interrupt handling function, recording operations for each lock in the interrupt handling function, including locking only, unlocking only, locking first then unlocking and locking first, and adding edges and nodes of the interrupt in the original lock graph according to the operation mode of the lock in the record.
S2: performing context-sensitive lock set analysis, and constructing a lock graph based on the lock set analysis result.
Further, context-sensitive lock set analysis includes building a program control flow graph that shows control flow migration relationships of basic blocks in a program.
Context-sensitive lock set analysis is performed on each basic block, and sentences in the basic blocks are analyzed sequentially from the entry of the basic block.
When the statement is a lock application statement, a lock is added to the lock set of the statement.
When the statement is a lock release statement, the lock is deleted from the lock set of the statement.
For a function call statement in a basic block, lock set information of the call statement needs to be transferred to a called function, the lock set is updated in the basic block, and the information is propagated to the follow-up of the basic block.
Iterative analysis is performed on each basic block to reach a fixed point, and the lock set of the sentence is not changed.
It should be noted that constructing a lock graph includes constructing a lock graph based on the results of the lock set analysis, with lock variables represented as nodes in the lock graph.
Lock B is applied with lock a in place, denoted in the lock graph as edges pointing from node a to node B, each edge recording the location in the source code of the statement applying the lock and the call context information.
It should also be noted that, the lock graph information is stored in a dot file format, visualization of the dot document is realized through Graphviz, and the constructed lock graph is output in png format.
S3: based on the interrupt handling function digest, edges and nodes are added in the original lock graph.
Further, adding edges and nodes includes adding edges according to the operation mode for each lock X based on the recorded interrupt handling function digest, and each edge records an interrupt handling function name, and the nodes in the lock graph are denoted as Vi.
When only X is locked, vi is added to the side of X and the side of X to Vi is added, and a warning message is outputted to remind the user to check the statement omission error in the interrupt processing function.
When only unlocking X, no edges are added.
When unlocking after locking X, add Vi to X's edge.
When X is unlocked and then locked, adding Vi to the X side and X to Vi side, outputting warning information to remind a user to check statement omission errors in the interrupt processing function.
S4: and identifying the lock graph cycle, using the lock graph cycle as a potential deadlock, carrying out concurrency analysis on the lock graph cycle, detecting the occurrence of the deadlock, and outputting a result.
Furthermore, the function of identifying the lock graph loop is to help detect the deadlock problem, locate the source code causing the deadlock, and repair and optimize the source code in a targeted manner, which is important to improve the concurrency performance and stability of the program; the concurrency analysis comprises the steps of representing potential deadlock by loops in the lock graph, detecting the loops, eliminating false loops, and detecting statement concurrency execution conditions related to the loops.
When two sentences are in the same task, the two sentences are sequentially executed, and no deadlock is generated.
When the sentences related to the cycle are in different tasks but hold a common lock, the lock is used as a door lock, and under the condition of door lock protection, the sentences are not executed concurrently, and no deadlock is generated.
And for the lock graph circulation of the interrupt, checking interrupt shielding and interrupt priority, and judging the occurrence condition of the interrupt.
It should be noted that, the concurrency analysis further includes that when the lock graph loop has only one lock, the lock graph loop repeatedly applies for the deadlock caused by the lock, and directly outputs statement information.
When the lock graph loops with two locks, detection is needed to detect the concurrent execution of the statements on the edges.
When the statement is a statement of the interrupt processing function, the real occurrence of the interrupt needs to be detected.
Example 2
Referring to fig. 2-6, for one embodiment of the present invention, a deadlock detection method for an interrupt driver in a concurrent environment is provided, and in order to verify the beneficial effects of the present invention, a scientific demonstration is performed through economic benefit calculation and simulation experiments.
First, FIG. 2 is a control flow graph of a program constructed, the control flow graph representing basic blocks in the program and control flow transfer relationships between them; performing context-sensitive lock set analysis on each basic block, and sequentially analyzing sentences in the basic blocks from an inlet of the basic block; if the statement is a lock application statement, adding the lock into the lock set of the current statement; if the statement is a lock release statement, deleting the lock from the lock set of the current statement; for function call statements in basic blocks, lock set information of the current call statement needs to be transferred to a called function; after updating the lock set in the basic block, transmitting the information to the subsequent relay of the basic block; performing iterative analysis on each basic block until a fixed point is reached, namely, the lock set is not changed any more until the lock set analysis is finished; constructing a lock graph according to the lock set analysis result; each lock variable is represented in the lock graph as a node; lock B is applied with lock a in place, and is represented in the lock graph as an edge pointing from node a to node B. Each side records the position of a statement applying for a lock in a source code and calling context information; and storing the lock graph information in a dot file format, realizing the visualization of the dot document by using Graphviz, and outputting the constructed lock graph in a png format.
FIG. 3 shows an example of an output lock graph, wherein in the right lock graph, the edges indicated by the dotted lines are edges added after the interrupt operation is identified, and each edge records the name of the interrupt processing function where the statement is located and the position in the source code; according to the name of the interrupt processing function given by a user, the tool identifies the related information of the interrupt processing function, including interrupt priority and interrupt shielding operation, and then records the operation of each lock in the interrupt processing function; according to the recorded interrupt handling function digest, for each lock involved, edges are added according to different modes of operation, the edge pointing from node a to node B still representing the application of lock B with the lock a held.
Each cycle in the lock graph represents a potential deadlock; for lock graph circulation, further detection circulation is needed, false circulation is eliminated, and false alarm is reduced.
After the lock graph cycle visualization shown as output in fig. 4, taking the right lock graph cycle as an example, it can be seen that edges 3 and 7 are cycles involving only one lock, in this case, the deadlock is often caused by repeated locking, for example, edge 3 represents that v2 is repeatedly locked in the same task/thread, which causes the deadlock; or in the interrupt, applying for an occupied lock v2; whereas the loop formed by sides 4 and 6 and sides 1 and 8 is a loop involving two locks, in which case further detection is often required.
FIG. 5 shows that only cycle_FINAL type CYCLEs are the result of FINAL deadlock detection; FIG. 6 shows the deadlock detection result as a final output; whether the sentences related to the cycle can be truly executed concurrently or not needs to be detected, for example, if two sentences are in the same task/process/thread, the two sentences can only be executed sequentially, and deadlock can not be generated; if the sentences involved in the circulation are in different tasks/processes/threads but hold a common lock, the lock is called a door lock, and under the condition of door lock protection, the two sentences can not be executed simultaneously, and deadlock can not be generated; in addition, for lock graph loops involving interrupts, it is necessary to further check the interrupt mask and interrupt priority to determine whether an interrupt at that time can occur; after the lock graph circulation concurrency analysis, the circulation label type, the lock graph circulation information and the deadlock detection result are respectively stored in the corresponding txt file.
On the basis of a traditional static deadlock detection method based on lock set analysis, identifying the operation of an interrupt processing function on a lock, adding new edges and nodes on a lock graph constructed when the interrupt is not considered initially, identifying the circulation in the lock graph, and further carrying out concurrent analysis on the lock graph circulation; the invention fully considers interrupt concurrency semantics, and the experimental result of the test shows the effectiveness of the method.
Example 3
Referring to fig. 7, for one embodiment of the present invention, a deadlock detection system for an interrupt driver in a concurrent environment is provided, where the deadlock detection system includes a function processing module, a lock graph construction module, a lock graph processing module, and a deadlock detection module.
The function processing module is used for identifying an interrupt processing function, an interrupt priority and interrupt shielding operation, recording operation sentences related to locks in the interrupt processing function and generating an interrupt processing function abstract; the lock graph construction module is used for carrying out context-sensitive lock set analysis on each basic block and constructing a lock graph based on a lock set analysis result; the lock graph processing module is used for processing the function abstract based on the recorded interrupt, and adding edges and nodes to the lock according to the operation mode; the deadlock detection module is used for identifying the lock graph cycle, using the lock graph cycle as a potential deadlock, carrying out concurrency analysis on the lock graph cycle, detecting the occurrence of the deadlock and outputting a result.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method of the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium may even be paper or other suitable medium upon which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like. It should be noted that the above embodiments are only for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solution of the present invention may be modified or substituted without departing from the spirit and scope of the technical solution of the present invention, which is intended to be covered in the scope of the claims of the present invention.
It should be noted that the above embodiments are only for illustrating the technical solution of the present invention and not for limiting the same, and although the present invention has been described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that the technical solution of the present invention may be modified or substituted without departing from the spirit and scope of the technical solution of the present invention, which is intended to be covered in the scope of the claims of the present invention.

Claims (10)

1. The deadlock detection method for the interrupt driver in the concurrency environment is characterized by comprising the following steps:
identifying an interrupt processing function, an interrupt priority and interrupt shielding operation, recording operation sentences related to locks in the interrupt processing function, and generating an interrupt processing function abstract;
performing context-sensitive lock set analysis, and constructing a lock graph based on the lock set analysis result;
based on the abstract of the interrupt processing function, adding edges and nodes in the original lock graph;
and identifying the lock graph cycle, using the lock graph cycle as a potential deadlock, carrying out concurrency analysis on the lock graph cycle, detecting the occurrence of the deadlock, and outputting a result.
2. The method for detecting deadlock for an interrupt driver in a concurrent environment according to claim 1, wherein: the method comprises the steps of generating an interrupt processing function abstract, identifying interrupt processing function information according to an interrupt processing function name, including interrupt priority and interrupt shielding operation, recording operation of each lock in the interrupt processing function, wherein the operation of the lock comprises locking only, unlocking only, locking first and unlocking first and locking second, and adding an interrupt edge and node in an original lock graph according to an operation mode of the lock in the record.
3. The deadlock detection method for an interrupt driver in a concurrent environment according to any one of claims 1 or 2, wherein: the context-sensitive lock set analysis comprises the steps of constructing a program control flow graph, wherein the control flow graph represents the control flow transfer relation of basic blocks in a program;
performing context-sensitive lock set analysis on each basic block, and sequentially analyzing sentences in the basic blocks from an inlet of the basic block;
when the statement is a lock application statement, adding a lock into a lock set of the statement;
when the statement is a lock release statement, deleting the lock from the lock set of the statement;
the method comprises the steps that function calling sentences in basic blocks are required to be transferred to called functions, lock sets in the basic blocks are updated, and information is transmitted to follow-up blocks of the basic blocks;
iterative analysis is performed on each basic block to reach a fixed point, and the lock set of the sentence is not changed.
4. A method for deadlock detection for an interrupt driver in a concurrent environment as claimed in claim 3, wherein: constructing a lock graph based on a lock set analysis result, wherein lock variables are represented as nodes in the lock graph;
lock B is applied with lock a in place, and is represented in the lock graph as an edge pointing from node a to node B.
5. The method for detecting deadlock for an interrupt driver in a concurrent environment according to claim 4, wherein: the adding of the edges and the nodes comprises the step of adding the edges according to the operation mode for each lock X based on the recorded abstract of the interrupt processing function, wherein each edge records the name of the interrupt processing function, and the nodes in the lock graph are expressed as Vi;
when X is only locked, adding Vi to the side of X and X to the side of Vi, outputting warning information to remind a user to check statement omission errors in an interrupt processing function;
when only unlocking X, no side is added;
when X is unlocked after being locked, adding Vi to the side of X;
when X is unlocked and then locked, adding Vi to the X side and X to Vi side, outputting warning information to remind a user to check statement omission errors in the interrupt processing function.
6. The method for detecting deadlock for an interrupt driver in a concurrent environment according to claim 5, wherein: the concurrency analysis comprises the steps of detecting loops, eliminating false loops, and detecting statement concurrency execution conditions related to the loops, wherein the loops in the lock graph represent potential deadlocks;
when two sentences are in the same task, the two sentences are sequentially executed, and no deadlock is generated;
when the sentences related in the circulation are in different tasks but hold common locks, the locks are used as door locks, and under the condition of door lock protection, the sentences are not executed concurrently, and no deadlock is generated;
and checking interrupt shielding and interrupt priority for the interrupt lock graph circulation, and judging the occurrence condition of the interrupt.
7. The method for detecting deadlock for an interrupt driver in a concurrent environment according to claim 6, wherein: the concurrency analysis further comprises that when the lock graph circulation has only one lock, deadlock caused by repeatedly applying for the lock is generated, and statement information is directly output;
when two locks are circularly arranged on the lock graph, detection is needed, and the concurrent execution condition of sentences on the edges is detected;
when the statement is a statement of the interrupt processing function, the real occurrence of the interrupt needs to be detected.
8. A system employing the deadlock detection method for interrupt drivers in a concurrent environment according to any one of claims 1 to 7, characterized in that: the system comprises a function processing module, a lock graph construction module, a lock graph processing module and a deadlock detection module;
the function processing module is used for identifying an interrupt processing function, an interrupt priority and interrupt shielding operation, recording operation sentences related to locks in the interrupt processing function and generating an interrupt processing function abstract;
the lock graph construction module is used for carrying out context-sensitive lock set analysis on each basic block and constructing a lock graph based on a lock set analysis result;
the lock graph processing module is used for processing the function abstract based on the recorded interrupt, and adding edges and nodes to the lock according to the operation mode;
the deadlock detection module is used for identifying a lock graph cycle, using the lock graph cycle as a potential deadlock, carrying out concurrency analysis on the lock graph cycle, detecting the occurrence of the deadlock and outputting a result.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the deadlock detection method for an interrupt driver in a concurrent environment according to any one of claims 1 to 7.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the deadlock detection method for an interrupt driver in a concurrent environment according to any one of claims 1 to 7.
CN202311023139.3A 2023-08-15 2023-08-15 Deadlock detection method and system for interrupt driver under concurrency environment Pending CN117234746A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311023139.3A CN117234746A (en) 2023-08-15 2023-08-15 Deadlock detection method and system for interrupt driver under concurrency environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311023139.3A CN117234746A (en) 2023-08-15 2023-08-15 Deadlock detection method and system for interrupt driver under concurrency environment

Publications (1)

Publication Number Publication Date
CN117234746A true CN117234746A (en) 2023-12-15

Family

ID=89091991

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311023139.3A Pending CN117234746A (en) 2023-08-15 2023-08-15 Deadlock detection method and system for interrupt driver under concurrency environment

Country Status (1)

Country Link
CN (1) CN117234746A (en)

Similar Documents

Publication Publication Date Title
JP5337454B2 (en) System and method for generating error traces for concurrent bugs
US7844971B2 (en) Method and apparatus for detecting cross-thread stack access in multithreaded programs
Kugler et al. Temporal logic for scenario-based specifications
US9612937B2 (en) Determining relevant events in source code analysis
US8656496B2 (en) Global variable security analysis
US7783470B2 (en) Verification of concurrent programs having parameterized qualities
US7028119B2 (en) Automated tool for detection of potential race condition
CN112817787B (en) Automatic detection method for data competition of interrupt-driven embedded system
US20100131472A1 (en) Detection and utilzation of inter-module dependencies
RU2680737C2 (en) Controlling execution of threads in multi-threaded processor
CN109635568B (en) Concurrent vulnerability detection method based on combination of static analysis and fuzzy test
US8510604B2 (en) Static data race detection and analysis
US8176496B2 (en) Partial order reduction using guarded independence relations
US20030144891A1 (en) Supervising the processing status of activities within workflow management systems
US6304938B1 (en) Detecting a state change in a lock structure to validate a potential deadlock
US8607204B2 (en) Method of analyzing single thread access of variable in multi-threaded program
CN113760491A (en) Task scheduling system, method, equipment and storage medium
CN110825427B (en) Code management method, device, server and storage medium
CN117234746A (en) Deadlock detection method and system for interrupt driver under concurrency environment
Attie et al. Efficiently verifiable conditions for deadlock-freedom of large concurrent programs
US8739136B2 (en) Validating run-time references
US20080163224A1 (en) Modeling interrupts in a business process
US7185318B1 (en) Method, system and computer program for comparing a first specification with a second specification
US20230385177A1 (en) Testing using labelled recorded alerts
CN110955546A (en) Memory address monitoring method and device and electronic equipment

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