Programs cannot directly interact with hardware; they must request services through exactly five system calls (open, read, write, fork, execve) that act as the only doors between user space and kernel space. Open() requests permission to access resources and returns a file descriptor (a ticket number), while read() and write() move data across the wall with the program blocking until the kernel responds. Fork() clones the current process, and execve() replaces the cloned process's identity with a new program. Understanding these five doors transforms programmers into engineers who can diagnose issues like slow endpoints (caused by excessive syscall calls) and permission errors (caused by denied open() requests).
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Your Code Is a Prisoner. These 5 Doors Are Its Only Way Out
Added:Your code cannot touch a single file. It cannot draw a single pixel. It cannot send a single byte across the internet.
And yet, somehow it does all three constantly. Right now, on the machine you're watching this on. Here's the part nobody tells you. A program that just prints the word hello and exits, the simplest thing you can write, doesn't run alone. It makes dozens of requests to something it is not allowed to see before it ever reaches your line of code. Not five, not 10, dozens. For one word. You think your code is in charge, that it runs on the computer. The obvious explanation, the one every tutorial quietly implies, is wrong. Your program is not in control. It never was.
But those dozens of requests, they're all variations on a tiny handful of primitive moves. Strip it all down and your entire program, every program, only knows a few ways to speak at all. It's a prisoner, and it can only speak to the outside world through five forbidden doors. To understand the prison, you have to understand there are two worlds inside every computer, and a wall between them your code can never climb.
On one side, user space. This is your playground. Your app, your browser, your Python script, the game you're playing, they all live here. It feels like freedom. You allocate memory, you loop, you do math, you call functions, nobody stops you. On the other side, the kernel. This is where the real power lives. The kernel talks to the disk, to the network card, to the screen, to the keyboard, to every other program on the machine. If something in the physical world is going to happen, a byte written, a packet sent, the kernel is the only one allowed to do it. And here's the hierarchy nobody says out loud. This isn't two neighbors sharing a fence. This is a king and a subject.
Your code is the subject. It owns nothing. It touches nothing.
If it wants anything from the real world, it has to ask. And if the king says no, your code doesn't get a polite error and move on. Your code dies, instantly.
We'll get to how.
Five doors in that wall. Five ways to ask. Miss one and the whole thing stops making sense. Now, maybe you're thinking I've shipped software for years and never once thought about this. Why start now? Because there's a kind of programmer who's just a driver that doesn't know the engine exists. You turn the wheel, you press the pedal, the car moves. And when it stops moving, you have no idea why. So, you turn the wheel harder and you pray. That's what abstraction did to us. Frameworks, runtimes, garbage collectors, ORMs, comfort stacked on comfort. It made us faster and it made us blind. Blind to why the app is slow. Blind to why the permission failed. The questions that keep you up at 2:00 a.m., the answer almost always lives at the wall, at the doors. A slow app is usually a program knocking on a door 10,000 times when it should have knocked once. A mysterious permission error is a door slammed in your program's face. So, let's look at the doors. The first three are about perception. How your code sees and touches the world. The last two are the glitch in the matrix. Start with perception. Door one, open. They say open opens a file. It does not. Open is your program walking up to the king and saying, "I would like permission to look at this resource. Here is its name. Here is what I intend to do with it, read only." And the kernel decides. Does this file exist? Do you this specific process running as this specific user have the right to touch it? If no, you get nothing. If yes, the kernel hands back one number. That number, the file descriptor, is the entire point. It's not the file, it's a ticket, a claim check. The kernel is saying, "I'll remember what you asked for. From now on, don't talk to me about the file.
Talk to me about ticket number three."
Your code never held the file. It never will. All it ever holds is a number the king agreed to honor. Open isn't a function, it's a contract. Doors two and three read and write. These only make sense once you accept the wall is real.
When your program calls read, it is not reaching into the disk. It can't. It hands the kernel three things: the ticket, an empty box, and a size.
Take my ticket number three. Fill this box with up to 4,000 bytes. Bring it back across the wall and then the program stops. It sits there, frozen, useless, until the kernel comes back.
Every read is your code holding its breath at the border, waiting for a king who's dealing with a thousand other subjects at the same time. Write is the mirror image. You hand a full box back over the wall and say, "Put this somewhere in the real world." Notice the one. That's a ticket, too. File descriptor one, handed to every program at birth, wired to your terminal. When you print in any language, Python, Java, Go, that comfortable little print unwinds layer by layer down to exactly this. A box shoved through a slot in a wall addressed to ticket number one. So, that's perception. Open, read, write, ask, receive, send. Three doors, and every file, every network socket, every keystroke you've ever handled went through them. It feels like enough to explain a computer. It isn't, because none of it explains where a program comes from in the first place. And that's where it stops being engineering and starts feeling like biology. If this kind of breakdown is useful, you can support the channel on Patreon or by becoming a member. Door four. This is the one that broke my brain the first time I understood it. Fork. When you open a new tab, launch an app, start a server, where does that new program come from? You'd assume the computer loads it fresh, reads it off the disk, sets it up, presses go. That's the obvious answer. It's wrong. To create something new, the system does not build it. It clones itself. Fork takes the process running right now, its memory, its open tickets, its exact position in the code down to the single instruction it's on and makes a perfect copy, a twin. Two processes now exist where there was one.
Both standing on the exact same line about to run the exact same next instruction. And this is the glitch in the matrix. Fork is called once, but it returns twice. The same line hands back a different answer to each twin. To the parent, it returns the ID of the child.
To the clone, which has no idea it's a clone, it returns zero. That single number is the only way either one can tell which reality it's living in. One line of code, two different truths. And across every server, every container, every shell command typed on Earth right now, this split happens millions of times a second. Small print. Under the hood, Linux doesn't even call it fork anymore. It calls it clone. Same trick, sharper knife. A door for another video.
But strip away the name and the truth is the same. Every server humming in every data center on Earth, every process open on your laptop right now, every tab in your browser, none of them were built.
Every one of them was born from a clone.
But a clone is useless. If you want to run a calculator, cloning your web server just gets you two web servers.
You need the child to become something else. Door five, exec. Exec is the strangest door of all because it's a kind of possession. The clone calls it and says, "Take my body, this process, this ID, these tickets I inherited, and burn out everything inside. Wipe my memory, wipe my code. Load a completely [snorts] different program into me and let it wake up as if it were always here." The process, the shell, the ID, the identity survives, but the soul is replaced. The child was a copy of your program one instruction ago, now it's the LS command or Chrome or a database with no memory of ever having been anything else. Exec has no line after it that runs your old code because there is no old code anymore. It's the function that never returns. That's the pattern the entire computing world is built on.
Fork then exec. Clone yourself then let the clone become a stranger. Every command you've ever typed into a terminal is this. Your shell forks a copy of itself and the copy immediately annihilates its own identity to become the program you asked for. Birth by cloning, adulthood by possession. That's how the machine reproduces. Here's the uncomfortable part. For years I wrote code that shipped, that worked, that people paid for and I had no idea any of this was happening underneath. I was the driver with his eyes closed. I turned the wheel and it moved and I called that knowing how to program. It wasn't. And the day the wheel stopped responding I had nothing. Once you see the five doors you can't unsee them. You stop looking at code and seeing functions. You start seeing transactions with the hardware. A slow endpoint isn't mysterious anymore.
It's a program knocking on red 10,000 times. A permission error isn't magic.
It's open. Getting a no from the king.
You develop a kind of x-ray vision. You look at software and see straight through it down to the metal. That vision is the exact line between a programmer and an engineer. One moves the wheel and prays. The other knows there's an engine and knows how to listen to it. Which raises a question that should genuinely worry you. If understanding how code touches the metal is what separates an engineer from a button presser, what happens when the code is written by an AI that has no idea what a syscall even is? That never knew the doors exist. I spent six months auditing exactly that. Code generated by AI shipped to production working until it wasn't. It's called I audited six months of AI code. It's all instant legacy. It's the other half of this story. Watch that next.
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

WOW! Judge TURNS THE TABLES on Trump in His OWN $10B LAWSUIT!!!
MeidasTouch
197K views•2026-07-23

Playstation NO DISC/NO BUY Fight Is Over...
DavidJaffeGames
4K views•2026-07-23

Steam and Xbox Just Dropped The Hammer On PlayStation
OhNoItsAlexx
9K views•2026-07-23

Americans Confused in Australia for 17 Minutes Straight
IWrocker
17K views•2026-07-23