A conditional branch is a basic logical structure. It resembles a fork in the road; there are at least two paths that may be taken and one must be chosen.
This is a common method in computer programming. If a certain condition exists (e.g., the hard disk drive is in use), then the application will perform one action (in this case, it might wait), whereas if this condition does not exist the application will perform another action (proceed to read from or write to the hard disk).
Conditional statements can be assessed based on any number of data, including:
environmental characteristics (operating system, available APIs or libraries, other processes)
internal variables such as the result of a previous calculation or the setting of a state flag
Conditional branches are often issued in speculative execution, primarily because there is no simple solution to predict which branch will be selected when the condition is evaluated. Branches where the results of the conditional statement affect the outcome of the branch's execution are particularly difficult because they cannot be executed speculatively at all in a strict programming language ( C, C++, Java, BASIC, FORTRAN, and others) without substantial effort on the part of the programmer to allow for it. Since these languages form the bulk of existing commercial applications, the efficient use and executive optimization of branches is an important concern for many programmers working on applications, compilers, and CPU architectures.
In computer architecture, a branch predictor is the part of a processor that determines whether a conditionalbranch in the instruction flow of a program is likely to be taken or not.
Branch predictors are crucial in today's modern, superscalar processors for achieving high performance.
Branches evaluated as not taken decrement the state towards strongly not taken, and branches evaluated as taken increment the state towards strongly taken.
Conditionalbranches are often issued in speculative execution, primarily because there is no simple solution to predict which branch will be selected when the condition is evaluated.
Branches where the results of the conditional statement affect the outcome of the branch's execution are particularly difficult because they cannot be executed speculatively at all in a strict programming language (C, C++, Java, BASIC, FORTRAN, and others) without substantial effort on the part of the programmer to allow for it.
Since these languages form the bulk of existing commercial applications, the efficient use and executive optimization of branches is an important concern for many programmers working on applications, compilers, and CPU architectures.