Building a tiny version of Redis: RESP, TCP Streams, and Owning Your Data

A key-value store sounds simple: accept a command, look up a key, return a value. The interesting work starts when those commands have to cross a socket. A server needs a wire format, a parser that can handle input arriving in pieces, and a clear answer to the question of who owns the data after a command has been processed. I implemented a tiny version of Redis to make those pieces small enough to see at once. It is a single-threaded C server that speaks a useful subset of Redis’s RESP protocol and supports PING, ECHO, SET, and GET. The implementation is deliberately limited, but it has the same basic shape as a real network service: create a listening socket, accept a connection, parse requests, execute commands, serialize replies, and manage memory that outlives an individual request. ...

September 24, 2026 · Giulia

C: The Memory Model and Stack Frames

This is part two of two. Part one covers variables, symbolic constants, and the preprocessor. C always evaluates expressions before executing C evaluates every expression before running it. If main is missing, the linker signals an error, that’s the entry point contract. Parameters to main (argc, argv) behave like local variables. No garbage collector In C there’s no garbage collector. Local variables are not “objects” managed by a runtime; they’re temporary allocations on registers or the stack. When the function returns, they’re gone. There’s no tracing, no finalization, no safety net. This is by design. ...

March 28, 2026 · Giulia