Having each application in it's own scope brings numerous advantages:
- PIDs are very yesteryear, a modern application has a tonne of
processes. We want some sort of logical grouping in ksysguard.
We have a working version of this.
It also can resolve the case of correctly matching the
audio indicator to the correct application in the task manager.
Something that has been proven to not work reliably by tracking parent
PIDs.
- We can use the cgroup freezer controller on plasma-mobile to suspend
background processes.
- We want to put things into the correct slice.
Future systemd will split user.slice into 3 subslices, background
services, apps and chrome (with chrome being plasmashell and kwin in our
case). Putting applications in the correct slice will bring pre-bumped
niceness levels.
- We also can expose cgroup resources limits
- Things get cleaned up logout without relying on xsmp.
This is analogous to Gnome's recent change:
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/863/diffs
It was also discussed in person at a very-mini meeting at FOSDEM with
both systemd and gnome people.
Task T12678
If a relevant cgroup controller (systemd) is not running, this simply
no-ops without issue.
In addition things are guarded by an environment variable so we don't
introduce any behavioural changes to released Plasma's.
This change is incredibly minimal by launching as normal and then
tagging afterwards. It's a bit of a chicken and egg scenario as we merge
the intended usages of this change.
After things are established we will want to move spawning the
application to be responsiblity of the cgroup controller as transient
services rather than transient scopes. It will be more "technically
correct" and allow even more features such as improved logging.