RSSAmplifier

Blog

Ten thousand meters

Diving deep, flying high to see why

tenthousandmeters.comRSS feed ↗18 posts

Latest posts

I switched from VSCode to Zed

For many years VSCode has been my day-to-day IDE for everything: Python, Go, C, occasional frontend development, and what not. It was never perfect but it worked. I like using mainstream tools with minimal configuration, so it suited me perfectly. But recent VSCode developments forced me to look for an alternative. In December I switched to Zed completely, and I think I'm never going back.

SQLite concurrent writes and "database is locked" errors

SQLite claims to be one of the most popular pieces of software in the world, being integrated into every major operating system and browser. It became the ultimate database for client side apps. In recent years, there's also been a growing interest in using SQLite on the backend . If you do this, you better keep in mind a major SQLite limitation: concurrent writes. SQLite handles concurrent writes…

Holiday readings (New Year 2025): AI accelerators and GPU clouds

Just before Christmas, I've stumbled upon Machine Learning Engineering Open Book by Stas Bekman. It's a book I've long been looking for – a collection of insights on operating a large GPU cluster and using it to train and run LLMs: AI accelerators, fast intra-node and inter-node networking, optimized cluster storage, large-scale LLM training and inference, with lots of first-hand experience on…

This website is now public on GitHub

Here it is: github.com/r4victor/tenthousandmeters . It started as a private repo but now I'm making it public so that everyone can make PRs and issues and contribute. I'm also making updates to the blog that I haven't actively maintained since 2022 when I finished writing the Python behind the scenes series. My resolution for 2025 is to start writing again.

I made a website with best learning resources on IT topics

Here it is: bestresourcestolearnx.com . Learning new stuff is an integral part of a software engineer's job and a daily routine for any curious person working in IT. We constantly discover and learn new programming languages, frameworks, libraries, tools, concepts, theories, and ideas. We do it to get better at our jobs. And we do it because learning is fun.

Python behind the scenes #13: the GIL and its effects on Python multithreading

As you probably know, the GIL stands for the Global Interpreter Lock, and its job is to make the CPython interpreter thread-safe. The GIL allows only one OS thread to execute Python bytecode at any given time, and the consequence of this is that it's not possible to speed up CPU-intensive Python code by distributing the work among multiple threads. This is, however, not the only negative effect of…

Python behind the scenes #12: how async/await works in Python

Mark functions as async . Call them with await . All of a sudden, your program becomes asynchronous – it can do useful things while it waits for other things, such as I/O operations, to complete. Code written in the async / await style looks like regular synchronous code but works very differently. To understand how it works, one should be familiar with many non-trivial concepts including…

Python behind the scenes #11: how the Python import system works

If you ask me to name the most misunderstood aspect of Python, I will answer without a second thought: the Python import system. Just remember how many times you used relative imports and got something like ImportError: attempted relative import with no known parent package ; or tried to figure out how to structure a project so that all the imports work correctly; or hacked sys.path when you…

Python behind the scenes #10: how Python dictionaries work

Python dictionaries are an extremely important part of Python. Of course they are important because programmers use them a lot, but that's not the only reason. Another reason is that the interpreter uses them internally to run Python code. CPython does a dictionary lookup every time you access an object attribute or a class variable, and accessing a global or built-in variable also involves a…

Python behind the scenes #9: how Python strings work

In 1991 Guido van Rossum released the first version of the Python programming language. About that time the world began to witness a major change in how computer systems represent written language. The internalization of the Internet increased the demand to support different writing systems, and the Unicode Standard was developed to meet this demand. Unicode defined a universal character set able…

Python behind the scenes #8: how Python integers work

In the previous parts of this series we studied the core of the CPython interpreter and saw how the most fundamental aspects of Python are implemented. We made an overview of the CPython VM , took a look at the CPython compiler , stepped through the CPython source code , studied how the VM executes the bytecode and learned how variables work . In the two most recent posts we focused on the Python…

Python behind the scenes #7: how Python attributes work

What happens when we get or set an attribute of a Python object? This question is not as simple as it may seem at first. It is true that any experienced Python programmer has a good intuitive understanding of how attributes work, and the documentation helps a lot to strengthen the understanding. Yet, when a really non-trivial question regarding attributes comes up, the intuition fails and the…

Python behind the scenes #6: how Python object system works

As we know from the previous parts of this series, the execution of a Python program consists of two major steps: 1. The CPython compiler translates Python code to bytecode. 2. The CPython VM executes the bytecode. We've been focusing on the second step for quite a while. In part 4 we've looked at the evaluation loop, a place where Python bytecode gets executed. And in part 5 we've studied how the…

Python behind the scenes #5: how variables are implemented in CPython

Consider a simple assignment statement in Python: a = b The meaning of this statement may seem trivial. What we do here is take the value of the name b and assign it to the name a , but do we really? This is an ambiguous explanation that gives rise to a lot of questions: What does it mean for a name to be associated with a value? What is a value? What does CPython do to assign a value to a name?…

Python behind the scenes #4: how Python bytecode is executed

We started this series with an overview of the CPython VM . We learned that to run a Python program, CPython first compiles it to bytecode, and we studied how the compiler works in part two . Last time we stepped through the CPython source code starting with the main() function until we reached the evaluation loop, a place where Python bytecode gets executed. The main reason why we spent time…

Python behind the scenes #3: stepping through the CPython source code

In the first and the second parts of this series we explored the ideas behind the execution and the compilation of a Python program. We'll continue to focus on ideas in the next parts but this time we'll make an exception and look at the actual code that brings those ideas to life.

Python behind the scenes #2: how the CPython compiler works

In the first post of the series we've looked at the CPython VM. We've learned that it works by executing a series of instructions called bytecode. We've also seen that Python bytecode is not sufficient to fully describe what a piece of code does. That's why there exists a notion of a code object. To execute a code block such as a module or a function means to execute a corresponding code object. A…

Python behind the scenes #1: how the CPython VM works

Have you ever wondered what python does when you run one of your programs? $ python script.py This article opens a series which seeks to answer this very question.