LabVIEW Real-Time SMP Utility VIs
Most users interact with cgroups using LabVIEW Real-Time symmetric multiprocessing (SMP) utility VIs. These VIs assign which CPUs can participate in automatic load balancing and indicate the distribution of load across the CPUs of the real-time device. Find more information on these VIs in the LabVIEW Real-Time help documentation:
LabVIEW Real-Time SMP Utility VI Help
These VIs directly affect the control groups in the cpuset subsystem. Specifically, the RT Set CPU Pool and the RT Set CPU Pool Assignments VIs affect the cpus file of the specified control group. If a cpu is available for automatic load balancing, the cgroups include that specific cpu core in their cpus files.
Note: The LabVIEW Scan Engine cgroup cannot be controlled with these VIs.
Assigning Threads to Existing Control Groups
To assign tasks to currently running control groups, a developer can use the echo command to write the thread ID to the tasks file of the associated cgroup:
# /bin/echo PID > tasks
Note that the /bin/echo should be used instead of the bash echo command because the /bin/echo command provides errors for every write() command unlike bash echo. Also, only one thread can be attached to a control group with each command.
Mounting Additional Subsystems
More often than not, a developer wants to use a subsystem other than the two provided by default on Linux Real-Time, cpuset, and cpuacct. In this case, the developer needs to make some modifications to the Linux kernel to enable the desired subsystems for mounting.
Recompiling the NI Linux Kernel
First, the user needs to download the NI Linux kernel from the GitHub repository
NI Linux Kernel GitHub© Repository
After downloading the repository, the user can edit the .config file with a kernel configuration tool such as menuconfig.
|cpuset (CPU Affinity)
|memory (Memory Usage)
|blkio (I/O Access)
|cpuacct (CPU Accounting)
|devices (Device Usage)
|net_cls (Network Accounting)
|net_prio (Network Prioritization)
|freezer (Task Suspension)
|cgroup (CPU Scheduler)
After editing the .config file to include cgroups, the user should be able to proceed with the compilation of the Linux kernel as listed in the guide.
Mounting Enabled Subsystems
After the subsystems have been enabled in the .config file and the kernel has been recompiled, mounting and using the subsytems should follow the standard cgroups functionality published by Kernel.org:
Kernel.org cgroups Documentation
The registered trademark Linux® is used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a worldwide basis.