EmbeddedRelated.com
Forums

Memory management in embedded linux

Started by Unknown July 13, 2005
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

vinaynk@gmail.com wrote:
> 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??
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.
> Is MMU used in such embedded devices? Can we have a system where MMU is > enabled but demand-paging/swapping is disabled ?
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.
> Just how does the whole thing work in embedded Linux system like a > mobile phone????
I've never built a mobile phone, and if I did I doubt I'd run Linux on it. Kelly
On 2005-07-13, Kelly Hall <khall@acm.org> wrote:

>> 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?? > > If you don't have any swap enabled, then you don't have to > worry about pages gone missing.
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.
>> Is MMU used in such embedded devices? Can we have a system >> where MMU is enabled but demand-paging/swapping is disabled ? > > 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.
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
vinaynk@gmail.com wrote:
> 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????
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
Tauno Voipio <tauno.voipio@iki.fi.NOSPAM.invalid> wrote in news:GfdBe.238
$k51.137@read3.inet.fi:

> Did you read the pretty comprehensive responses in the > Linux group for exactly the same question?
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...
Niels Kristian Jensen wrote:
> Tauno Voipio <tauno.voipio@iki.fi.NOSPAM.invalid> wrote in news:GfdBe.238 > $k51.137@read3.inet.fi: > > >>Did you read the pretty comprehensive responses in the >>Linux group for exactly the same question? > > > 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) >
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: vinaynk@gmail.com Newsgroups: comp.os.linux.embedded Subject: Memory management in embedded Linux Date: 12 Jul 2005 09:05:53 -0700 Organization: http://groups.google.com Lines: 20 Message-ID: <1121184353.220725.323730@g47g2000cwa.googlegroups.com> 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: groups-abuse@google.com NNTP-Posting-Date: Tue, 12 Jul 2005 16:05:58 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@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
Tauno Voipio <tauno.voipio@iki.fi.NOSPAM.invalid> wrote in
news:4UsBe.138$3J3.26@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) >> > > comp.os.linux.embedded, headers:
Thank you very much, Tauno. Best regards, Niels Kristian Jensen
Niels Kristian Jensen wrote:
> Tauno Voipio <tauno.voipio@iki.fi.NOSPAM.invalid> wrote: > >> Did you read the pretty comprehensive responses in the >> Linux group for exactly the same question? > > 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)
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