Memory management in embedded linux

Hello

I am little confused about the memory managent in Embedded Linux. My understanding is that, one of the properties of embedded OS it predictability. And the demand-paging/swapping is something that brings in un-predictability.

But in practical situations how is demand-paging handled in embedded linux ? Is it disabled? Are all the pages needed by a process loaded earlier itself??

Is MMU used in such embedded devices? Can we have a system where MMU is enabled but demand-paging/swapping is disabled ?

Just how does the whole thing work in embedded Linux system like a mobile phone????

thanx Vinay

Reply to
vinaynk
Loading thread data ...

If you don't have any swap enabled, then you don't have to worry about pages gone missing. On the other hand, if something tries to allocate more memory than is physically available, malloc will fail and the code will have to deal with that failure gracefully.

In the Linux systems I've developed we generally had MMUs built in to the CPU. We rarely configured any swap space, and sized system RAM much larger than our worst-case memory needs.

In the one box where there was swap enabled, we actually allocated a small ram disk and then swapped to that. Crazy, yes, but we were working around a bug in the Linux 2.2.18 (?) VM routines - that code really really expected to have swap available even if it never used it.

I've never built a mobile phone, and if I did I doubt I'd run Linux on it.

Kelly

Reply to
Kelly Hall

I think you still have to worry about demand-paging as executable pages are read from "disk" as page faults occur. Of course, there are ways to get around that by pre-loading and then locking a process in memory.

If you're using a RAM disk, is the kernel smart enough to use read-only (e.g. text segment) pages from the file "in-place"?

There will also be page-faults due to copy-on-write attributes on data and bss pages in newly forked processes.

Same here. The examples I'm thinking of booted from Compact Flash and didn't have swap enabled.

--
Grant Edwards                   grante             Yow!  RELATIVES!!
                                  at               
                               visi.com
Reply to
Grant Edwards

Did you read the pretty comprehensive responses in the Linux group for exactly the same question?

Next time, please, cross-post instead of multi-posting, and think twice about the proper groups.

For the group: the OP got good answers, but he seems to ignore them.

--

Tauno Voipio
tauno voipio (at) iki fi
Reply to
Tauno Voipio

Tauno Voipio wrote in news:GfdBe.238 $ snipped-for-privacy@read3.inet.fi:

Which "the Linux group" are you refering to?

(I'd like to read the responses too and a quick google search didn't turn up any responses from you)

--
DYT ikke ved E-mail...
Reply to
Niels Kristian Jensen

comp.os.linux.embedded, headers:

Path: read3.inet.fi!central1.inet.fi!nntp.inet.fi!inet.fi!fi.sn.net!newsfeed2.fi.sn.net!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.bit.nl!newsgate.newsserver.nl!feeder.z74.net!news.z74.net!news.glorb.com!postnews.google.com!g47g2000cwa.googlegroups.com!not-for-mail From: snipped-for-privacy@gmail.com Newsgroups: comp.os.linux.embedded Subject: Memory management in embedded Linux Date: 12 Jul 2005 09:05:53 -0700 Organization:

formatting link
Lines: 20 Message-ID: NNTP-Posting-Host: 203.126.136.223 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1121184358 6148 127.0.0.1 (12 Jul 2005

16:05:58 GMT) X-Complaints-To: snipped-for-privacy@google.com NNTP-Posting-Date: Tue, 12 Jul 2005 16:05:58 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: snipped-for-privacy@google.com Injection-Info: g47g2000cwa.googlegroups.com; posting-host=203.126.136.223; posting-account=8SwinQ0AAABOURbIydqKMTXeq7eC-swW Xref: central1.inet.fi comp.os.linux.embedded:7233
--

Tauno Voipio
tauno voipio (at) iki fi
Reply to
Tauno Voipio

Tauno Voipio wrote in news:4UsBe.138$ snipped-for-privacy@read3.inet.fi:

Thank you very much, Tauno.

Best regards, Niels Kristian Jensen

Reply to
Niels Kristian Jensen

One more reason not to rely on Google for Usenet. I understand they can't handle cross-posts at all. The articles just disappear from all but one group.

--
"If you want to post a followup via groups.google.com, don't use
 the broken "Reply" link at the bottom of the article.  Click on 
 "show options" at the top of the article, then click on the 
 "Reply" at the bottom of the article headers." - Keith Thompson
Reply to
CBFalconer

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.