Mehdi Akiki

Writing archive

Everything published under Writing, newest first. Each entry is labelled as part of an investigation, an article or reference. Short engineering notes have their own archive.

  • Published on

    Investigation · Part 17 of 20 · What survives a crash

    Writing Through mmap: Who Decides When Data Reaches the Disk

    I changed 64 MiB of a file without one write call, through a shared memory mapping. The pages became dirty like in the first part, kill -9 kept them, msync or fsync made them durable, and a truncated file killed my program with SIGBUS. The kernel decides the rest.
  • Published on

    Investigation · Part 17 of 20 · From source to a running process

    What a System Call Costs, and Why Some Calls Skip the Kernel

    On a performance core of my laptop a function call costs 0.6 ns, getpid as a system call 81 ns, and clock_gettime 14 ns through the vDSO but 108 ns as a real system call. I measured both kinds of cores, counted the calls with strace and dumped the vDSO.
  • Published on

    Investigation · Part 17 of 20 · When the benchmark lies

    Why Sorted Data Can Make the Same Loop Faster

    The famous result says that a loop over sorted data is faster because of branch prediction. In my Rust version, sorting changed nothing, because the compiler removed the branch. With a branch that it could not remove, random data was 3 to 10 times slower.
  • Published on
    An indirect prompt injection becomes an application-security incident when model output carries authority into tools. Limit capabilities, track provenance, and enforce policy outside the model.
  • Published on
    A scanner can inspect bytes efficiently and still drown in valid results. I explain output-sensitive cost, overlapping matches, allocations, callbacks, and bounded consumers in Rust.