A review of Linux System Programming, by

429 pages.
Publisher: O'Reilly - May 10, 2013
ISBN-10: 9781449339531
2★★☆☆☆

This book was part of a review package received as part of the O'Reilly User Group program. Some of the paragraphs start with alphanumerical codes, like 665.180b that seem like they might be stray formatting codes. It is possible the book they sent was a misprint which, seeing as we received it for free, would be fair. In any case, they do not detract from the value of the book.

Linux System Programming aims to give a tour of kernel functionality useful to systems programmers. By necessity, it also touches quite a bit of GNU libc. Where necessary, it explains how library functions relate to kernel functionality, e.g. malloc is explained in terms of brk and anonymous mmap

The book is very thorough, outlining the canonical system call, its history including deprecated predecessors, and, if they exist, more modern POSIX or Linux-specific alternatives.

While the book is thorough, it is not very complete. Network programming is not discussed at all, neither are pipes, FIFOs or any kind of IPC (other than the suggestion that signal handlers can be used as an IPC mechanism). It invites the question what kind of system the author is programming.

IO seems to be the theme; a large section of the book is dedicated to stdio stream IO, even though it's properly part of the C standard, and not specific to Linux at all. The author then moves on to advanced topics such as memory-mapping, posix_fadvise and more.

The book also reduces concepts like IO elevators and scheduling algorithms to easily understood descriptions, and here is where the author's Linux kernel expertise really shines through.

But the book takes a strange turn when the author suggests that IO-heavy user-space processes can speed up disk access by presorting file reads, and provides information about calls, but not a complete algorithm, to do so. While Robert Love is a kernel committer, and I don't question his expertise, it seems to me that this will always be a trade-off between the cost of the additional disk accesses necessary to sort by inode or block number, and the actual speed increase obtained by making disk access more sequential.

This would be reasonably difficult to benchmark, and the author's advice on when it makes sense to apply this technique is very sparse.

It's not just networking and IPC that are not covered, there are other omissions. POSIX aio is mentioned only in passing, even though it's fairly tricky, and a good authoritative text about it would fill a hole in the Linux System programming library.

And in the chapter about signal handlers, the author wistfully speculates about a better signal handling method, that would allow processes to listen to signals by polling a file descriptor. Fortunately, this syscall exists; It's called signalfd, and it was introduced in kernel 2.6. Even though the cover claims that the book was updated for kernel version 3, apparently the chapter about signal handlers and timers wasn't.

In summary, if you're completely new to Unix programming, this book is pretty good. If you're an existing Unix programmer unfamiliar with Linux (let's assume you just stepped out of a time machine) and your main interest is disk IO, it's also good.
Other than that, it's hard to think of anything in this book that isn't covered passably well in the Linux man pages. This is more of a testament to the high overall quality of the Linux man pages than a slight on this book, but personally, I am far more likely to use online documentation as a reference, simply because it's readily available.