
TCP vs UDP Choosing a Transport for Systems Code
Choose between TCP and UDP for systems code by weighing reliability, ordering, latency and framing, with a decision table and the cost of each option.
Tag
82 posts

Choose between TCP and UDP for systems code by weighing reliability, ordering, latency and framing, with a decision table and the cost of each option.

Write Linux systems code in Rust with compile-time ownership checks, safe syscall wrappers, and the exact boundary where unsafe remains necessary.

chroot only changes how a process resolves paths, while pivot_root swaps the mount namespace's root and lets you unmount the old one. Why containers need that.

Everything between exec and main in C on Linux: argv, envp and environ, getopt, the auxiliary vector, startup code, exit paths and passing a safe environment.

Read /proc/PID/cgroup to see which cgroup a process is in, then use systemd-cgls and systemd-cgtop to walk the whole tree and find a container's group.

How seccomp-bpf lets a process install a classic BPF filter that allows, blocks or kills on each system call, with the return actions and a working C example.

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.

Build container isolation by hand: Linux namespaces for what a process sees, cgroups v2 for what it may use, with C code for clone and pivot_root.

Use unshare and nsenter from a shell to create and join Linux namespaces, and watch hostnames, process lists and mounts change inside a new one.

Use setcap to give a binary only CAP_NET_BIND_SERVICE instead of making it setuid root, and see how the file capability bits change what the program can do.

Bundle a Linux program with its libraries in one folder that runs from any path, using an $ORIGIN runpath, ldd to collect dependencies and a launcher check.