LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   memory command details (https://www.linuxquestions.org/questions/linux-general-1/memory-command-details-323744/)

ilnli 05-15-2005 12:50 PM

memory command details
 
Following is the output of my "free" command

Code:

root@darkstar:/usr# free -m
            total      used      free    shared    buffers    cached
Mem:          123        120          2          0          1        18
-/+ buffers/cache:        100        22
Swap:            0          0          0

every thing looks fine, I have 128 mb of ram and swap is disabled but I can't understand from where "buffers/cache" memory came from?

wapcaplet 05-15-2005 05:41 PM

I can't answer for why the output of 'free' is so cryptic, but I can tell you that the "buffers/cache" line shows your actual used/free memory. So in your output, you have 100MB used and 22MB available.

The top "Mem" line has something to do with memory that is allocated, but not actually being used, which is why it shows less free memory. You can usually ignore that line.

syg00 05-15-2005 05:58 PM

Do some searching - this comes up all the time.
128Meg and no swap - brave lad.

From a post a little while ago, think of buffers as "in-flight" data. Cache is disk cache - helps alleviate hard disk latency.
Fluctuates based on demand for pages from applications - as demand goes up, the cache shrinks.

Leads to high storage occupancy, but in the Linux world this is considered a good goal.

ilnli 05-17-2005 08:19 AM

no I want to say I have just 128 mb ram.
then where the buffer is stored?

foo_bar_foo 05-17-2005 04:17 PM

buffer mapps a file descripter into a series of virtual memory locations making tranparent i/o
exactly as syg00 said
but it's important to read virtual here
linux memory use is multilayered and as far as i know all that is returned on creation of a buffer is a pointer to one or more virtual not actual memory pages that are then mapped to actual memory in another lower layer array. The virtual memory space for 32 bit processors is 4gb wide 1 gb kernel space and 3 gb user space. you only have 128mb of ram so exactly what pages are actually in physical ram and what of that physical ram is then being cached by the cpu mmu pipes and what pointers to pages are being cached or buffered at each instant is something that can only be determines by debuggers and what not.

short answer: why bother thinking about "where" the buffer is. It lives in software.


All times are GMT -5. The time now is 02:19 AM.