Recently on the LKML there was a lot of excitement when a nearly 200 line patch to the kernel was posted which grouped CPU scheduling to each TTY. This alone improved interactivity hugely, enabling people to do crazy things like 'make -j64'ing kernels whilst playing movies and browsing the web all at the same time. A little later in the thread a four line shell implementation was given that improved things even further.
So, to try and find a well blended solution, I opted to put together a shell daemon that groups tasks firstly by User ID (regular users on the system, ignoring system processes) and then with a second level of grouping by Session ID.
Download is available at https://github.com/jimdigriz/iesd
The daemon should work on kernels since 2.6.24 (tested with 2.6.32) supporting grouping CPU scheduling, and if your kernel is equal or newer than 2.6.38 it also has the ability to group task disk IO which improves things further (not done by sched_autogroup_enabled).
Save the daemon to '/usr/local/sbin' and make it executable ('chmod +x /usr/local/sbin/iesd'). Now run it by typing as root:
# iesd start
Stopping the daemon is easy:
# iesd stop
N.B. the daemon takes a while to start up and shutdown, so do not expect the effects to take place immediately
To make the daemon automatically load on boot, place the following in your '/etc/rc.local' file (TODO: use runit instead):
[ -f /proc/sys/kernel/sched_autogroup_enabled ] && echo 0 > /proc/sys/kernel/sched_autogroup_enabled nohup /usr/local/sbin/iesd start || true
Thanks to Steven Capper (@robotmonkeys.org.uk) for testing, giving feedback and suggestions plus providing some actual improvements; the 'brains' behind the 'quit()' subroutine.