Post by Steve at fivetreesPost by DaveNeither is. A foreground job is a text editor, or even the
UNIX/Linux/whatever shell, which receive keyboard or other input.
Background jobs cannot do this. If you logout, the foreground job is
terminated, but a background job is not. And yes, you can move foreground
jobs to the background and background jobs to the foreground. But, again,
it has nothing to do with ISRs/not ISRs.
What you're talking about is correct in the context of Unix, where
foreground/background have specific meanings, but incorrect in the context
of embedded.
As Grant said, ISRs are considered background in embedded. The main code is
considered foreground.
Hmmm. I have _never_ heard foreground/background used in reference
to embedded systems. So, first to the library. In Operating Systems, H.
Lorin and H.M. Deitel, in a discussion of real-time software (p. 71):
Foreground and background represent the preferences for system control
that the application is given. A pure background application receives
the processor only when there is no work for the foreground to do and
loses the processor whenever work arrives for the foreground.
I would infer ISRs as foreground from this, but YMMV. So, to google we
go: embedded+foreground. Entry number two points to
www.smxinfo.com/articles/lsr_art/lsr_art.htm where Ralph Moore, talking
about the smx RTOS says:
Foreground is another problematic word. For a large segment of the
IS world it means the operator interface, whereas background could
mean serial communications, and other potentially high-speed
activities. To me, this is a useless definition for embedded systems.
The foreground is what is most important and that is the
interrupt-driven, device-serving part of the system.
He provides a figure showing ISRs as foreground and tasks as background.
Entry eight points to www.ganssle.com/tem/tem86.pdf, where Jack Ganssle
quotes Perri Matthews:
The reason was that we were doing I/O accesses in our interrupt
service routines! So even though the foreground code was hosed,
the interrupts were still working and keeping the watchdog happy.
And later:
Then if the foreground code gets stupid, it will stop setting the
flag, and the background will eventually give up and let the WDT
do its thing to bring the system back on track.
He is using background to refer to ISRs.
I give up. I would choose foreground for ISRs since they do pre-empt
normal code. I will happily go back to _not_ using those two words in
relation to embedded systems! :-))
~Dave~