[PLUG] Kernel 2.6.38 : process grouping by session

Ghodechhap ghodechhap at ghodechhap.net
Sun Mar 20 23:15:45 IST 2011


On Sunday 20 March 2011 13:10:20 Mayuresh wrote:
> http://kernelnewbies.org/Linux_2_6_38
> Process grouping by session sounds interesting among the features...

That feature is available in userspace for plenty of time.

following script can be used to launch a process(firefox say) in a separate 
session group with cgroup mounted on /cgroup.
------------
#!/bin/bash
mkdir -p -m 0700 /cgroup/user/$$
echo $$ > /cgroup/user/$$/tasks
echo "1" > /cgroup/user/$$/notify_on_release
$*
------------

for background processes, following can be used in ~/.bashrc
------------
if [ "$PS1" ] ; then
        mkdir -p -m 0700 /cgroup/user/$$
        echo $$ > /cgroup/user/$$/tasks
        echo "1" > /cgroup/user/$$/notify_on_release
fi
------------

2.6.38 automates the feature where processes attached to single tty are 
automatically grouped together.

systemd has/supposed to have support for launching services in their own 
cgroups, thus allocating cpu/memory/other resources specifically for a given 
service.

cgroups are also useful for managing containers. 

very useful piece of technologies, slowly making into the mainstream :)


-- 
Regards
 Shridhar



More information about the Plug-mail mailing list