Beginning Linux Programming
Authors: Neil Matthew and Richard Stones
Publisher: Wrox Press
Reviewer: Mark Shacklette
Every once in a while a book appears which so perfectly fills a void that its acceptance is all but guaranteed. For Linux programmers or anyone interested in learning Unix programming, there is a new volume to add to your library: Beginning Linux Programming by Neil Matthew and Richard Stones. The book is an achievement both in terms of its subject coverage as well as its surprising depth for a text whose focus, as the title states, is the neophyte. The authors' aim is “to cover enough about a wide range of topics to give you a good beginning in each subject.” In this they succeed magnificently. Inside are full chapters on shell programming (/bin/sh), an introduction to the Unix file system, terminal I/O, the curses library and a chapter on processes and signals. There is a chapter on how to use the GNU gcc compiler, the gdb debugger, make, RCS and other development tools. (They even teach you the basics of how to write a man page for all those new applications you'll write after mastering Linux programming.) The authors cover Linux's X/Open-compliant dbm database (some distributions have gdbm, the GNU flavor of dbm). They devote one hundred and fourteen pages to interprocess communication alone, including pipes, FIFOs, System V IPC (Semaphores, Message Queues, Shared Memory) and Berkeley sockets. There is a 93-page introduction to X programming which focuses primarily on Tcl, Tk and Wish, along with a sip of Java. The book concludes with two chapters devoted to Internet programming, one covering HTML and the other CGI.
With such a vast scope, something had to be left out. Coverage of Expect is assigned to two short paragraphs. Python is missing, as is the majority of Motif programming outside of Tcl/Tk (Xlib and Xt are only mentioned in passing). The only coverage of Perl is an example CGI script, and the section on Java could pass by you entirely, if your nose is not careful to pick up the scent of the fresh brew at the close of the discussion of X programming. (Interesting that Java is appended to X programming, not the Internet programming chapters.) Nevertheless, such focus is necessary to avoid a text of several volumes and to concentrate on the omissions would be to miss the point of the work, which is to introduce you to Linux programming through the use of hands-on code examples, which are graduated and presented in a step-by-step fashion. Each new topic is presented in a few short paragraphs and is followed by a succinct but complete “Try It Out” code example.
Over 10,000 lines of source code fill the pages, all of which are available for download (the ubiquitous CD is missing from the back cover). With such a supply of source code, the usual peccadilloes occur, such as a case statement in the section on shell programming, that lists the case as “[nN]*” (with quotes) instead of [nN]* without the quotation marks (the former fails if you enter anything beginning with a n or a N); or when, during the discussion of pipes, the line:
sprintf(buffer, "Once apon a time, there ..."\n)
is magically spell-checked to “Once upon a time” in the book's output listing (unfortunately, my compiler isn't as smart as the editors and keeps the spelling as “apon”). All in all, the source code compiles and runs fine. Wrox Press, the publisher, has the source and a sample chapter on its web site for your perusal, at http://www.wrox.com/.
The example code gets to the point. The authors present the minimum amount of code to illustrate an idea which, once given, is quickly summarized as they move on to the next extrapolation or improvement. This approach allows the new Linux programmer to get a firm grasp on the subject without too much diversion or interdependence. All examples are self-contained and may be compiled and run—there are no code fragments here. Such an approach facilitates and encourages the reader to experiment with the code examples, since they are so confined few side effects can be introduced, even by the most intrepid of newbies.
Although most of the examples are focused, the authors do present and develop a larger application that implements a simple audio CD cataloging program. The application begins life early in Chapter 2 as an extremely simple shell script that exercises the use of flow-control statements in shell programming and uses simple text files for a database. The application reappears in Chapter 6. This time rewritten in C with the same functionality as the shell script version and with a new interface designed to exercise the curses terminal library. In Chapter 7, the application acquires a real database, dbm. In Chapter 11, the application evolves into a small client-server system, which separates the database from the user interface through the use of named pipes. This example illustrates process synchronization and bi-directional data flow between a single server and multiple clients. In Chapter 12, the application substitutes a message queue for the named pipes from the previous chapter, which solves some problems with I/O synchronization previously encountered with named pipes. Finally, the CD application takes to the Web in Chapter 17 as an example of an HTML interface talking out a CGI layer to the database server. This chameleon-like application greatly enhances the communication of many of the principles presented in the book.
In short, Beginning Linux Programming is a tutorial on the major topics in Linux programming. If you are willing to spend some time getting up to speed, you will find yourself with a book that not only will hold your hand in the midst of the Magic Garden, but will eventually provide you with a fine pair of walking shoes, well preparing you for your own explorations. With this book at your side, as my son's beginning reader puts it:
You have brains in your head.You have feet in your shoes.You can steer yourselfany direction you choose.
Mark Shacklette is a Principal with Lake Shore MicroTech Group, a Chicago-based consultancy specializing in client-server development in Unix and Windows NT. When he's not with a client, he works on his Ph.D. in the “Committee on Social Thought” at the University of Chicago. He lives in Des Plaines, Illinois with his wife Karen, son David and two cats. He can be reached at firstname.lastname@example.org.
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?
|Designing Electronics with Linux||May 22, 2013|
|Dynamic DNS—an Object Lesson in Problem Solving||May 21, 2013|
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
- RSS Feeds
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- New Products
- A Topic for Discussion - Open Source Feature-Richness?
- Designing Electronics with Linux
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Validate an E-Mail Address with PHP, the Right Way
- What's the tweeting protocol?
- Kernel Problem
2 hours 50 min ago
- BASH script to log IPs on public web server
7 hours 17 min ago
10 hours 53 min ago
- Reply to comment | Linux Journal
11 hours 25 min ago
- All the articles you talked
13 hours 49 min ago
- All the articles you talked
13 hours 52 min ago
- All the articles you talked
13 hours 53 min ago
18 hours 18 min ago
- Keeping track of IP address
20 hours 9 min ago
- Roll your own dynamic dns
1 day 1 hour ago