Mehdi Akiki

Posts tagged "linux"

  • Published on

    Investigation · Part 20 of 20 · When the benchmark lies

    A Benchmark Result Someone Else Can Check

    For the last part, I ran two earlier parts again with the same script. The assembly was identical, part 1 ran 10 to 14 percent faster, and the conclusions of both parts held. This is what a result must carry so that someone else can make the same check.
  • Published on

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

    How Each Thread Gets Its Own Copy of a Variable: Thread-Local Storage

    One _Thread_local variable, four threads, four copies at four addresses, and one instruction to reach each of them. I followed the fs register, the TLS segment, the access models of the ELF TLS document, their cost, and Rust's thread_local! in the disassembly.
  • Published on

    Investigation · Part 19 of 20 · What survives a crash

    Updating Several Files at Once With One Rename

    Two files saved safely one after the other are not saved safely together: a kill left a new config with old data 85 times in 300. A version directory and one symlink rename, or renameat2 with RENAME_EXCHANGE, switched both files at once in every test. LevelDB does the same with CURRENT.
  • Published on

    Investigation · Part 18 of 20 · When the benchmark lies

    The Benchmark Measured the Allocator

    A small formatting function took 52 ns per call with a new String and 38 ns with a reused buffer. A 256 KiB buffer cost nothing extra after the first call. And the contention that I saw with four threads came from my own allocation counter, not from malloc.
  • Published on

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

    How a Stack Overflow Is Detected: Guard Pages and Signals

    A C program that overflows its stack dies without a word, a Rust program prints a message. I overflowed both on purpose, in the main thread and in a new thread, and followed the limit, the guard page, the SIGSEGV, the alternate signal stack and the abort.