[Libct] Libct Queries - Service cgroup , process descriptor.

Andrew Vagin avagin at parallels.com
Thu Dec 18 07:23:51 PST 2014


On Tue, Dec 16, 2014 at 11:37:32PM +0000, Monali Porob wrote:
> Hi all ,
> 
>  
> 
> I needed some pointers regarding Service cgroup controller  and process
> descriptors  .
> 
>  
> 
> Qn1 :  I wanted to understand what use case is supported by the Service cgroup
> controller.

The Service cgroup controller is required when a container isn't
executed in a new pid namespace. In this case we need to have an ability
to get a process list which belongs to the container. And we use a
sevice group for this.

When a container is running in its own pid namespace, we can list all
processes in its pid namespace.

> 
> If I have read the test programs correctly looks like service cgroup controller
> is created by setting LIBCT_OPT_KILLABLE option. libct_container_kill() can be
> called on the associated container.
> 
>  
> 
> Qn2 : what is the purpose of the process descriptor (ct_process_desc_t) in
> context of libct . Why is it associated with a session  rather than a container
> .

A container is an isolated environment for processes.  The process
descriptor describes parameters which are independent from a container
configuration (cwd, caps, pdeathsig, uid, gid, groups, etc). The same
processes descriptor can be used for executing processes inside
several containers. It's a first reason why it is associated with a session.

Another reason is that the process descriptor describes parameters,
which are applied when a process is started, and they can't be changed
for existing processes. Any changes of existing descriptors don't affect
processes which have been started previously.

One more reason is that we can use several descriptors for executing
processes in one container, and we can use one descriptor for executing
processes in several containers.

> 
>  
> 
> Qn3 : If there are 2 containers in the same session , should there be two calls
> to the libct_process_desc_create(s);

No, it isn't required. You can use one for both containers.

> When testing the CPU controllers
> configuration for 2 containers ( each running stress program)  in the same
> session , passing the same process descriptor worked . However in which case
> would I need to create 2 process descriptors.

Sometimes you want to apply different parameters for processes and in
this case it may be convenient to have a few process descriptors.

> 
>  
> 
> Any info regarding this will help.
> 
>  
> 
> Thanks in advance .
> 
> Regards,
> 
> Monali
> 
>  
> 
>  
> 


More information about the Libct mailing list