mcm wrote in a message to Mike Bilow:
m> I agree that swap is practically a requirement. In my case,
m> I am building an embedded system that uses a flash drive to
m> store the system. I want to avoid swap space because I'm
m> concerned about aggressive swapping onto a device that has
m> a realistic limit to the number of write cycles before
m> failure. I'm writing application code that recognizes a
m> lack of available RAM as a soft error. My real concern is
m> that the kernel may have greater difficulty in handling
m> periods of low resources.
m> Any ideas regarding the tendency of the kernel to crash when
m> memory runs low?
I agree that swapping to Flash memory is not a good idea.
The kernel is, by definition, non-swapable. Probably the worst thing that
could happen is that you would have insufficient memory to load a module. If
possible, you might get better stability by avoiding the use of kernel modules
entirely, although this would lead to increased memory consumption and
decreased memory efficiency, so it is not an easy trade-off to make.
Because the kernel and drivers are generally not swapped or discarded, I would
not expect core functionality to go away in memory exhaustion. However, there
are many system level functions in userland, including much of the network
stack and services, which could be made to fail.
A worthwhile investment may be some sort of hardware watchdog, so that the
machine will at least be restarted if it wedges. At minimum, there is the
"softdog" driver which seems to work well. Finally, you can configure the
behavior of the kernel on panic so that it reboots rather than hangs.
-- Mike