2011-01-17 06:28:32     Issues due to lack of MMU?

Document created by Aaronwu Employee on Aug 26, 2013
Version 1Show Document
  • View in full screen mode

2011-01-17 06:28:32     Issues due to lack of MMU?

Gilles Ganault (FRANCE)

Message: 97498   

 

Hello

 

I'm a self-taught developper and would like to make sure I understand what the issues are when deploying an appliance based on non-MMU CPUs like the Blackfin running uClinux:

 

1. An application can access any address in RAM, this will occur silently with no segfault.

 

=> Is there a way to sandbox applications, or at least, be notified that it tried accessing some part of RAM that was already used by another application?

 

2. If the application hasn't been rewritten to run on a non-MMU CPU and makes extensive use of malloc() instead of grabbing a big chunck of memory at start time and handling memory itself, the RAM will become increasingly fragmented as the application runs, and at some point, any call to malloc() will fail even though the required RAM is available in the absolute but is just too fragmented.

 

=> If an offending application is stopped and restarted, will uClinux reclaim the RAM that application used? If not, is rebooting the appliance the only solution to reclaim RAM?

 

=> Is there a way to keep an eye on RAM, and stop/restart an application that is causing RAM fragmentation?

 

3. When porting an application to a non-MMU CPU + uClinux, are there tools available to scan its source code and spot issues that might not be caught by the compiler (eg. use of fork() won't compile, but extensive use of malloc() will pass muster, etc.)?

 

... and any other issue I should know about?

 

Thank you for any help.

QuoteReplyEditDelete

 

 

2011-01-17 13:48:34     Re: Issues due to lack of MMU?

Mike Frysinger (UNITED STATES)

Message: 97503   

 

(1) this basic premise is semi-incorrect.  apps do not get access to NULL pointers, nor processor MMRs, nor can they access memory that does not exist.  all of these will trigger an error and the app will be killed.

 

if you want protection from the apps accessing each other's memory, then use the MPU.

 

(2) it depends on the memory patterns.  *large* allocations will most likely fail after the system has been running.

 

of course the kernel reclaims all resources allocated by the app when it exits.

 

you can watch an application's /proc/<pid>/map file, but i dont see that being useful.

 

(3) simply compile the application.  if a func is missing, you'll get a build failure.

QuoteReplyEditDelete

 

 

2011-01-17 17:34:46     Re: Issues due to lack of MMU?

Gilles Ganault (FRANCE)

Message: 97507   

 

> If you want protection from the apps accessing each other's memory, then use the MPU.

 

Thanks Mike. I found a bit of information about the MPU:

 

  en.wikipedia.org/wiki/Blackfin

 

  docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:difference_from_linux

 

> of course the kernel reclaims all resources allocated by the app when it exits. you can watch an application's /proc/ /map file, but i dont see that being useful.

 

I'll write a cron job to check use of RAM, and stop/restart rogue applications.

 

Thank you.

Attachments

    Outcomes