Vidar is a fairly geeky guy who enjoys writing and using nifty software. He hopes this blog will present new niftyness to you, the adoring fans.
I represent a company for which I do some technical blogging for. I’ve stumbled upon your LINUX ATE MY RAM! page from the social networking sphere, and thought I’d ask permission to blog about this and link to your site.
I’ve encountered newbies hitting the same roadblock, wanted to explain the common misunderstanding and link to your site at the bottom of my blog post.
Is that okay with you?
Absolutely! Anything that increases awareness of the wonders of disk cache has my support.
Hi. Thx for your program : http://www.vidarholen.net/contents/junk/mandel.html
I have tried to run it. After make I have :
gcc -O9 -o mandel mandel.c -lpthread -lm -g -std=c99 -Wall -Werror
cc1: warnings being treated as errors
mandel.c: In function ‘calc_pixel’:
mandel.c:292: error: ‘drgb’ may be used uninitialized in this function
make: *** [mandel] Błąd 1
Can you help with it ?
My gcc 4.3.4-6 from debian doesn’t complain, but yours is right. Try simply editing the makefile and removing the word “-Werror” on line 4. Does that help?
Yes. It works fine. I have AMD turion 64 X2 and Ubuntu 64-bit and 2 GB RAM. What number of threads should I use ?
2 should be fine.
You are right. ( Why you use -j 3 ? ).
I have changed one function
and it works 2 time faster.
Congrats for your blog! I’ve been reading your “linux ate my ram” mini-blog Everythin ok, but I have one question. I have a server with 4GB ram, and memory monitored. I’ve observed that it always have enough memory (+/- buffers/cache line) with some graphs, but there are certain moments that the OS has needed a bit of swapping (only a few megs) but the free memory is always high. I’m pretty sure cause I generate memory graphs, and the amount of free memory is always high. What do you think about it?
The kernel can be configured to swap out unused applications to make room for more disk cache to speed up applications in use. The degree to which this is done is called ‘swappiness’, configurable in /proc/sys/vm/swappiness.
If swappiness is 0, the kernel will never swap out unused apps unless it’s completely out of RAM. If it’s 100, the kernel will frequently swap out unused apps to make room for disk cache to speed up in-use apps.
The default in Ubuntu is 60, so there you will sometimes see some swap use even with plenty of free memory.
Also, once something is swapped, it will just sit there until the memory is modified, freed or something else needs the swap space. This means that trace swap usage can be caused by a short memory spike long ago and/or of short duration (maybe shorter than your logging tool).
This is a sign of Linux’ effectiveness in not wasting work that has gone into writing pages to swap.
Fantastic Vidar. Great explanation
I really like your linux memory caching page and was wondering if I could upload it to and publish it to an internal network? I would of course credit your site.
Sure, anything to spread the page cache love!
Ignore the following captcha and enter 'bunnies' in the field instead.