desktop entry proposal: TerminateSafe=true key

Lennart Poettering mzkqt at
Fri May 7 11:50:07 PDT 2010

On Fri, 07.05.10 14:14, Colin Walters (walters at wrote:

> On Fri, May 7, 2010 at 2:04 PM, Lennart Poettering <mzkqt at> wrote:
> >> In this scheme apps aren't asked.  Obviously we should terminate the
> >> least-recently-used apps from the user who has been inactive the
> >> longest.
> >
> > Well I am sure the kernel people think differently about that.
> Why?  Don't get me wrong, I don't think that's the best heuristic ever
> conceived.  To a large extent, I think we need to make some rough
> attempts and see what actually works in the field.

The OOM killer is an always hot topic in the kernel community. Finding
the "right" algorithm to kill processes on OOM is something many people
have spent lots of time on. 

The current algorithm is described here:

it's considerably more than just LRU, but there are other patches
floating around that implement different algorithms every now and then.

Also an interesting read is this text by the Qt folks:

They apparently use an increasing number of page faults as indication
that the machine is under memory pressure. Which in my opinion is utter
crack. It's weird what solutions people come up with to circumvent to
fix the kernel instead...

> But at the same time, the shell should be involved if something is
> terminated; we need to somehow explain to the user what happened.
> This will probably need to go down into heuristics - is it that the
> user is running too many apps?  Or that one app is using too much?
> Etc.

Yes, it would be good if waitid() could tell us that something got
killed by the OOM Killer, so that the shell could show an "Out of
Memory" warning or so.

Hmm, thinking about it we probably can distuingish OOM SIGKILL from
other SIGKILLs by checking for SI_FROMKERNEL in the siginfo_t. Unless
of course the kernel sends SIGKILL for more than just OOM reasons.

Hmm, thinking a little more about it the kernel sends SIGKILL on SAK
too, so I guess we cannot distuingish OOM killer SIGKILLs from SAK
SIGKILLs. Sniff. :-(


Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net           GnuPG 0x1A015CC4

More information about the xdg mailing list