Program detection method and apparatus
AssigneeHuawei Technologies Co., Ltd.
InventorsRutao Zhang, Qing Zhou
Life of this patent
Estimating the term…
Abstract
A program detection method includes receiving a program provided by a user, and obtaining, based on a query parameter and the program, a result of the program running in a weak memory environment. The query parameter indicates a maximum interval between two operations on which reordering occurs and that are of the program.
Claims20
A program detection method, comprising:
- receiving, from a user, a program running in a weak memory environment;
- calculating a first interval between a first operation in a first thread of the program and a second operation in the first thread, and a second interval between a third operation in a second thread of the program and a fourth operation in the second thread, wherein the first operation and the third operation are a first pair of read and write operations performed on a first variable, wherein the second operation and the fourth operation are a second pair of read and write operations performed on a second variable, wherein the first operation and the second operation are operations performed on different variables, and wherein the third operation and the fourth operation are operations performed on different variables;
- and
- obtaining, based on a query parameter, the first interval, the second interval, and the program, a result of the program,
- wherein the query parameter indicates a maximum interval between two operations on which reordering occurs and that are of the program.
A program detection apparatus, comprising:
- a memory configured to store instructions;
- and
- one or more processors coupled to the memory and configured to:
- receive, from a user, a program in a weak memory environment;
- calculate a first interval between a first operation in a first thread of the program and a second operation in the first thread, and a second interval between a third operation in a second thread of the program and a fourth operation in the second thread, wherein the first operation and the third operation are a first pair of read and write operations performed on a first variable, wherein the second operation and the fourth operation are a second pair of read and write operations performed on a second variable, wherein the first operation and the second operation are operations performed on different variables, and wherein the third operation and the fourth operation are operations performed on different variables;
- and
- obtain, based on a query parameter, the first interval, the second interval, and the program, a result of the program,
- wherein the query parameter indicates a maximum interval between two operations on which reordering occurs and that are of the program.
A computer program product comprising computer-executable instructions that are stored on a non-transitory computer storage medium and that, when executed by one or more processors, cause a program detection apparatus to:
- receive, from a user, a program running in a weak memory environment;
- calculate a first interval between a first operation in a first thread of the program and a second operation in the first thread, and a second interval between a third operation in a second thread of the program and a fourth operation in the second thread, wherein the first operation and the third operation are a first pair of read and write operations performed on a first variable, wherein the second operation and the fourth operation are a second pair of read and write operations performed on a second variable, wherein the first operation and the second operation are operations performed on different variables, and wherein the third operation and the fourth operation are operations performed on different variables;
- and
- obtain, based on a query parameter, the first interval, the second interval, and the program, a result of the program,
- wherein the query parameter indicates a maximum interval between two operations on which reordering occurs and that are of the program.
Dependencies are inferred from the claim text.