Introduction
Today was my first real dive into system programming on Linux. I started with “The Linux Programming Interface” by Michael Kerrisk (TLPI) – widely considered the definitive guide to Linux system programming. However, I’ve decided to take a slightly different approach that I think will work better for me as a beginner.
Instead of using TLPI as my primary learning resource, I’ll be using “System Programming in Linux” by Stewart N. Weiss as my main textbook. TLPI will now serve as my comprehensive reference – the “encyclopedia” I turn to when I need to dive deeper into specific topics.
Here’s why I’m making this change and what I accomplished today.
The Books I’m Using
| Detail | TLPI | System Programming in Linux |
|---|---|---|
| Title | The Linux Programming Interface | System Programming in Linux |
| Author | Michael Kerrisk | Stewart N. Weiss |
| Published | 2010 | 2025 (Brand New!) |
| Pages | 1,552 | 1,048 |
| Focus | Complete reference covering every detail | Project-based, teaching-oriented |
| My Role | Reference book (for deep dives) | Main textbook (for structured learning) |
Why this approach: TLPI is encyclopedic – it covers everything but can be overwhelming to read cover-to-cover as a beginner. “System Programming in Linux” is specifically designed as a teaching book, with hands-on projects, guided discovery, and a conversational style that makes complex topics approachable. Using both gives me the best of both worlds.
What We Accomplished Today
1. Understood Debian Package Updates
What I learned: System updates aren’t just annoying pop-ups. They include critical security fixes, new features, and bug corrections. Specifically, I saw:
- Kernel headers – files that allow code to interact with the kernel
- Security updates – patches that fix vulnerabilities
- Meta-packages – packages that pull in other packages automatically
Why this matters: When you update your kernel, you also need updated headers to compile new kernel modules or drivers.
Key takeaway: A restart is required after kernel updates because the new kernel isn’t active until you reboot.
2. Learned About Header Files
What I learned: Header files (.h files) are like instruction manuals for the compiler. They tell it:
- What functions exist (e.g.,
printf(),open(),getpid()) - What data types are defined
- What constants are available
Analogy: If a program is a restaurant meal, header files are the menu. They list what’s available, but the actual “cooking” (implementation) happens elsewhere.
3. Set Up a Complete C Development Environment
| Component | What It Does |
|---|---|
| VS Code | The code editor where I write programs |
| C/C++ Extension Pack | Adds auto-completion, syntax highlighting, and debugging |
| GCC (GNU Compiler Collection) | Turns my C code into executable programs |
| GDB (GNU Debugger) | Helps find and fix errors |
| Workspace Folder | ~/tlpi_exercises – a dedicated space for my projects |
Why this matters: Writing code in a plain text editor and compiling from the terminal is possible, but having a modern environment with auto-completion makes learning much faster and less frustrating.
4. Learned How to Use VS Code for C
Key operations I now know:
| Action | How To Do It |
|---|---|
| Open VS Code in a folder | code ~/tlpi_exercises |
| Create a new file | Right-click in Explorer → New File |
| Write code | Type in the editor |
| Save | Ctrl+S |
| Open the terminal | `Ctrl+“ (backtick) | |
| Compile | gcc -Wall -o output source.c |
| Run | ./program_name |
Why this matters: This edit-compile-run loop is the foundation of all C development. Mastering it now makes everything else easier.
5. Wrote and Ran My First C Program
First program (hello.c):
c
#include <stdio.h>
int main() {
printf("VS Code is ready!\n");
return 0;
}
What I learned:
#includetells the compiler to include a header file<stdio.h>provides standard input/output functions likeprintf()main()is where every C program startsprintf()prints text to the terminalreturn 0means the program ended successfully
How I compiled and ran it:
bash
gcc -Wall -o hello hello.c ./hello
Output:
text
VS Code is ready!
6. Learned About Compiler Errors (and How to Fix Them)
My first error:
text
hello.c:1:9: error: #include expects "FILENAME" or <FILENAME>
1 | #include
| ^
What it meant: I had typed #include by itself without specifying which file to include.
How I fixed it: Removed the empty #include line and left only #include <stdio.h>.
What I learned: Compiler errors are not scary – they tell you exactly what’s wrong and where to look.
7. Made My First System Call
Second program (with getpid()):
c
#include <stdio.h>
#include <unistd.h> // For getpid()
int main() {
printf("My process ID is: %d\n", getpid());
printf("VS Code is ready!\n");
return 0;
}
What I learned:
getpid()is a system call – a request to the Linux kernel- Every running program has a unique Process ID (PID)
- The kernel assigns these IDs and returns them when asked
unistd.his the header file for system calls
Output:
text
My process ID is: 123883 VS Code is ready!
Why this is exciting: This is real system programming – my program communicated directly with the Linux kernel!
8. My Learning Strategy Going Forward
Instead of reading TLPI cover-to-cover, I’ll be taking a more structured approach:
| Step | Action |
|---|---|
| 1 | Follow “System Programming in Linux” as my primary textbook – it’s project-based and designed for learning |
| 2 | Complete the hands-on exercises and projects in each chapter |
| 3 | Use TLPI as a reference when I need more depth on a specific topic |
| 4 | Write lots of code and experiment – the best way to learn system programming |
Why this works:
- “System Programming in Linux” is a brand new book (October 2025) with a modern, teaching-focused approach
- It was built on a university course that has helped thousands of students learn system programming
- TLPI remains my “encyclopedia” – the definitive reference when I need it
Visual Summary: My Complete Setup
text
┌─────────────────────────────────────────────────────────┐
│ Debian System │
│ ┌───────────────────────────────────────────────────┐ │
│ │ VS Code (v1.127.0) │ │
│ │ ┌─────────────────────────────────────────────┐ │ │
│ │ │ C/C++ Extension Pack (Microsoft) │ │ │
│ │ │ - Auto-completion │ │ │
│ │ │ - Syntax highlighting │ │ │
│ │ │ - Debugging support │ │ │
│ │ └─────────────────────────────────────────────┘ │ │
│ │ ┌─────────────────────────────────────────────┐ │ │
│ │ │ test.c │ │ │
│ │ │ #include <stdio.h> │ │ │
│ │ │ #include <unistd.h> │ │ │
│ │ │ int main() { │ │ │
│ │ │ printf("PID: %d\n", getpid()); │ │ │
│ │ │ } │ │ │
│ │ └─────────────────────────────────────────────┘ │ │
│ └───────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────────────────────────────────┐ │
│ │ GCC Compiler (14.2.0) │ │
│ │ gcc -Wall -o test test.c │ │
│ └───────────────────────────────────────────────────┘ │
│ │ │
│ ▼ │
│ ┌───────────────────────────────────────────────────┐ │
│ │ ./test │ │
│ │ My process ID is: 123883 │ │
│ │ VS Code is ready! │ │
│ └───────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────┘
Commands I Now Know
| Command | Purpose |
|---|---|
code . | Open VS Code in the current folder |
gcc -Wall -o output source.c | Compile with warnings enabled |
./program_name | Run a compiled program |
ls | List files in the current directory |
cd ~/tlpi_exercises | Navigate to my workspace |
| `Ctrl+“ | Open terminal in VS Code | | |
Ctrl+S | Save the current file |
Ctrl+A | Select all text |
What’s Next? (A Preview)
I’ll start working through “System Programming in Linux” by Stewart N. Weiss, beginning with:
| Chapter | Topic |
|---|---|
| Core Concepts | Understanding the structure of Unix and Linux operating systems |
| System Calls | Using system calls to create and manage processes |
| Process Control | Signals, timers, and interprocess communication |
| Threading | Using synchronization tools to write multithreaded programs |
| Filesystems | Interacting with filesystems, devices, and terminals |
When I need to dive deeper into a specific topic, I’ll reference TLPI for its comprehensive coverage.
What I’ve Learned Today
| Concept | Understanding |
|---|---|
| System updates | Include security fixes, new features, and kernel improvements |
| Header files | Provide the compiler with information about functions and data types |
| Compilation | Converting human-readable C code to machine-executable binary |
| System calls | Requests from programs to the kernel (e.g., getpid()) |
| Process ID | A unique number the kernel assigns to every running program |
| VS Code | A powerful editor with extensions for C development |
| GCC | The GNU Compiler Collection – turns C code into programs |
| Debugging | Reading and fixing compiler errors |
Reflection
Today was about building the foundation. I didn’t write anything complex, but I:
- Set up the tools – without them, nothing works
- Learned the workflow – edit, save, compile, run
- Made a mistake – and learned how to fix it
- Talked to the kernel –
getpid()was my first real system call
Most importantly: I now have a working environment, the confidence to start learning system programming, and a clear strategy:
- Learn with System Programming in Linux as my guide
- Deepen with TLPI as my reference
- Practice by writing lots of code
Resources I’m Using
| Resource | Purpose |
|---|---|
| System Programming in Linux by Stewart N. Weiss | Main textbook (project-based learning) |
| The Linux Programming Interface by Michael Kerrisk | Comprehensive reference (the encyclopedia) |
| VS Code | My code editor |
| GCC | My compiler |
| Debian Linux | My development OS |
| O’Reilly Learning Platform | Where I read both books online |
Written on July 5, 2026 – My first day of system programming on Debian, with a clear learning path forward.