Answer
2Unfortunately,
there is no longer a single answer to this question.
The terms were first used in the late 1970s during the
days of the IBM mainframe operating systems for the System/360
and System/370. These were batch-processing systems that
divided the available resources (mainly memory) into partitions,
usually three to four foreground partitions that had the
highest priority levels, and a background partition that
had the lowest priority. You’d put I/O-bound jobs in the
high-priority partitions and compute-bound tasks in the
background partition. By extension, because interrupt
service routines (ISRs) have the highest priority by definition,
they are the “most foreground” code.
Things
got really confused when the IBM PC and primitive (single-task)
operating systems (e.g., MSDOS) became popular. User code
was always operating in Non-interrupt mode (background),
but this was in the foreground in terms of the user interface.
People started writing TSR utilities that were hooked
into one interrupt or another (usually the timer tick)
to do tasks that were in the background in terms of the
user interaction. As a result, people starting to think
of interrupt code in general as being background code
and, therefore, the noninterrupt code as foreground code.
These days, it’s probably better to explicitly describe
code as “ISR” or “non-ISR.”
Contributor: David Tweed
Published
December 2003