original in en Katja Socher
Katja is the German editor of LinuxFocus. She became a Linux user when she was first introduced to Gimp some years ago. Her homepage can be found here.
The book"Beginning Linux Programming - Second Edition" is an introduction to the Linux environment for experienced C programmers who already have some basic knowledge of Linux. The book covers the concepts and ideas the Linux environment has to offer for programmers and also introduces the reader to several excellent programming tools available under Linux like Perl, Tk or Gtk+.
Buying the book you not only get around 2 kg of paper but also a lot of information about a wide range of topics. It is not a book for beginners but a beginning to a wide spectrum of concepts and tools that belong in the field of Linux Programming. Each chapter gives a profound introduction so that after reading you will already know a whole lot about each subject and will be able to solve a lot of tasks by yourself. Of course you won't be an expert in any of the topics after reading the book but often what you know then will be sufficient and you will in any case be able to help yourself with reading the man pages or other documentation which are much more uptodate than a book about so fast changing subjects can ever be.
The authors give us an understanding what can be done best with a particular tool and where each tool is especially well and efficient. You get ideas what is possible and you will know what tools to use and where you have to start to dig deeper to find the solutions you need.
You get a good overview of the many possibilities you have as a programmer under Linux and can then decide for yourself which topic is worth more time, which has the most relevance for you to deserve further studying for becoming a true expert.
Even though it is only a beginning it covers so much that after reading you will again and again use it as a reference when you are looking for solutions for programming problems or how they can be implemented.
It is clearly a programmer to programmer book where two very experienced Linux programmers share their knowledge with other programmers. They do it with a whole lot of try it out examples which they explain in great detail. Through these examples you get much easier into the material and see how the explained ideas and concepts can be implemented practically. Often you will find that you can use their examples for your programs or can use them with only minor changes. I really welcomed the examples very much for my understanding and exploring of the material.
In addition to the many examples in each of the chapters the authors develop a CD application throughout the book where the newly learnt concepts are implemented and over the chapters the application is more and more extended and improved. I really appreciated a fully written appplication like this which is also explained in detail.
The book begins with a brief introduction on what Linux and its philosophy is and how to use C and its libraries under Linux before it makes a detour to shell programming. After showing some general shell concepts (like redirection and pipes) the books introduces us to the shell as a programming language and the concepts of e.g. variables, conditions, program control, lists, functions, and "here documents" are explained.
Chapter 3 explains the Linux concept of files where everything even hardware devices are mapped on to files. It starts with low-level system calls and in the course of the chapter the authors go on with explaining the Standard I/O library.
Chapter 4 looks at the Linux environment. The authors e.g. talk about command line arguments and environment variables with which you can change the default behaviour of a program. They also show how a program can make use of library functions to manipulate date and time values as well as get information about itself, the user and the computer on which it is running.
The next chapter is about terminals and about different aspects how the terminal can be controlled. After this introduction to terminals we learn about the curses library which offers a graphical way to display output on terminal windows.
Chapter 7 on data management talks about dynamic memory management, file locking and the locking of regions of shared files and finally gives an introduction to the dbm database.
In chapter 8 development tools are introduced that make the development and the distribution of programs manageable. First make and makefile to manage multiple source files are explained before looking at source code control using RCS and CVS. Finally patch, tar and gzip are mentioned which are used for distributing and updating programs.
Chapter 9 is about debugging. After talking about general debugging techniques the GNU debugger gdb is introduced. Static analysis tools such as cflow and lclint are also mentioned. Finally Electric Fence and Checker are covered, two utilities which can help to prevent memory leaks.
Chapter 10 deals with processes and signals which control almost all activities performed by a linux computer system. It starts with the process structure and then goes on with explaining how new processes can be started with the fork system call. Then the program interface for signals is introduced to the reader with a few examples.
Chapter 11 is about Posix Threads. It starts by explaining the difference to processes and then introduces mutexes and semaphores needed to write more complex multithreaded programs.
The next chapters deal with interprocess communication. At first pipes are explained. Normal unnamed pipes, named pipes (FIFOs) and how data can be passed between unrelated programs is discussed.
Then semaphores, shared memory and message queues are covered. Semaphores are needed to avoid that two processes access on critical sections simultaneously and are necessary for the use of shared memory which is an efficient way of sharing and passing data between multiple processes. Message queues provide a reasonable easy and efficient way of passing data between two unrelated processes.
Finally sockets are explained which can be used like pipes but are running on a network.
Chapter 15 covers Tcl, the Tool Command Language. The authors e.g. talk about the commands and control structures, strings and lists in Tcl, input and output as well as Tcl extensions and applications.
After a brief overview about X we learn about Tk, the graphical toolkit for Tcl in the next chapter. We are introduced to the many widgets Tk offers like frames, labels, buttons, boxes, scrollbars, scales, text and canvas. An example of a fifteen piece image puzzle is given and the concepts of menus, dialoges, color schemes, fonts, binding, geometry management and focus and navigation are explained.
Next we learn about Gnome and Gtk+. We hear about the Gnome architecture and the Gnome desktop, programming for Gnome using Gtk+ and then learn about the Gtk+ widget set. The possibilities are enormous and even bigger than under Tk. The authors also develop an application for Gnome: A Gnome analogue clock.
The next chapter is a very short introduction to basic Perl programming.
Chapter 19 teaches the basics of HTML and serves as an introduction to CGI programming which is covered in the following chapter. There the authors tell us how to create the forms in HTML needed on the client side and then how to transmit the information to the server side, decode them in C or Perl and respond dynamically back to the client.
The book ends with a chapter on device drivers that gives an overview on how they are written. It talks e.g. about character and block devices as well as how you can debug code in the kernel.
If you are a system administrator, a programmer or a true Linux lover you will surely love the book.