ubuntu-phone team mailing list archive
-
ubuntu-phone team
-
Mailing list archive
-
Message #03990
Re: Catching CPU run-aways on Touch
-
To:
ubuntu-phone@xxxxxxxxxxxxxxxxxxx
-
From:
Colin Ian King <colin.king@xxxxxxxxxxxxx>
-
Date:
Thu, 05 Sep 2013 10:33:36 +0100
-
In-reply-to:
<CAOe9oG6ss1eyfhntRPWxebrcPfUxip8Ncx=V85g9atpDghL2=w@mail.gmail.com>
-
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130803 Thunderbird/17.0.8
On 05/09/13 10:23, Evan Dandrea wrote:
> Stuart Langridge brought up an interesting idea for this on IRC, which
> I'm copying here rather than having more side discussions:
>
> (10:13:20) aquarius: ev, just reading your thread about runaway
> processes on the touch mailing list (I'm not subscribed to the list,
> so there's no good way of replying), and I had a thought: it seems to
> be primarily about *accidental* runaways (I put an infinite loop in my
> code by mistake), and all the discussion is "how do we know if this
> process is actually accidental, or if it's deliberately using 100% CPU
> because it's properly
> (10:13:20) aquarius: busy doing a lot? The thought is: provide an API
> call yesIAmReallyBusy which you can call every few seconds while
> you're busy and then the runaway-killer will know you're not a runaway
> and will ignore you. This is how screensaver stuff works -- your
> movie-playing app calls "ignoreTheScreenSaverForAMinute" every minute,
> and then you don't have to worry about holding locks or anything, and
> if your app crashes the
> (10:13:20) aquarius: screensaver doesn't stay disabled.
> (10:14:22) Evan: aquarius: did you see cking's reply? It seems to be
> going down this route of "can we tell between accidental runaway and
> purposeful"
> (10:15:55) aquarius: ev, I did. The discussion is about being clever
> around trying to identify from outside the runaway process whether it
> is runaway or not, which is a useful thing to have if you can do it
> certainly. What I'm suggesting is making it explicit -- a system
> service should throw a yesIReallyAmBusy() into its high-CPU processing
> loop, and then we don't *have* to dwim it; we'll know.
> (10:20:32) aquarius: ev, I brought it up in case clever people like
> you and cking might say "we can't do that because $REASONS"; if you
> think it's worth bringing it up for discussion then I think that's a
> good idea. Two reasons I can see against it: the first is that if I
> drop yesIReallyAmBusy() into my main processing loop and that loop has
> a bug which makes it run infinitely by accident then I'm now immume
> from being killed, which
> (10:20:32) aquarius: is bad. Secondly, it suggests that if this comes
> to the desktop that things like Firefox would need to drop a
> yesIReallyAmBusy() all over the place, which they ought to do (because
> they want to be a good citizen on Ubuntu) but probably won't (because
> being a good citizen on Ubuntu isn't a big enough deal to them).
>
A "yesIAmReallyBusy()" API is open to abuse and I guess applications may
add in thread to do something like:
while (myAppIsRunning) {
yesIAmReallyBusy();
sleep(60);
}
..which leads to more wakeups and more battery suckage.
Follow ups
References