Threaded code - Wikipedia, the free encyclopedia: "Threaded code
From Wikipedia, the free encyclopedia
Jump to: navigation, search
For multi-threaded programming, see Thread (computer science).
In computer science, the term threaded code refers to an implementation technique for programming languages that produces very compact code. Threading is a form of code consisting entirely of subroutine calls, written without the subroutine call instruction, and processed by an interpreter, which jumps to each successive subroutine in turn.
Threaded code is used in the Forth and early versions of the B programming languages, as well as many implementations of FORTRAN, BASIC, COBOL and other languages for small minicomputers.
The benefits of extremely compact code, in some cases, come at the expense of slower execution speed. However, in other cases there is a synergistic effect -- sometimes threaded code is smaller and faster than non-threaded code. In systems with virtual memory (where memory is simulated with a mechanical disk drive), threaded code may be hundreds of times faster than a less-compact design that does not fit in the available physical memory, because disk drives tend to be roughly a thousand times slower than random-access memory (RAM)."