ArshiA AkhavanBlog
Blog
Notes on systems, programming languages and whatever I'm reading. Most posts were first written in Persian on my Telegram channel and translated to English here.
- How efficient is the networking stack, really?
I add up the header and footer overhead of every layer, from HTTP down through TCP, IPv4 and Wi-Fi 5, to see how many bits actually go over the network when you send a single byte.
- A multithreaded bug challenge
A simplified version of a multithreaded bug that took me almost half a day to find, posed as a challenge: find the interleaving that makes the assertion fail.
- Trimming quotes in Rust: char patterns vs. &str patterns
Copilot suggested trimming a quote with a &str pattern, but a char pattern is the better fit. A quick look at why, and at why Copilot might reach for double quotes in the first place.
- Linus Torvalds on threads, processes, and tasks
A short note on a message from Linus explaining that, as far as Linux is concerned, there are no threads or processes, only tasks that share parts of their context of execution.
- A C preprocessor puzzle from a job interview
A C preprocessor puzzle that was an interview question at one of the companies around here. I solved it and had fun, so here it is for you to try.
- Why Android's calculator gets 10^100 + 1 - 10^100 right
Apple's calculator says 10^100 + 1 - 10^100 is 0, while Android's says 1. I went digging into why: floating-point precision on one side, and Boehm's mix of exact rationals and lazily computed reals on the other.
- Computing floor(log2(n)) with CLZ
A short note on the CLZ and BSR instructions and how they let you compute floor(log2(n)) without actually computing a logarithm, in C and in Rust.
- The Oxford Murders and the idea of a perfect murder
Some thoughts on Guillermo Martínez's The Oxford Murders, which I read in Persian translation: what it does with the idea of a perfect murder, plus a story-within-the-story about a king and a statue.
- Starting with model checking: notes on Katoen's lectures
I'm starting to firm up my knowledge of verification. Here are my notes on the first few lectures of Katoen's model checking course: program graphs, transition systems, and the road to LTL.
- Building Git in Rust: notes from the CodeCrafters challenge
I did the CodeCrafters Git challenge in Rust. These are my notes on the parts I found most interesting: Git's object storage, its plumbing commands, and packfiles.