[Ilugc] why embedded Linux not having swap partition.

  • From: rajasuperman@xxxxxxxxx (Raja Subramanian)
  • Date: Wed, 28 Mar 2012 16:24:49 +0530

On Wed, Mar 28, 2012 at 3:45 PM, Zico <mailzico at gmail.com> wrote:

I am sorry, but, what does it means by "access times are non deterministic"?
Pardon me, I don't have any knowledge on Embedded system architecture. :)

"non deterministic" is CS lingo for unpredictable. Assume you are accessing
a memory address, if it's in physical RAM you can read/write it in a few nano
seconds. But if the kernel has moved this page to swap it takes
several milliseconds
to access the page and the response time of your application suffers.

Unix kernels offer the ability for user land processes to lock memory pages in
physical RAM and ensure they are never paged out to swap. This syscall requires
root privilege and apps like cdrecord use it to lock its buffers in
physical RAM.
See mlock(2) and friends.

To the OP:
Memory management unit of an ARM core is typically 30% of die area, eliminating
the MMU will therefore reduce cost. Simpler 8/16bit microcontrollers do not have
any MMU and use only physical memory addressing throughout. Sacrificing the
convenience of a virtual addressing is one of the trade-offs an
embedded programmer
has to live with. Since embedded environments are carefully controlled and runs
no 3rd party applications it may not be a hard choice. See uclinux.org.

On the opposite end, ARM Cortex A15 cores have added a lot of features so they
can be used in servers. Eg. LPAE to support 1TB RAM, hardware
virtualization, etc.

One correction - Disabling kernel swap support is not just for embedded systems,
I'm pretty certain you can configure any Linux kernel (x86/ppc/etc)
without support
for swap. It's in the kernel menuconfig options.

- Raja

Other related posts: