
Limit Memory and CPU With cgroups v2
Create a cgroup v2 directory, write memory.max and cpu.max, move a shell into it and watch the kernel cap memory and CPU time. Commands and output included.
Tag
445 posts

Create a cgroup v2 directory, write memory.max and cpu.max, move a shell into it and watch the kernel cap memory and CPU time. Commands and output included.

Learn real, effective and saved user IDs, what setuid does at execve, and the correct order to drop privileges in C with setgroups, setgid and setuid.

Convert MOV, MKV, AVI or WebM files to a widely playable MP4 with H.264 video and AAC audio using one FFmpeg command, and learn what each option does.

Write a TCP client in C that calls socket and connect, sends a request, reads the reply until the server closes, and handles errors on Linux.

Move blocking calls and heavy computation off Tokio's worker threads with spawn_blocking so one slow task cannot stall every other task on the runtime.

Build a DBG macro in C23 with GCC 14 that prefixes every debug line with __FILE__, __LINE__ and __func__, writes to stderr and compiles away in release builds.

Compile and run a first COBOL program on z/OS with the IGYWCLG cataloged procedure, with the JCL, the compiler options, the output and the return codes to read.

NUMA gives each CPU socket its own local memory, so a core reads its own memory fastest and pays extra to reach another socket's. Learn why and how to see it.

List GPIO chips with gpiodetect and read every line's name, direction and consumer with gpioinfo from libgpiod 2.1 on Linux 6.12, then pick the line you want.
A32, Thumb and Thumb-2 are three ways to encode ARM instructions. See how they differ, which one a Cortex-M runs, and how to read the encodings in objdump.

A Zephyr application is a CMakeLists.txt, a prj.conf, a src folder and optional board files. See what each file does and how a build combines them.

Learn how DMA controllers move data without the CPU, from memory copies to ADC, UART and timer transfers, on STM32, RP2040 and ESP32, and the pitfalls to avoid.