Rate this page del.icio.us  Digg slashdot StumbleUpon

Book review: The Linux Programmer’s Toolbox

by Christopher Smith

The Linux Programmers Toolbox

The Linux Programmer’s Toolbox
Author: John Fusco
Publisher: Prentice Hall Open Source Software Development Series
Publication date: May 6, 2007

The Linux Programmers Toolbox provides a thorough introduction on the essential C and C++ development tools packaged with common
modern Linux distributions. It is predominantly geared towards programmers who are new to the Linux platform, but power users and systems engineers perk up–there is enough cross-discipline information to absolutely warrant a closer look.

The book is authored by John Fusco, a software developer for GE Healthcare. His industry knowledge shines through in the finished product, taking both developers and power users towards a deeper understanding of how to use Linux in the development environment. While not organized as such, the text seems to fall naturally into two sections, and we’ll examine them in order.

Section I: Foundation and Background

The first four chapters deliver introductory material essential for new Linux users or developers familiar with other platforms. If you are familiar with Linux, some of this material will be largely review. It contains details about everything from how to identify and use various package managers to which utilities read and tidy source code.

Chapter 1: Downloading and Installing Open Source Tools

In Chapter 1, John does an excellent job discussing the –querytags option of the rpm command and demonstrates a situation where you might use its features (although I believe his example is missing a “\n” from his custom query tag). I use this consistently to try to indentify packages on systems that are not part of its base distribution, like so:

rpm -qa --qf '%vendorn' | sort | uniq -c
     1 Adobe Systems, Incorporated
   12 (none)
     1 RealNetworks, Inc
838 Red Hat, Inc.
     1 Sun Microsystems

His coverage of apt, yum, and synaptic is equally as good. This discussion of package managers naturally evolves into a section on GPG signatures and package security, a subject near and dear to my heart. This is another example of one of the things that I liked about this book–its conversational nature lends itself well to the subject matter.

Chapter 2: Building from Source

Chapter 2 contains a succinct discussion of the make command and its associated Makefile conventions. While this is not something that systems engineers or power users end up having to face on a frequent basis, if you’ve ever had to build vendor software or a third-party package this section will be of use to you.

Chapter 3: Finding Help and Editing and Maintaining Source Files

Chapter 3 provides content that helps users new to Linux locate things like man and info pages as well as kernel documentation. If you regularly use Linux you won’t find anything here that you haven’t seen elsewhere. However, its brevity (approximately 40 pages) and breadth of coverage are designed teach the reader how to find and reference materials mentioned in later chapters.

Chapter 4: Editing and Maintaining Source Files

Chapter 4 is a bit eclectic, coupling discussion topics like text editors, revision control, and tips on how to edit, view, and browse source code. If you are an established Linux system administrator or developer (as is the case for me) this chapter will probably be of less help to you than the rest of the text. Its coverage on text editors and revision control isn’t terribly in depth (although this is clearly by design, as there are much better sources for this information) and introductory in nature.

Section II: System and Development Topics

With the introductory material out of the way, this is where this book really shines. The remaining six chapters deal extensively with lower-level system details about the kernel, system processes, IPC, and performance tuning and debugging. Fusco does an excellent job relating complicated Linux-specific details in a way that is both technical and easy-to-understand.

Chapter 5: What Every Developer Should Know about the Kernel

I believe this chapter should be titled “What every Linux Engineer Should Know about the Kernel”. It covers topics such as the process scheduler, memory management, and user mode versus kernel mode. The coverage of memory management was especially comprehensive with multiple concrete examples to help demonstrate essential concepts such as process virtual memory management and what happens when a system runs out of memory.

Chapter 6: Understanding Processes

Follows the life cycle of a process from the Linux 'init' process to its eventual demise, covering fork, vfork, exec, and clone–along with some discussion of the tools to manage them. I had never really looked under the covers of the 'ps' command, but the discussion of advanced proc formats and using the 'pmap' command to track process memory usage was particularly interesting.

Chapter 7 & 8: Communication between Processes / Debugging IPC with Shell Commands

These chapters read well together (and Chapter 8 is short), so I will include them together here. Interprocess communication (IPC) is described in detail in its various forms. Using both C and UNIX utility, Fusco provides a number of solid examples to manipulate and code towards types of IPC. I particularly liked the coverage on shared memory and the discussion of its multiple APIs and the results and impact of choosing one over the other. In Chapter 8 there is an excellent example of how to trace a network socket to an inode–particularly useful if you’re trying to trace down an issue with an open file.

Chapter 9: Performance Tuning

The performance tuning chapter has a great deal of detail about diagnosing slow application issues at both the application and the system level. He writes a program affectionately called ‘hog’ (or some derivative thereof) that goes about creating memory issues that are viewed in context of things like paging versus swapping and memory utilization. This and the examples that follow it are all very well explained and portable. It was very easy to work alongside it with my own system.

Chapter 10. Debugging

Excellent coverage of both valgrind and gdb along with supporting coverage of a wealth of tools such as mtrace, memusage, and objdump. All of these things are necessary tools for a Linux developer debugging code, but this content is also exceptionally useful to a systems engineer who is debugging complex process behavior, profiling memory, or performing other similar tasks.

To sum up, this book makes an excellent tutorial for developers that are new to the Linux space. However, Fusco’s use of excellent examples and clear and concise writing captures material that is essential to a deeper understanding of Linux for both system engineers and power users. I highly recommend it.

About the author

Christopher Smith has worked with Linux for over a decade, consulting at private industry, government, and academic institutions. He currently works as a Principal Systems Engineer on Red Hat’s Global Infrastructure Team, deploying high availability Linux solutions.

One response to “Book review: The Linux Programmer’s Toolbox

  1. siddarda says:

    I want this tutorial

Leave a reply