
Use Unnamed Semaphores in Shared Memory with sem_init
Use unnamed POSIX semaphores in a shared mapping with sem_init and pshared set to 1 to build a bounded producer and consumer buffer between forked processes.
Everything you need to level up your coding skills.

Use unnamed POSIX semaphores in a shared mapping with sem_init and pshared set to 1 to build a bounded producer and consumer buffer between forked processes.

Synchronize unrelated processes with named POSIX semaphores: sem_open, sem_wait, sem_post, a ping and pong example, sem_timedwait and sem_unlink on Linux 6.12.

Find and remove leftover System V and POSIX IPC objects with ipcs and ipcrm: read the tables, spot orphans by nattch, delete by id or key and clean /dev/shm.

Detect a missing system call by trying it once, treating ENOSYS and seccomp EPERM as absent, caching the answer and falling back, shown with close_range.

Send and receive messages between processes with POSIX message queues: mq_open, priorities, the mq_receive buffer rule, limits and cleanup on Linux 6.12.

Share memory between unrelated processes with POSIX shm_open, ftruncate and mmap, add a writer and a reader, and learn the cleanup with shm_unlink. Linux 6.12.

glibc wrappers are not thin pass-throughs. See how open becomes openat, exit becomes exit_group, fork becomes clone, and which calls never reach the kernel.

Compare Linux IPC options for beginners: pipes, FIFOs, Unix sockets, shared memory, message queues, semaphores and signals, and which fits which job.

The kernel returns -errno in the result register, and the C library turns values from -4095 to -1 into errno and a return of -1. See the raw path and the rules.

Get memory aligned to 32, 64 or 4096 bytes with posix_memalign or C11 aligned_alloc, learn their rules and error codes, and pick the right one for SIMD or DMA.

Compile with -fsanitize=address to catch heap overflows, use after free, double free and leaks, and learn to read the report that names the exact line.

A system call is the controlled jump from a user program into the kernel. See how write() becomes a syscall instruction, a number in rax and a return value.
We send one email when a new post is published. No spam.