On Mon, Sep 14, 2009 at 4:57 PM, David Given <d...@cowlark.com> wrote:

> In fact, I find the OOM killer behaviour deeply suspect. I do not
> believe that randomly killing processes is *ever* the right thing to do
> on a reliable system, as it completely denies the application the
> ability to properly clean up after itself. What happens if the app is in
> the middle of a file operation at the time? You lose, that's what. (Not
> *everything* can be journalled.)
>

We don't randomly kill processes, we kill only things in the background
unless memory is getting extremely tight in which case we need to resort to
increasingly more valuable processes.

And yes, this absolutely denies the application the ability to clean up
itself.  More importantly, it denies the application the ability to delay or
prevent itself from going away, which is very key to the system being able
to keep itself running well, managing these processes, without the user
having to worry about it.


> If I was going to have overcommit enabled, I'd much rather have the
> allocation failures exposed to the application in the form of the
> appropriate signal when the application fails to access the page. SIGBUS
> ('bad memory access') would seem to be the suitable one here. That
> allows the application to catch it and do any applicable cleanup, and
> any application that doesn't care will be killed anyway.
>

There generally are no allocation failures happening, there is just the
system doing what it needs to do to prevent itself from getting into too low
a memory state and thus paging or otherwise not performing well.


> This would also have the advantage that you'd be much more likely to
> terminate the offending process; in my experience the OOM killer has a
> nasty tendency to home in on the wrong process. Hopefully that's been
> fixed in the Android patches.
>

We don't use the stock Linux out of memory killer, because it pretty
universally does the wrong thing.

If you want to understand how this part of Android works, you should first
read the docs on process management here:

http://developer.android.com/guide/topics/fundamentals.html#lcycles

-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting
-~----------~----~----~----~------~----~------~--~---

Reply via email to