TTY-based group scheduling
Posted Nov 18, 2010 19:20 UTC (Thu) by ccurtis
Parent article: TTY-based group scheduling
I'm fine with the tty-based approach personally, but it doesn't really seem ideal as more gui gets involved. Desktops - at the risk of portability - can integrate the feature, but what about another trigger?
I'm thinking of fork(): What about an approach like:
- Add a field to compliment 'nice', such as 'penalty'.
- Each time fork() is called, increment 'penalty' for the child.
- If the task gets reparented to init(1), clear the penalty.
- Schedule the task based on niceness + penalty.
This is just conceptual, of course. I imagine 'penalty' to be something like 1/10 or 1/8 of a 'nice', so the scheduler would use a value like (nice << 3 | penalty).
In the 'make + video' scenario, all the 'gcc' processes will have a penalty while the video will perform with higher priority. In the daemon scenario, they will be reparented and thus have their penalty cleared. I expect a 'renice' would also want to clear any penalties.
Now, this isn't the same as creating a cgroup automatically - but it does seem like the place to do this is within the shell. Or with a shell script as Lennart posted. But there may be another heuristic around fork() that makes more sense than simply the controlling tty.
to post comments)