Sign in

Abhinav Upadhyay

@abhi9u.bsky.social
1.4K followers 134 following 119 posts

NetBSD Dev | Python Internals, AI, compilers, databases, & performance engineering | blog.codingconfessions.com

PostsRepliesMedia
Abhinav Upadhyay @abhi9u.bsky.social · 16/05/2026
I wrote a 60-page mini-book on Virtual Memory. Going from what it is, through page tables and down to advanced topics like copy-on write, demand paging, TLB shootdowns, NUMA placement, page reclamation algorithms. blog.codingconfessions.com/p/virtual-me...
1102
Abhinav Upadhyay @abhi9u.bsky.social · 22/12/2025
I recently explored how DL frameworks leverage the parallel cores in the GPU to generate random numbers in parallel.
110
Abhinav Upadhyay @abhi9u.bsky.social · 21/09/2025
System calls are the interface between the user space and the kernel. They are needed for fundamental things like reading a file, and making a network call. But they are also very expensive because they need to do things like saving/restoring registers, page table, stack.
121
Reposted by Abhinav Upadhyay
Teiva Harsanyi @teivah.dev · 16/09/2025
What Makes System Calls Expensive: A Linux Internals Deep Dive. blog.codingconfessions.com/p/what-makes... Another great post by @abhi9u.bsky.social. I learned a lot, including vDSO.
blog.codingconfessions.com
What Makes System Calls Expensive: A Linux Internals Deep Dive
An explanation of how Linux handles system calls on x86-64 and why they show up as expensive operations in performance profiles
0158
Abhinav Upadhyay @abhi9u.bsky.social · 13/07/2025
People talk about profiling to find bottlenecks, but no one explains how to fix them. Many devs shoot in the dark and when the optimization backfires, they aren't sure how to proceed.
131
Abhinav Upadhyay @abhi9u.bsky.social · 21/05/2025
Skipping computer architecture was my biggest student mistake. Hardware’s execution model dictates memory layout, binaries, compiler output, and runtimes. If you want to build systems, learn how the CPU works. I wrote an article on this: blog.codingconfessions.com/p/seeing-the...
021
Abhinav Upadhyay @abhi9u.bsky.social · 12/04/2025
Here’s a fun visual showing how len() finds the length of a list in Python. The size is stored right inside the object, but len() takes a five-pointer detour, only to land back where it started. This is why if not mylist is ~2x faster for emptiness checks!
162
Abhinav Upadhyay @abhi9u.bsky.social · 28/03/2025
When you see an expert optimize a piece of code, it may look like dark magic. In reality, these experts have a deep understanding of the entire computing stack, and when they look at an application profile, they quickly understand the bottlenecks.
120
Reposted by Abhinav Upadhyay
Abhinav Upadhyay @abhi9u.bsky.social · 19/01/2025
How do you fit a 250kB dictionary in 64kB of RAM and still perform fast lookups? For reference, even with gzip -9, you can't compress this file below 85kB. In the 1970s, Douglas McIlroy faced this exact challenge while implementing the spell checker for Unix at AT&T.
1157
Reposted by Abhinav Upadhyay
Suvash Thapaliya @suva.sh · 24/03/2025
The second post is by @abhi9u.bsky.social on some common CPU architecture concepts (instruction pipelining, memory caching &speculative execution). Abhi has done a great job with the analogies in this one. blog.codingconfessions.com/p/hardware-a...
blog.codingconfessions.com
Hardware-Aware Coding: CPU Architecture Concepts Every Developer Should Know
Write faster code by understanding how it flows through your CPU
221
Reposted by Abhinav Upadhyay
Teiva Harsanyi @teivah.dev · 21/03/2025
Hardware-Aware Coding: CPU Architecture Concepts Every Developer Should Know blog.codingconfessions.com/p/hardware-a... Another great post by @abhi9u.bsky.social
blog.codingconfessions.com
Hardware-Aware Coding: CPU Architecture Concepts Every Developer Should Know
Write faster code by understanding how it flows through your CPU
232
Abhinav Upadhyay @abhi9u.bsky.social · 17/02/2025
Every few years linux distributions decide that they need to make it more difficult for you to generate and find core dump files. Now you need to install a systemd utility to do this.
130
Abhinav Upadhyay @abhi9u.bsky.social · 05/02/2025
Woke up to an email from Douglas Mcilroy himself in response to my article on his work on Unix Spell. I am very grateful that he took the time to read and respond to it! PS: I fixed the error he found in the article. Article: blog.codingconfessions.com/p/how-unix-s...
043
Abhinav Upadhyay @abhi9u.bsky.social · 19/01/2025
How do you fit a 250kB dictionary in 64kB of RAM and still perform fast lookups? For reference, even with gzip -9, you can't compress this file below 85kB. In the 1970s, Douglas McIlroy faced this exact challenge while implementing the spell checker for Unix at AT&T.
1157
Abhinav Upadhyay @abhi9u.bsky.social · 05/01/2025
Some old papers are a joy to read because of their simplicity. This is the abstract from a 1966 paper describing a compression technique for infinite codes. For static data, you know the probabilities of the symbols, and can build a Huffman tree, but for an infinite stream, you can't do that
260
Reposted by Abhinav Upadhyay
Codetoday Unlimited @codetodayunlimited.com · 02/01/2025
Back to school, time for Free Python Coding Resources for Schools, and by resources we mean our entire curriculum, all video lessons Help us spread the word with school teachers everywhere 50+ hours of lessons covering all levels, beginner to advanced, designed specifically for school children …👇🏻
Anime-style cartoon of teenage boy with headphones sitting at his laptop
595
Abhinav Upadhyay @abhi9u.bsky.social · 02/01/2025
I noticed that my latest article trending on HN! So it's worth sharing here as well. It is first in a series to cover the internals of context switching in Linux. This one explains the core data structures for process and state management during context switching.
blog.codingconfessions.com
Linux Context Switching Internals: Part 1 - Process State and Memory
How does the Linux kernel represent processes and their state: A breakdown of task_struct and mm_struct
0122
Abhinav Upadhyay @abhi9u.bsky.social · 27/12/2024
An article I wrote a while back was trending on HN today. It explains the impossibility theorem of clustering, according to which a perfect clustering algorithm is impossible to achieve.
142
Abhinav Upadhyay @abhi9u.bsky.social · 26/12/2024
You thought systems programmers don't need to know math? Linux kernel developers prove you wrong by contradiction—they prove corollaries in their comments.
0163
Reposted by Abhinav Upadhyay
Sam Rose @samwho.dev · 20/12/2024
What does it mean for something to be Turing complete? I answer this question, and more, through a series of fully interactive Turing machine simulations! Play, pause, step forwards and backwards, and even write your own Turing machine programs in my latest blog post. samwho.dev/turing-machi...
23523158
Abhinav Upadhyay @abhi9u.bsky.social · 20/12/2024
Continuing on the hardware concurrency thread, this paper is a must read. It simplifies reasoning about concurrency on x86 by providing an abstract machine model
031
Abhinav Upadhyay @abhi9u.bsky.social · 08/12/2024
What every systems programmer should know about concurrency—a very dense but impactful read. Things like lock free and wait free synchronisation techniques will stop seeming like black box if you understand this. PDF: assets.bitbashing.io/papers/concu...
080
Abhinav Upadhyay @abhi9u.bsky.social · 07/12/2024
Ulrich Drepper is a rockstar. I keep running into his papers. This one is on the implementation of thread local storage: PDF: www.akkadia.org/drepper/tls....
041
Reposted by Abhinav Upadhyay
Shriram Krishnamurthi @shriram.bsky.social · 02/12/2024
Sometimes it takes me 22 years (+ one evening) to write a blog post. Here are my thoughts on "homoiconicity" and, as an alternative, "bicameral syntax". (Warning: 4000 words.) parentheticallyspeaking.org/articles/bic...
parentheticallyspeaking.org
Bicameral, Not Homoiconic
Parenthetically Speaking: Articles by Shriram Krishnamurthi
2414039
Abhinav Upadhyay @abhi9u.bsky.social · 27/11/2024
When you first learn about the fork() syscall, it can seem magical. How can a single system call produce two different return values at the same time?! In my latest article, I demystify the hidden magic of fork and also show how it is implemented in Linux. blog.codingconfessions.com/p/the-magic-...
blog.codingconfessions.com
Disillusioning the Magic of the fork System Call
How the kernels implement the fork system call
1164
Abhinav Upadhyay @abhi9u.bsky.social · 26/11/2024
Visualising transformers and attention - by none other than 3bluebrown youtu.be/KJtZARuO3JY?...
youtu.be
Visualizing transformers and attention | Talk for TNG Big Tech Day '24
YouTube video by Grant Sanderson
171
Abhinav Upadhyay @abhi9u.bsky.social · 21/11/2024
Hacking on some code while Cooper is occupied watching a movie.
020
Abhinav Upadhyay @abhi9u.bsky.social · 20/11/2024
Recently, I discovered a hidden Easter egg inside Cpython and I wrote a very short post about it which is trending in a few forums. blog.codingconfessions.com/p/cpython-hi...
blog.codingconfessions.com
An Unreachable Hidden XKCD Easter Egg inside CPython
No, I'm not talking about import antigravity
060
Abhinav Upadhyay @abhi9u.bsky.social · 19/11/2024
Ben Affleck's interview on his views on LLMs is going around. I wonder if Matt Damon is somewhere saying this to someone:
051
Reposted by Abhinav Upadhyay
Stephen Gruppetta @stephengruppetta.com · 16/11/2024
I felt I needed to do something to keep my reputation as "The Turtle Guy"—funnily enough, I rarely post about `turtle`, but when I do, people seem to notice… Anyway, for the latest article on The Python Coding Stack, I revisited an old project… www.thepythoncodingstack.com/p/python-tur...
062
Abhinav Upadhyay @abhi9u.bsky.social · 17/11/2024
A while back I published a detailed code walkthrough of CPython's GC implementation. But there was a need for a higher level explanation of the overall memory management mechanism of CPython without discussing the code. I did just that in a recent article. Here's a summary:
282
Abhinav Upadhyay @abhi9u.bsky.social · 14/11/2024
Are there people here working in compilers or computer architecture space? Would love to diversify my feed. These are the two areas I'm primarily diving into these days. I'm not an expert, but I'm trying to build some fluency in these topics.
200
Abhinav Upadhyay @abhi9u.bsky.social · 13/11/2024
Found this Easter egg in the CPython code today. As I looked at it I wondered who is Randall? Is he someone like David Beazely for whom special code was added. Mystery unravelled when reached the last line and found the xkcd reference :)
010
Abhinav Upadhyay @abhi9u.bsky.social · 12/11/2024
My dog is turning into quite an actor
010
Abhinav Upadhyay @abhi9u.bsky.social · 11/11/2024
I wrote an article on why the Pythonic way of checking a list for emptiness is not ambiguous. Whenever that is the case, there are ambiguities surrounding it which can make it look ambiguous as well. blog.codingconfessions.com/p/the-python...
blog.codingconfessions.com
The Pythonic Emptiness
Why the Pythonic way of doing emptiness check on sequences is not necessarily ambiguous in most cases
120
Abhinav Upadhyay @abhi9u.bsky.social · 04/11/2024
The X86 instruction encoding is atrocious. How does the CPU even decode it?!
010
Abhinav Upadhyay @abhi9u.bsky.social · 04/11/2024
The Linux kernel has a JIT compiler for compiling the bytecode of BPF programs into machine code. How does it work?
030
Abhinav Upadhyay @abhi9u.bsky.social · 02/11/2024
Love this (new?) fish feature. On doing <Tab> with a partially written man page name, the autocomplete also shows a description of the suggested man pages so I can quickly tell which one I want to look up
000
Abhinav Upadhyay @abhi9u.bsky.social · 02/11/2024
Aligning up or down to a power-of-2 boundary is a very common operation. I've seen many people use the % operator to do it. But there is a more efficient way of doing it in just 2 instructions.
000
Abhinav Upadhyay @abhi9u.bsky.social · 30/10/2024
Brendan Gregg has been busy. He is now trying to build full stack profiling for GPU kernels, i.e., flame graphs which show all the code right from the CPU down to the last bit of kernel code running on the GPU. He calls it AI flame graphs. It seems he has it ready for the Intel GPUs.
110
Abhinav Upadhyay @abhi9u.bsky.social · 27/10/2024
While most compiler courses and books currently teach parsing algorithms from the 70s and 80s, CPython uses a parsing technique published in 2004 and which is still not taught widely.
110
Abhinav Upadhyay @abhi9u.bsky.social · 25/11/2023
In the past, I've written a few articles on cpython internals. It's a topic I enjoy a lot and plan to cover more. My latest piece covers a fundamental idea in cpython implementation which underlies the object system codeconfessions.substack.com/p/cpyt…
020
Abhinav Upadhyay @abhi9u.bsky.social · 03/11/2023
One of the rare days I had a chance to refer to this for something I'm working on
000
Abhinav Upadhyay @abhi9u.bsky.social · 19/10/2023
If you wondered why GPUs are in so much demand and how do they work, then I've got you covered. What Every Developer Should Know About GPUs: codeconfessions.substack.com/p/gpu-…
codeconfessions.substack.com
What Every Developer Should Know About GPU Computing
A primer on GPU architecture and computing
052