Book Review: The Linux Programming Interface

Summary

The Linux Programming Interface

A Linux and UNIX System Programming Handbook

Michael Kerrisk

Definitive guide to the Linux and UNIX programming interface—the interface employed by nearly every application that runs on a Linux or UNIX system.

Buy Now

Over the years I have read many books on software development and computer programming, a vast majority of them have been mostly useless. In fact, if I’m completely honest, it is seldom that I would actually read a book from cover to cover. A vast majority of books would at most have 3-4 chapters of interest and the rest of the book would be mostly filler content that would barely even get a gloss over.

In other cases, books would be over packed with content, and it is just hard work to get through. However, those books are often extremely useful. Unfortunately, this book is one of those. It’s a book so jammed pack with extremely useful, insightful and interesting content, that it is just too hard to read from cover to cover. I can’t argue that the content is just so dry, you’re not going to be hooked on it, but you will most certainly learn a whole lot.

The content itself ways in at over 1400 pages, and took me over 3 years to read and I still haven’t finished it. I don’t think I ever will, but every time I do read it, I learn something new.

Why I read this book?

Over the past 10 years or so, I have predominantly been using Linux as my primary computing platform and for the most part make use of the Ubuntu Distribution, although I do use Fedora and also have a few Apple Mac machines. Over the years, I have found that I have gravitated mostly towards the Ubuntu Linux but I must be honest is that this probably just based on familiarity and that as someone who grew up in South Africa I just like the name and ethos behind it.

I have been a developer, for over 20 years and for the most part have mostly focused on web based enterprise software development, predominantly developing line of business software applications. I have developed a wide array of software applications, from high volume financial trading applications to humble CRUD applications to automate boring office routines.

All this changed circa 2012, when I discovered the Raspberry Pi and we started developing the Denizon – Ecovaro Energy Monitoring and Management software application , I found myself diving head first into the world of Linux, coming from a mostly Windows Based development background. I had to start getting acquainted with mostly using the terminal window to get round a system!

There was also whole new set of Programming API’s to get familiar with and whole new sub culture and language to get acquainted with.

What I like the book

The book itself is fairly daunting coming in at over 1500 pages! It is also not really that much of a page turner, if I’m brutally honest it took me years to read! tackling a chapter every now and then. It is also very densely packed with interesting information.

The book starts with history lesson on Unix and Linux, going all the way back to Ken Thompson and Dennis Ritchie and then moving forward to the present, looking at the various branches of the Unix tree. It then moves into a description of what an operating system is, the role that the kernel plays, and some of the overarching concepts that make up *nix operating systems.

While this information may be unnecessary for most Linux hackers, I found it interesting and it comes in handy for those coming to Linux from other operating systems. The ideas that “everything is a file” and that files are just streams of bytes are described in ways that will quickly get a system programmer up to speed on the “Unix way”.

In many respects that book the book is quite approachable to read, the language in the book is clear and concise. Kerrisk’s clear descriptions of various system calls and other parts of the Linux API made it easy to keep reading. However, being a tinkerer and having a learning style that is mostly based on learning by doing, or far closer to breaking things and learning how to fix them.

The book also reinforces this style of learning because every chapter has an Exercises sub section to guide you along the path.

The book is also organized into 64 chapters of around 20 pages each, which makes for nice bite-sized chunks that allow for reading the book around other tasks. While the focus is on Linux, Kerrisk doesn’t neglect other Unix varieties and notes where they differ from Linux. He also pays careful attention to the various standards that specify Unix behavior—like POSIX and the Single Unix Specification (SUS)—pointing out where Linux does and does not follow those standards.

There are multiple chapters on processes, threads, signals, along with process groups, sessions, process priorities and scheduling. I was particularly interested the chapters on writing secure privileged programs and Linux capabilities.

There are two chapters on shared libraries, the first of which is more about the ideas underlying libraries and shared libraries along with how to build them, rather than the dlopen() system call which is covered in the second.

Why I recommend this book

This is a book that will be useful to application and system-level developers, primarily, but there is much of interest for others as well. Kernel hackers will find it useful to ensure their new feature or bug fix doesn’t break the existing API. Programmers who are primarily targeting other Unix systems may also find it useful for making their code more portable.

I Personally found Linux the Programming Interface to be extremely useful and return to it frequently. Anyone who has an interest in programming for Linux will likely feel the same way.

Tags: