In this part of the book, well review a number of important topics that are important to application development. This includes using the most important elements of GNU/Linux including various IPC mechanisms, Sockets, and multiprocess and multithreaded programming.
Chapter 10, File Handling in GNU/Linux
The file handling APIs are important in GNU/Linux because there are patterns for many other types of I/O, such as sockets and pipes. This chapter demonstrates the proper use of the file handling APIs using binary, character, and string interfaces. Numerous examples illustrate the APIs in their different modes.
Chapter 11, Programming with Pipes
The pipe model of communication is an older aspect of UNIX, but it is still an important one, considering its wide use in shell programming. The pipe model is first reviewed, with discussion of anonymous and named pipes. The API to create pipes is discussed, along with examples of using pipes for multiprocess communication. Shell-level creation and use of pipes complete this chapter.
Chapter 12, Introduction to Sockets Programming
Network programming using the standard Sockets API is the focus of this chapter. Each of the API functions is detailed, illustrating their use in both client and server systems. After a discussion of the Sockets programming paradigm and each of the API functions, other elements of Sockets programming are discussed, including multilanguage aspects.
Chapter 13, GNU/Linux Process Model
The GNU/Linux process model refers to the standard multiprocessing environment. We discuss the fork function (to create child processes) and the other process- related API functions (such as wait ). The topic of signals is also discussed, including the range of signals and their uses. Finally, the GNU/Linux process commands (such as ps ) are detailed.
Chapter 14, POSIX Threads (Pthreads) Programming
Programming with threads using the pthreads library is the topic of this chapter. The functions in the pthreads library are discussed, including thread creation and destruction, synchronization (with mutexes and condition variables ), communication, and other thread-related topics. Problems in multithreaded applications are also discussed, such as reentrancy.
Chapter 15, IPC with Message Queues
Message queues are a very important paradigm for communication in multiprocess applications. The model permits one-to-many and many-to-one communication and a very simple and intuitive API. This chapter details the message queue APIs for creating, configuring, and then sending and receiving messages. Advanced topics such as conditional message receipt are also discussed, along with user layer utilities for message queue inspection.
Chapter 16, Synchronization with Semaphores
Semaphores in GNU/Linux and the ability to create critical sections are the topics of this chapter. After a discussion of the problems that semaphores solve, the API for semaphores is detailed, including creation, acquisition, release, and removal. The advanced features provided by GNU/Linux such as semaphore arrays are discussed, including user-level commands to inspect and remove semaphores.
Chapter 17, Shared Memory Programming
One of the most important process communication mechanisms available in GNU/Linux is shared memory. The shared memory APIs allow segments of memory to be created and then shared between two or more processes. This chapter details the shared memory APIs for creating, attaching, detaching, locking, and unlocking shared memory segments.
Chapter 18, Other Application Development Topics