[lxc-devel] Cgroups

Rayson Ho raysonlogin at gmail.com
Mon Jul 25 03:02:39 UTC 2016


On Sun, Jul 24, 2016 at 9:21 PM, Akhileshreddy Baddigam
<qlb680 at my.utsa.edu> wrote:
...
> I need to know how the LXC containers uses cgroups to share resources at the
> code level i have been going through this
>
> https://github.com/lxc/lxc/blob/9afe19d634946d50eab30e3b90cb5cebcde39eea/src/lxc/cgroup.c

That's an older version of cgroup.c , BTW.

The most interesting function IMO is lxc_cgroup_enter(), which
attaches a process to cgroups by writing the PID to "%s/%s/tasks", and
relies on the Linux kernel's cgroup functionality to enforce resource
consumption of the process in the cgroups.

Refer to the older cgroup doc:

https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt

The Linux weekly news has some useful articles on cgroups:

https://lwn.net/Articles/604609/

That's also how we attach a process in the Open Grid Scheduler / Grid
Engine cgroup integration, which was implemented back in 2012:

http://blogs.scalablelogic.com/2012/05/grid-engine-cgroups-integration.html

Rayson

==================================================
Open Grid Scheduler - The Official Open Source Grid Engine
http://gridscheduler.sourceforge.net/
http://gridscheduler.sourceforge.net/GridEngine/GridEngineCloud.html




> Can any one help me the starting point to analyse the cgroups code in the
> containers!
>
> where do i need to start in order to understand the code of c groups !
>
> Thank's in advance for taking time to help me.
>
>
>
>
>
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel
>


More information about the lxc-devel mailing list