what's the differences between Android LMK and Linux OOM

Viewed 1768

I understand that Android LMK is based on Linux OOM, but why should google develop a new algorithm (LMK)? Is LMK better than original OOM? Or there are some other technical reason?

1 Answers

You're right to think that they both have the same role, free memory (by killing applications) before system run out of memory. But, there is a subtle difference between the OOM and LMK algorithm that will decide which application to kill.

LMK will try to kill in priority background applications, hidden applications or paused applications (it is connected to the ActivityManager of Android to know who is running and who is not). This way, it will let user continue to use his current application and kill other apps. LMK most priority is to let user use smoothly his application. Secondly, LMK will in general avoid to kill system applications, preferring user applications and letting system running.

OOM will try to kill in priority applications that use most of the memory, without any concerns about the fact that this application was currently used by user, what OOM wants to do is to keep the whole system "safe" and running well (user ? who cares ? ;) ). Yet, it can decide to kill some system daemons that was useful for the system but was the biggest "memory eater". OOM killer algorithm is based on the oom_score which used to be computed on very complicated heuristics and is now mostly based on the memory percentage consumed.

Related