Linux - Embedded & Single-board computerThis forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
We have an embedded system here, where we are running everything from RAM. We use CPIO file systems that get loaded into RAM as part of the Kernel image and is mounted as a ramdisk.
Our system has 128M of RAM. We "remove" from the system ~ 28M that we map (physically) for certain needs. That leaves Linux with ~ 100M. When our applications run (and loads libraries/modules, etc), "free" reports how much is used: ~ 44MB.
Yet, I still have a File System occupying Memory that does NOT see to get reported by "free". The uncompressed File system image is ~ 23M
My questions are:
1. How can I determine how much RAM is used by the File System? This would, I believe, need to be added to the "used" memory reported by "free" to determine "total memory used" in the system.
2. Why does free NOT report how much is used by the Filesystem? Since it needs to be there, one would think that it needs to be reported. I find the current "free" implementation to be flawed in this way, since this does reside in memory.
In systems where one mounts the file system on a disk, then yes, I would agree that free reports memory usage accurately.
3. If my application started to use up more memory, at what point would I expect to run into trouble? For example:
Avail Mem = 100M
FileSys = 25M
Running kernel/modules/drivers/libs/apps = 50M
In reality, of 100M, I "really" only have 75M since my FS resides in RAM. So using 50/100 is 50% used where as 50/75 is 67% used, BIG difference.
Would my app be able to use up to 75M or would it use up to 100M? What happens to the FS? Wouldn't something get overwritten? Would the kernel crash, or maybe die gracefully?
I know that the FS won't grow beyond what gets specified when it's built.
TIA for your insights into this, it is greatly appreciated.
It's not that simple. free is a little out of date, iirc, and the figures are not 100%
In windows, a program starts and says "I want 4 megs, 1 now and the rest soon"; windows replies: "Here's 4 megs"
The program might use 500k and windows crashes because it has no memory left :-).
In linux it's more like I want 4 megs! 1 now, and the rest soon
The kernel says 'start writing there. it uses 500k
before long there's many programs all thinking they have ram in the same place. when the second one actually write to it - linux puts whatever the first wrote somewhere else, different ram or swap. It keeps buffers to smooth this.
free according to the docs, no longer keeps up accurately with the sleight of hand of the kernel and misreports the buffers or can do so.