Home > Linux > If I can’t, why kernel can? :(

If I can’t, why kernel can? :(

Justice Is Lost
Justice Is Raped
Justice Is Gone
Pulling Your Strings
Justice Is Done
Seeking No Truth
Winning Is All
Find it So Grim
So True
So Real
(Metallica – And justice for All)

When I was a little boy, my dad thought of one thing I am very proud of. Never promise something you cannot fulfill. I tried to live by that principle, and I think I mostly succeeded. OK, I promised a girl or two a marriage, and then I broke up, but that kinda doesn’t count? Anyway, when I was 5 yearold, that seemed to me like a very logical thing. But now, 20 years later, I kinda question this approach. Why?

Here’s why. Linux kernel has memory overcommit behavior set as default. What is overcommit? Overcommit is ability to give more resources than you have. Something like what we call crediting in real world. So, here comes Kernel, and allows processes to allocate more memory than is currently free and avaliable in the system. So, basically, Kernel is crediting processes and boosting economy (whoops, boosting enviroment I suppose). As well as our economy collapsed because it is dept based, and credit based – so will the OS enviroment eventually.

Lets take an example. Our computer has 2GB’s of RAM, and 300MB free. My nasty application asks kernel if it can allocate 1GB. On a good OS, like Solaris, kernel would slap my nasty application all over the place! Acctually no, it would only said – you’re asking too much, I can’t answer on that demand. So application would probably crash if it was written poorly. On Linux however, kernel thinks it’s much better than that ugly Solaris. And wants to please everybody, and likes it’s popular. Linux kernel is an ego tripper. So it promises things it cannot fulfill for surely. So my nasty program gets it’s 1GB of memory. And then it starts using it… 100MB. 200MB. 300MB. Whooops. There’s no more memory available. But now our mr. ego tripper activates OOM – a fantastic superhero who goes out and gets some more memory for my nasty program. That fantastic hero then kills almost randomly processes who use lots of memory. In production environment, that would probably end up being your database. Or httpd. Or maybe both : ) And now everybody is happy. My nasty app does not have bad opinion about Linux kernel because it was granted all it wanted, Linux kernel grows it’s ego exponentially because of that, and because it showed that impolite database who’s a boss around here.

Things shouldn’t work like that on an enterprise level OS, should they? Or I got it totally wrong… Maybe I should ask my father – if kernel can promise more than it has, why can’t I? He will probably answer me something like – “Well, our goverments thought they were Linux kernel, and look in what mess that got us into.” So I guess I was right all along (as always), and the right to overcommit, or overpromise, or credit, is granted only to Linux kernel. Some days I’m really glad to be a Solaris convert : )

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: