tight loop


tight loop

(programming)A loop of code that executes without releasingany resources to other programs or the operating system.

Consider the following pointless BASIC loop that countsupward indefinitely

10 i = i + 120 GOTO 10

Run on a single-user system such as MS-DOS this will notcause any problems. Run on a cooperative multitaskingoperating system such as Windows 3, the system would appearto freeze.

A pre-emptive multitasking operating system such asUNIX or Windows NT would "steal" cycles away fromthe program and continue to run other programs.

See also busy-wait and multitasking.