This article needs additional citations for verification. (August 2011) (Learn how and when to remove this template message)
A sense switch, or program switch, is a switch on the front panel of a computer whose state can be tested by conditional branch instructions in software. Most early computers had several sense switches. They were typically used by the operator to set program options.
|Data General Eclipse||5|
On the IBM 1620 there are four switches, and their state can be tested via special forms of the IF-statement offered by the FORTRAN compiler for the IBM 1620. For the IBM 1130 there are sixteen switches matching the sixteen-bit word size of the computer, plus a toggle switch adjacent to the power on/off switch. These bit-switches are more normally used with the computer stopped to specify some memory address to be viewed (via the indicator lights on the front panel), or set. The state of these switches can be determined by a program, and so a running program might modify its behavior depending on the switches, such as change the amount of progress information printed, alter the tactics of a multi-variable optimization attempt, and so on. The IBM 1130 also has an "Interrupt Request" key associated with the console printer, whose pressing might cause a suitably programmed long-running program to type a progress report on the console printer. In the more usual batch job environment, it was pressed by the computer operator to signal the operating system to terminate a running program that had perhaps overrun its allowed time, or commenced misbehavior such as repeatedly printing blank lines.
The front panel of the Data General Eclipse computer has 5 sense switches, 16 address switches, and 5 control switches, as shown (left to right) in the figure at right.
Personal computers replace the function of fixed sense switches with the keyboard and screen user interface.
A typical running application has two modes: either it has nothing to do and awaits some user action, or, some action is in progress that will take a long time to complete. If a program does not regularly test the state of sense switches during a long calculation, they are ineffective at changing the program's operation.