←
Strace1,058 posts
Strace avatar

Strace

@straceX

Computer Architecture, Semiconductors, Systems Programming

◷ Joined June 2024▧ 330 Photos and videos
Strace avatar
⟳ Strace retweeted
Strace@straceX·2h

Some developer thinks Git stores the line-by-line differences between commits. It doesn't work that way. When you run git commit, git records a snapshot of your staged project. changed files become new objects, identified by hashes and stored in Git's object database. files that haven't changed reuse their existing objects. And when you run git diff, Git compares the snapshots to work out what changed. The interesting part is that Git can later compress similar objects into deltas inside packfiles to save space. Git tracks snapshots. diffs are something it can calculate from them.

Post attachment
Strace avatar
⟳ Strace retweeted
Strace@straceX·Nov 17

The rename() system call is one of those boring Unix features that quietly makes software reliable. on the same filesystem, replacing a destination file with rename() is atomic. Readers don't see a half-renamed destination. that's why temporary-file-then-rename is such a common pattern.

Strace avatar
Strace@straceX·Nov 17

In 1999, Maxis released SimCity 3000, where you could build cities with hundreds of thousands of residents and watch cars and pedestrians moving through the streets. But those weren't hundreds of thousands of individual people being simulated every frame. The game modeled traffic density and used animated cars and pedestrians to represent activity on the streets. You could even turn off visible traffic and pedestrians at certain zoom levels to improve performance. The city still had traffic even when there wasn't a single car on your screen.

Post attachment
Strace avatar
Strace@straceX·Nov 16

We automated the deployment. Then automated the rollback. Then scheduled someone to sit there and make sure neither automation wins.

Strace avatar
Strace@straceX·Nov 15

Rust compiler: "I can’t let you do that." C compiler: "I can’t stop you from doing that." C++ compiler: "47,000 words, unclear which."

Rust compiler: "What if this pointer outlives the data?" C compiler: "What if it doesn’t? Why are you always so negative?"

Strace avatar
Strace@straceX·Nov 15

Your computer's RAM is built from billions of microscopic capacitors that constantly leak electrical charge. In typical DRAM, every row must be refreshed within roughly 64 milliseconds or stored data can eventually disappear. Your memory controller sends refresh commands about every 7.8 microseconds, keeping those bits alive while your operating system runs. Your computer is constantly fighting to remember what happened 64 milliseconds ago.

Strace avatar
Strace@straceX·Nov 10

Interviewer: An account with 100 million followers posts a tweet. If you INSERT that tweet into 100 million follower timelines on write, your database melts. If you query everyone a user follows on read, loading the home feed takes 10 seconds. How do you design the feed so both reads and writes stay under 50ms?

Strace avatar
⟳ Strace retweeted
Strace@straceX·Nov 9

In 1984, Soviet computer scientist Alexey Pajitnov created Tetris at the Moscow Academy of Sciences on an Elektronika 60. The machine had no bitmap graphics. Its terminal could display text, but not graphical sprites. So early versions of Tetris represented the falling pieces using text characters, including pairs of square brackets: [][][][]. No sprites, graphics engine & no sound effects. Only text characters falling down a terminal screen. And somehow, that became one of the most recognizable video games ever made.

Post attachmentPost attachment
Strace avatar
⟳ Strace retweeted
Strace@straceX·Nov 6

UNIX co-creator Ken Thompson was once asked what he would change if he could go back and redesign UNIX. He had helped create an operating system whose design would influence generations of software, from Linux to macOS. But the one thing he wanted to fix wasn’t the filesystem, the process model, or the architecture. It was the name of a system call. I’d spell creat with an e.

Post attachment
Strace avatar
⟳ Strace retweeted
Strace@straceX·Nov 5

How does free(ptr) in C know how much memory to release when you never pass it the allocation size? On glibc, malloc() keeps a hidden chunk header immediately before the pointer it returns. One word stores the chunk size, with the lowest three bits used as allocator flags. When you call free(ptr), glibc recovers that metadata. The size was never lost. It was simply hidden from your program. You can inspect the allocator’s usable size with the GNU-specific malloc_usable_size() function:

Post attachment
Strace avatar
⟳ Strace retweeted
Strace@straceX·Nov 5

When people ask how SQLite creator D. Richard Hipp and his team maintain a C database running on billions of devices, the answer is in the testing. In 2023, SQLite’s engine had about 156,000 lines of C. Its test suite contained over 92 million lines of code and scripts. That’s roughly 590 lines of tests for every line of production code. Before releases, SQLite deliberately simulates power loss, disk I/O errors, and malloc() failures. A separate harness achieves 100% branch coverage of the core in its tested configuration. They don’t build reliable software by assuming everything will work. They build it by systematically testing what happens when things go wrong.

Post attachmentPost attachment
Strace avatar
⟳ Strace retweeted
Strace@straceX·Nov 4

In 1956, Edsger Dijkstra needed to demonstrate a new computer called the ARMAC. He wanted a problem anyone could understand: finding the shortest route between two cities in the Netherlands. One morning, while shopping in Amsterdam with his fiancée, they stopped for coffee. Sitting at an outdoor café, Dijkstra worked out the shortest-path algorithm in about 20 minutes. No pencil. No paper. He later explained that having nothing to write on forced him to eliminate unnecessary complexity. The demonstration used a map of just 64 Dutch cities, allowing each city to be identified with six bits. He didn’t publish the algorithm until 1959. Seventy years later, Dijkstra’s algorithm remains foundational to route planning and the shortest-path calculations used by OSPF routers. One of computer science’s most influential algorithms began over a cup of coffee.

Post attachment
0:30
Strace avatar
⟳ Strace retweeted
Strace@straceX·Nov 3

PostgreSQL quietly settled a surprisingly large part of the SQL vs. NoSQL debate by adding jsonb and GIN indexes. You can store flexible JSON documents alongside relational tables, query nested data with indexes, and update both in the same ACID transaction. Postgres didn’t make document databases obsolete. It just made a separate one unnecessary for a lot of applications. All that arguing, and the relational database learned to speak JSON.