> Now, if the user is playing this game, you want it to be scheduled. If > the user has put down their phone and the screen lock has kicked in, you > don't want it to be scheduled. So we could imagine some sort of cgroup > that contains untrusted tasks - when the session is active we set a flag

I would hope not, because I'd rather prefer my app that used the screento get the chance to save important data on what it was doingirrespective of the screen blank: "I have an elegant proof for thisproblem but my battery has gone flat"

(and I imagine we can play that examples game forever given Ashby's law)

> You can't express that with resource limits or QoS constraints.

I don't see why not. You just have to think about the problem from theright end. Start from "normality is well behaved applications" andprogress to "but I can constrain bogus ones".

So what are the resource constraints/QoS constraints for your example:

[Simplistically]

1. App says 'I want to wakeup from events for me within 1 second' (Because I like drawing cows at about that rate)2. App open driver for buttons3. App opens driver for screen

Driver for buttons goes 'humm, well I can trigger wakeup from all power states so I need no restrictions'. Screen will vary by device a lot.

(I'll come back to the screen a bit more in a moment)

So lets consider the same binary

App runs on OLPC like h/w

The pm code goes 'well I can suspend/resume in a second thats cool'The screen code goes 'Hey I've got OLPC like video so thats ok'The button driver can wake the system from suspend and queue an event

App runs on Android like h/w

The pm code goes 'well I can suspend/resume in a second thats cool'The screen code goes 'Gee the screen goes blank if I go below level X' so I'll set a limitThe button driver can wake the system from suspend and queue an event

Same app in each case and a lot less syscalls. No pathalogical caseseither - with suspend blockers you can get emergent synchronizationpatterns between applications where each app rarely blocks suspends buttogether their timings fall such that they never allow it. How do youpropose to even detect that ?

Ok now the screen

If I write to an X server and the server doesn't wish to talk to me itignores the stream and I block. This has been the case since the 1980s.

What is the problem here - your device driver for the display can blocktasks it doesn't want to use the display.