“The Linux Programming Interface” and “System Programming in Linux”

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

DetailTLPISystem Programming in Linux
TitleThe Linux Programming InterfaceSystem Programming in Linux
AuthorMichael KerriskStewart N. Weiss
Published20102025 (Brand New!)
Pages1,5521,048
FocusComplete reference covering every detailProject-based, teaching-oriented
My RoleReference 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

ComponentWhat It Does
VS CodeThe code editor where I write programs
C/C++ Extension PackAdds 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:

ActionHow To Do It
Open VS Code in a foldercode ~/tlpi_exercises
Create a new fileRight-click in Explorer → New File
Write codeType in the editor
SaveCtrl+S
Open the terminal`Ctrl+“ (backtick) |
Compilegcc -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:

  • #include tells the compiler to include a header file
  • <stdio.h> provides standard input/output functions like printf()
  • main() is where every C program starts
  • printf() prints text to the terminal
  • return 0 means 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.h is 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:

StepAction
1Follow “System Programming in Linux” as my primary textbook – it’s project-based and designed for learning
2Complete the hands-on exercises and projects in each chapter
3Use TLPI as a reference when I need more depth on a specific topic
4Write 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

CommandPurpose
code .Open VS Code in the current folder
gcc -Wall -o output source.cCompile with warnings enabled
./program_nameRun a compiled program
lsList files in the current directory
cd ~/tlpi_exercisesNavigate to my workspace
`Ctrl+“ | Open terminal in VS Code |
Ctrl+SSave the current file
Ctrl+ASelect all text

What’s Next? (A Preview)

I’ll start working through “System Programming in Linux” by Stewart N. Weiss, beginning with:

ChapterTopic
Core ConceptsUnderstanding the structure of Unix and Linux operating systems
System CallsUsing system calls to create and manage processes
Process ControlSignals, timers, and interprocess communication
ThreadingUsing synchronization tools to write multithreaded programs
FilesystemsInteracting 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

ConceptUnderstanding
System updatesInclude security fixes, new features, and kernel improvements
Header filesProvide the compiler with information about functions and data types
CompilationConverting human-readable C code to machine-executable binary
System callsRequests from programs to the kernel (e.g., getpid())
Process IDA unique number the kernel assigns to every running program
VS CodeA powerful editor with extensions for C development
GCCThe GNU Compiler Collection – turns C code into programs
DebuggingReading 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:

  1. Learn with System Programming in Linux as my guide
  2. Deepen with TLPI as my reference
  3. Practice by writing lots of code

Resources I’m Using

ResourcePurpose
System Programming in Linux by Stewart N. WeissMain textbook (project-based learning)
The Linux Programming Interface by Michael KerriskComprehensive reference (the encyclopedia)
VS CodeMy code editor
GCCMy compiler
Debian LinuxMy development OS
O’Reilly Learning PlatformWhere I read both books online

Written on July 5, 2026 – My first day of system programming on Debian, with a clear learning path forward.