[LUAU] Running a standard distro without swap space

Jim Thompson jim at netgate.com
Wed May 11 23:54:47 PDT 2005


On May 11, 2005, at 6:52 PM, Angela Kahealani wrote:

> On Wed, 2005-05-11 14:37, Charles Lockhart wrote:
>> Sorry, I meant to say with no swap space at all, not just without a
>> swap partition.
>
> Many embeded Linux distros use only real RAM, not virtual RAM,

you are perhaps referring to 'uClinux' .vs linux.  The former being 
'linux for systems
without MMUs', though even thats not true any more, given that most of  
'uClinux' is now
part of the 'normal' kernel tree.

(Nearly) the only reason to turn off support for the MMU is that you 
don't have one.  Most modern
SoCs implement a MMU.

Also, note that swapping != virtual memory.   Swaping was part of the 
original Unix design, long before
the requisite hardware support showed up to enable 'virtual memory'.   
Back then, if you were running
out of memory, the kernel would swap out entire processes to the swap 
area.   These days the kernel
will first try to put cold dirty pages into the swap area.  See 
previous message.

> and have no swap... you may have to recompile or even recode some
> applications to not expect virtual memory.

Most applications can't tell the difference.
http://www.uclinux.org/pub/uClinux/FAQ.shtml

Q.      Does uClinux support multitasking? What limitations are imposed 
by not
         having a MMU?

A.      uClinux absolutely DOES support multi-tasking, although there 
are a
         few things that you must keep in mind when designing programs...

          1. uClinux does not implement fork();  instead it implements 
vfork().
             This does not mean no multitasking, it simply means that the
             parent blocks until the child does exec() or exit(). You 
can still
             get full multitasking.

note that most uClinux systems 'emulate' fork() as vfork().

          2. uClinux does not have autogrow stack and no brk(). You need 
to use
             mmap() to allocate memory (which most modern code already 
does).
             There is a compile time option to set the stack size of a 
program.

note here that there is a trivial malloc() library that uses mmap().

          3. There is no memory protection. Any program can crash another
             program or the kernel. This is not a problem as long as you 
are
             aware of it, and design your code carefully.

          4. Some architectures have various code size models, depending 
on how
             position independance is achieved.

See also:

http://www.cyberguard.info/snapgear/tb20020530.html




More information about the LUAU mailing list