Audience: Experienced C Programmers wanting to work with the Linux kernel
Reviewer: Harry Fairhead
What exactly is systems programming? Who should read this book?
The term can mean a number of different things to different programmers. In this case it is taken to mean using the low-level APIs provided by the kernel. Of course, if you don't know what exactly is provided by the kernel, this too is not going to help.
Basically the kernel provides the file system, process management and memory management and that's about it. So in this book you can hope to learn how to work with files and some devices, manage threading and allocate memory. These are very basic tasks and the book really is about some very low level concerns.
The very first thing to say is that you aren't going to need to read this book unless you are a C programmer. You need to be very happy with C and a reasonably experienced programmer - this book is not for beginners.
Even though it isn't for complete beginners, the first chapter starts off with a reasonable introduction to the idea of the basic services provided and how to set up and use a suitable C compiler. It suggests that "even advanced users should read this chapter" and I think I agree. You can become "advanced" and still miss some of the information and outlook.
Chapter 2 starts a large set of chapters on the file system. It deals with basic File I/O. As well as how to work with files, it also gives you some insight into how Linux manages files. If you have used any low level file API then this sort of thing will be familiar. From here we move on to chapter 3 one buffered I/O and buffer management and chapter 4 on advanced file I/O, The final chapter on working with files goes further than many will need to venture but it is still worth knowing where to find explanations and examples of memory mapping and general optimizations.
Chapter 5 starts a run of chapters on process management. It introduces the fundamental idea of a process and explains the fork operation. Chapter 6 pushes on into the same territory with a look at advanced processes including real-time. Chapter 7 brings the discussion to a close with a look at threading, including the POSIX threading API Pthreads, and a look at processor affinity.
Chapter 8 is probably should be logically closer to the file I/O chapters as it deals with file and directory management. You may know how to open and read a file, but operating systems generally provide APIs for doing things like copying, deleting, creating files and folders.
Chapter 9 is about memory management and explains address space, pages, getting memory and releasing memory. Chapter 10 is about signals - a sort of software interrupt that has long been part of Unix.
The final chapter deals with the apparently simple, but often complex problem of time in Unix-like systems. It goes as far as POSIX clocks and the high resolution timer.
The first part of the book is highly focused on two big topics - working with files and process management - but after that the topics are a bit more disorganized. Each chapter gives a full detailed discussion of the theory and then some short example of how to make use of the API being introduced. Don't expect any big examples as they would miss the point completely - this is about getting to grips with the tiny details of using the APIs, not general application architecture. There are also some notable omissions like networking, but my guess is there is another book in the pipeline.
Recommended if you want to work with Linux in C.