Branch (computer Science)

Branch (computer Science)

A branch is sequence of code in a computer program which is conditionally executed depending on how the flow of control is altered at the branching point. The term can be used when referring to programs in high level languages as well as program written in machine code or assembly language. Explicit branches in high-level programming languages usually take the form of conditional statements of various forms that encapsulates the branches of code that should be executed (or not) upon some condition; machine level instructions that define corresponding branches of code are denoted jump instructions. The principal function of a jump instruction can thus be compared to the GOTOs needed to build control structures in older high level languages.

Jump instructions typically have unconditional and conditional forms where the latter may be taken or not taken depending on some condition. The truthness of this condition is typically evaluated and temporarily stored by some previous instruction (not necessarily the one immediately before) and then used such as in jump if overflow-flag set. This temporary information is often stored in a flag register but may also be located elsewhere. There are also machines (or particular instructions) where the condition may be checked by the jump instruction itself, such as branch . When a branch is taken, the next instruction executed is defined by the argument to the jump instruction; when not taken, the next instruction executed is the instruction immediately following the jump instruction in memory so that the flow of control is unchanged.

Depending on computer architecture, the assembly language mnemonic for a jump instruction is typically some shortened form of the word jump or the word branch, often along with other informative letters (or an extra parameter) representing the condition. Sometimes other details are included as well, such as the range of the jump (the offset size) or a special addressing mode that should be used to locate the actual effective offset.

Read more about Branch (computer Science):  Typical Branch/jump Instructions Exemplified By Some Well-known Architectures

Famous quotes containing the word branch:

    She saw a dust bearing bee sink into the sanctum of a bloom; the thousand sister calxes arch to meet the love embrace and the ecstatic shiver of the tree from root to tiniest branch creaming in every blossom and frothing with delight. So this was a marriage!
    Zora Neale Hurston (1891–1960)