Novell Home

Cool Solutions For Developers - Linux Developer Bookshelf

Novell Cool Solutions: Feature
By Darren R. Davis

Digg This - Slashdot This

Posted: 18 May 2005
 

Cool Solutions For Developers - Linux Developer Bookshelf
Darren R. Davis
Senior Software Engineer, Novell, Inc.

I just recently gave developer presentations at Novell BrainShare 2005, and whew, am I glad that is over. While giving my presentations on porting and migrating software to SUSE Linux and the Linux Standard Base, I was often asked about good books on the topic of Linux development. Well, I would say there are three books that every Linux Developer should have on their bookshelf. First is Linux Kernel Development Second Edition by Robert Love (Novell Press ISBN 0-672-32720-1). The second is Linux Application Development by Michael K. Johnson and Erik W. Troan (Addison-Wesley ISBN 0-321-21914-7). The third is Building Applications with the Linux Standard Base by the core members of the LSB team (IBM Press ISBN 0-13-145695-4).

Linux Kernel Development Second Edition

When developing for Linux there are several areas in which that the developer need be knowledgeable. First, the developer needs to have at least a basic understanding in how the Linux kernel works, and what it provides them. Robert's book Linux Kernel Development gives the developer and excellent understanding of the operations of the Linux kernel. In Chapter One of the book, he gives a good introduction to the Linux kernel and how it differs from the historical Unix kernels. In Chapter Two he directs the reader to go grab the kernel sources from Kernel.org. After you have the kernel source in hand, you are then instructed in how to configure and build the kernel. With that knowledge, the reader is then ready to start exploring the various subsystems that make up the Linux Kernel.

Chapter's Three and Four begin the discussion of the fundamental unit of execution in Linux, the process. In every computer system the user applications are made up of running programs called processes. Chapter Three discusses Linux process management, where as Chapter Four describes how processes are scheduled for execution by the Linux kernel. Process management also includes a discussion on how threads are implemented by the Linux kernel. With an understanding of the process model in Linux, the reader is then ready to learn how the Linux kernel provides services to applications through system calls and it is discussed in Chapter Five. The Linux system is modeled on POSIX and the work of the Single Unix Specification. This is also a good time to plug the Free Standards Group's work on the Linux Standard Base which is using these standards in the process of standardizing Linux. I will be covering the LSB in an article next month, so watch for it!

With the understanding of processes and systems calls, the reader is ready to explore other areas of the Linux kernel operation. Chapter Six goes into interrupts and interrupt handlers with Chapter Seven discussing bottom halves and deferring work. Bottom halves are a way that interrupt handlers are divided up with the interrupt handler executing only the necessary work as quickly as possible and deferring work to be done in the bottom halves. Chapters Eight and Nine go into kernel synchronization and methods for performing synchronization. Synchronization is absolutely essential in the operation of the Linux kernel with it's multi-thread multiprocessor support model. One wrong turn, and the whole Linux kernel could lock-up, or panic. Chapter Ten gives an excellent discussion on how the Linux kernel performs time management and handles system timers.

The Linux or Unix kernel is responsible for managing the various resources of the computer. With the resources of the CPU covered by the earlier Chapters, we are ready to explore how Linux manages the other resources your computer provides such as memory and I/O storage. Chapter Eleven discusses memory management and how memory allocation is performed by the system calls kmalloc() and vmalloc(). It also discusses how memory is maintained in multiprocessor systems. Another key element that was implemented in Unix and Linux is the Virtual File System layer or VFS. VFS is a mechanism that abstracts file system access from the implementation of data storage. This is useful in the case where storage can either be local on a disk or available across a network through a network or distributed file system. With knowing how the VFS layer works, the reader is ready to learn about the Block I/O layer in Chapter Thirteen and how a block device like a disk works in Linux.

Chapter Fourteen goes into how the Process Address Space works and Chapter Fifteen discusses the page cache and page writeback. With all this ground work laid, it is time in Chapter Sixteen to discuss how Loadable Kernel Modules work. The reader is taken through an excellent exercise in building the "Hello, World!" kernel module and loading it into their kernel. Chapter Seventeen discusses a significant new feature in the 2.6 version of the Linux kernel called kobjects and sysfs. This provides for a new unified device model for Linux. Since the reader is now exploring loadable kernel modules it is a good time in the book to discuss kernel debugging. Chapter Eighteen discusses Linux Kernel Debugging. Chapter Nineteen goes into a discussion about portability which is a theme in all three of the books recommended here. I feel that it is very important for all developers to make sure their code is portable to Linux platforms running any processor. SUSE Linux supports seven architectures today, and the developer should at least test their application on another platform such as Itanium or PowerPC even if they have no plans on selling it on that platform. Portable code tends to be better written and easier to maintain. The book ends with a discussion on how the Linux community works together to move the Linux kernel forward.

With a good understanding of how the Linux kernel works, it is time to investigate Linux Application Development.

Linux Application Development

The book Linux Application Development is an excellent resource for any developer looking to develop on Linux. The book is on the larger side and is packed full of information on developing to Linux. The book is actually broken down into four parts. Part One gets the developer started, Part Two covers Development Tools and Environment, Part Three covers System Programming, and Part Four covers the Development Libraries. Lets explore these a little deeper.

First thing the book does in Chapter One is give a history of Linux development. It is always good to understand the past so that you can better understand where things are going. Every good discussion on Linux and Open Source will include a discussion on Licenses and Copyrights. This is center to the Free and Open Source software movements. Chapter Three tells the reader how to use the online documentation that is available in all Linux systems. With this groundwork laid, it is time for the next section of the book which covers development tools and environment. Chapter Four covers development tools and highlights GUI development with tools like KDevelop and Eclipse as well as the old standby tools like vi and Emacs. Chapter Five covers the standard C and C++ compiler used in Linux, GCC. Linux takes advantage of many of the GNU Project tools and libraries such as the GNU C Library. Chapter Seven discusses memory debugging tools which is needed by every developer. One of the tools covered is Valgrind, a very good x86-specific memory debugging tool. There are several others covered as well. Chapter Eight helps the developer understand how to create and use their own libraries. Chapter Nine discusses the Linux System Environment and is a very shortened version of the material covered in the previous book mentioned.

With developer tools covered, part three of the book goes into system programming. This starts with the process model in Chapter Ten. Chapter Eleven discusses simple file handling which is the core idea in Unix and Linux. Unix created the idea of the system resources being accessed like a file. Chapter Twelve discusses another central idea called signals and gives a discussion on signal processing. With an understanding of simple file handling and signals, the developer goes into a deeper discussion of advanced file handling with things like multiplexing of I/O and memory mapping of files. After the discussion on files, Chapter Fourteen goes into Directory operations. Job control is a central idea to many computer systems and job control was standardized by POSIX. Chapter Fifteen covers Job control. In spite of the modern GUI environments, Terminals and Pseudo Terminals are still very much used and is covered in Chapter Sixteen. Next is a good discussion on Networking with Sockets. Sockets are a networking idea that was first introduced in BSD Unix and has been adopted as the standard API for most Unix systems. Chapter Eighteen covers how Linux handles Time and Dates, and Chapter Nineteen covers Random Numbers. Another feature that Linux adopted from Unix is virtual consoles. Chapter Twenty goes into programming virtual consoles, and the next logical discussion would be the Linux Console which is covered in Chapter Twenty One. The section on developer tools ends with a good discussion on writing secure programs and also include information on how to write daemon processes. A central theme in Unix and Unix like systems.

The last part of the book, Part Four, is all about Development Libraries. Many development libraries are included in Linux and many functions are provided for developer use. Chapter Twenty Three covers and important part of programming, string matching and regular expression handling. Chapter Twenty Four covers a useful topic for developers developing terminal based applications, the S-Lang library. The S-Lang library was developed by John E. Davis and provides an excellent terminal handling capability. Chapter Twenty Five covers another important topic for developers, the Hashed Database Library. There are several libraries available for developers that need some sort of binary database like storage depending on the license model used. Another topic that is needed by developers of command line and terminal based applications is parsing command line options. Parsing is covered in Chapter Twenty Six. The Linux systems uses dynamic shared object libraries for the system libraries. Chapter Twenty Seven goes into dynamic loading of shared objects at run time. The Linux security model has support for multiple users in the system, and these users are represented as unique identifier numbers. Chapter Twenty Eight helps the developer understand user identification and authentication in Linux. That rounds out the book Linux Application Development. Again, this book covers a lot of material for the developer and is useful not only in learning, but as a reference as well.

Every developer developing applications for Linux should investigate the Linux Standard Base. The next book gives the developer what they need to understand and use the LSB.

Building Applications with the Linux Standard Base

Building Applications with the Linux Standard Base is a book that was developed by the core members of the LSB team. It gives a developer a good understanding of how to develop or port an application that is compliant with the LSB specification. Why the LSB? The LSB is an organization that is supported by all major vendors in the Linux market. The LSB has the goal of creating an Application Binary Interface specification for Linux. This means that a developer that builds and application to the LSB specification can be assured that it will run unmodified on all LSB compliant Linux systems for the same processor architecture (currently seven are supported). This gives the Linux market the ability to have "shrink-wrapped" Linux applications.

The book Building Application with the Linux Standard Base is divided into multiple parts as well. Chapter One of the book gives the developer and understanding of the LSB. It covers the background and organization of the LSB and it's benefits to the Linux developer. With the goal of achieving binary compatibility, Chapter Two describes how the LSB can ensure binary compatibility. The LSB builds on the groundwork created by IEEE with the POSIX specification and describes the Unix industries effort around the Single Unix Specification. With this history covered, the next part of the book covers Developing LSB Applications. This begins with Chapter Three covering Using LSB Coding Practices. The LSB is currently focused on C and C++ application development. Other languages either have their own binary standards such as Java, or may be covered in the future with revisions to the LSB specification.

Chapter Four gives a quick discussion on Packaging Your LSB Application. The LSB specification states that Linux applications should be packaged using the RPM Packaging method. The book points the reader at an excellent resource for learning RPM packaging, the book Maximum RPM which can be downloaded from the RPM website. When packages are built for Linux, there is a specification that describes where files should be located in the file system called the Filesystem Hierarchy Standard. Following the FHS specification is very important for developers of Linux applications. There is also a name registry organization that is part of the Free Standards Group called LANANA, which is used for reserving your corporate name in the Linux name space. Chapter Five of the book discusses Migrating Solaris Applications to Linux. This section goes into detail on how things like threads and signals differ between Solaris (Unix) and Linux. It also talks about portability issues and differences between the GNU C compiler and the one provided by Sun for Solaris.

After you have built or ported your application to Linux, it is time to investigate certifying for the LSB. Chapter Six covers LSB Certification for Linux Distributions. That is the certification that Novell goes through for SUSE Linux. Chapter Seven covers LSB Certification for Software Products. That is the certification that applications receive. The important thing to remember about the LSB is that it is not only a specification, but it is a process that the industry can follow for updating the LSB specification. The next section of the book covers how to contribute to the LSB project and starts with Chapter Eight discussing adding new interfaces to the LSB written specification. Chapter Nine covers adding new architectures to the LSB portfolio.

Following industry specifications can seem like a daunting task at times. Chapter Ten gives the developer a good understanding of using the LSB written specification. The LSB is not only a specification, and a process to update the specification, but it also gives the developer many tools for developing and testing LSB applications. Chapter Eleven helps the developer in using the LSB test suites. Chapter Twelve helps the developer in using the sample implementation. Part of the tools the LSB provides to developers is an LSB Development Environment. Chapter Thirteen helps the developer in using the LSB Development Environment with Chapter Fourteen covering the use of the Application Battery. The Application Battery is a collection of open source applications that have been updated to comply with the LSB specification. The developer can learn a lot from examining the Application Battery.

The LSB is a key element for the future success of Linux as a widespread competitive platform for developers and users.

Summary

There are many good books on Linux Development available today, and there are many ways to develop for Linux. I believe that when a developer looks to begin development for the Linux platform, they should understand the basic services available from GNU and Linux both from the kernel and user space libraries. It is also very important to understand where Linux is going and how to build good portable and stable Linux applications than can run on all LSB compliant distributions. These three books are an excellent read to get the developer on the way to making the most of the Linux developer platform.

Resource List

Linux Kernel Development Second Edition by Robert Love

Linux Application Development by Michael K. Johnson and Erik W. Troan

Building Applications with the Linux Standard Base by the core members of the LSB team


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell