Recently, I got hold of a book named Linux Debugging and Performance Tuning (Tips and Techniques) by Steve Best. The book positions itself as a programmers guide to debugging and ways of increasing the performance of the programs that you write. The book explores the various tools that a programmer can access to iron out the bugs that crop up in the programs that he writes.
The author starts the narration with a chapter on profiling. Profiling is the art of seeking the time taken by a program or a part there of on execution. A wide variety of tools are covered in this chapter which the programmer can use for the purpose. For instance, on reading this chapter, I came to know how you can use the ubiquitous 'date' utility for profiling your programs.
The next chapter dwells on code coverage analysis - which is the process of finding and targeting dead or unexercised code.
There is a special chapter on the versatile GNU debugger (gdb) which should be included in the tool box of any serious Linux programmer. In fact the author with the aid of example code hand holds the reader on steps to be taken to debug a program. A special section of the chapter also lists helpful hints for debugging an application more quickly.
If you are a programmer, then I need not tell you the importance of keeping the memory footprint of your program to a minimum. You also have the unenviable job of hunting down and doing away with the memory leaks hogging your program. The fourth chapter of this book deals with ways to curb memory leaks by using various free memory leak detection programs like MEMWATCH, YAMD, Electric Fence and Valgrind.
The fifth chapter explores the /proc filesystem. Any Linux user will know that the /proc filesystem is a virtual filesystem which resides in the memory and among other things it provides an easy view of the kernel resources and components. This chapter of the book deals with the various tools a user can use to view the system resources like CPU load, memory and so on. The tools covered include but is not limited to vmstat, diskstats,iostats and mpstat.
The next chapter deals with the various system tools that a programmer or system administrator can use to find which component of the system is having a problem. The author also covers the network debugging tools in this chapter.
Chapter seven deals with the subject of system error messages. As you know an OS generates a lot of messages which aid the user/programmer in getting a fair idea of what went wrong and where. This chapter pursues the analysis of a Oops message to find the failing line of code.
If you are a regular visitor to this blog, then you might have read my previous posts on using logging in Linux. Chapter 8 covers this and much more and explains it from a programmers point of view.
Any programmer / system administrator will know the importance of tracing. By tracing, you are able to collect system data in real time (that is when the process is running). A trace can be used to isolate and understand system problems and check where in the system you are faced with bottlenecks. Chapter 9 namely "Linux Trace Toolkit" of this book looks at just that.
As I explained earlier, a profiler is a program which aids the programmer to analyse the performance of applications and the kernel there by help him optimise his programs. Where as in the first chapter, the author had covered how one can profile using simple tools like 'date', here (chapter 10) he explores the use of a more complex profiler tool called oprofile.
The next chapter (chapter 11) is my favourite. It gives a very detailed (but easy to understand) description on UML (User Mode Linux). To those in the dark, UML is a complete Linux kernel which has its own scheduler and virtual memory system. UML has gained the fascination of programmers around the world mainly because it helps the programmer test his applications in a complete isolated Linux environment within the parent OS. The author takes the reader right from an introduction to UML, to patching and building a kernel, booting a UML and UML utilities. I really liked the tips section in this chapter which revealed new insights into the working of UML.
Chapter 12 deals with the topic of Dynamic Probes. They help a programmer in acquiring diagnostic information without including special blocks of code in the program. Dynamic probes can also be used as a tracing mechanism for both user and kernel space.
If chapter 3 dealt with GNU debugger (gdb), chapter 13 deals with kernel level debuggers. This chapter covers two kernel level debuggers kgdb and kdb.
The final chapter of this book (chapter 14) deals with the topic of Crash Dump. A crash dump is designed to meet the needs of end users, support personnel and system administrators who need a reliable method of detecting, saving and examining system problems. The author covers this topic with elan.
Things I liked about this book
- Each chapter contains complete (but simple) programs which are used by the author to explain how to use a set of tools to tackle a problem.
- This book takes a hands-on approach to tackling problems that a programmer or system administrator might face in his work.
- No complex jargon has been used by the author while explaining the concepts which brings it to the ambit of even fresh programmers.
- There is something for everybody - from a newbie in Linux programming to an expert programmer.
- At the end of each chapter, there is a section which lists the web resources where the reader can find more information about the topic covered.
- The tools covered in this book range from the ubiquitous to the specialist ones. In fact the author throws light on each and every tool covered in this book with the aid of examples.
This wonderful book has been authored by Steve Best. He works in the Linux Technology Center of IBM in Austin, Texas. He is currently working on Linux storage-related products. Some of the achievements of Steve are as follows:
- Has led the Journaled File System (JFS) for Linux project.
- Has worked on Linux-related projects since 1999 and has done extensive work in operating system development focusing on file systems, internationalization, and security.
- He is the author of numerous magazine articles, many presentations, and the file system chapters in Performance Tuning Linux Servers (Prentice Hall PTR 2005).
Publisher Name : Prentice Hall (Professional Technical Reference)
ISBN No: 0-13-149247-0
No of Pages : 430
Price : Check at Amazon
Intended Audience : Beginners, Intermediates and Experts alike
Believe me, writing a book is a very tough job. Here, Steve has done a wonderful job of compiling this book which can be an asset in the hands of a programmer in Linux. There are even chapters which will help system administrators tackle hard to understand problems they encounter in their work with ease. Reading this book has definitely increased and enriched my knowledge about Linux w.r.t the debugging and optimization techniques.