Interprocess Communications in Linux The Nooks and Crannies

by
Edition: 1st
Format: Paperback
Pub. Date: 2003-01-13
Publisher(s): Prentice Hall
List Price: $54.99

Rent Book

Select for Price
There was a problem. Please try again later.

New Book

We're Sorry
Sold Out

Used Book

We're Sorry
Sold Out

eBook

We're Sorry
Not Available

How Marketplace Works:

  • This item is offered by an independent seller and not shipped from our warehouse
  • Item details like edition and cover design may differ from our description; see seller's comments before ordering.
  • Sellers much confirm and ship within two business days; otherwise, the order will be cancelled and refunded.
  • Marketplace purchases cannot be returned to eCampus.com. Contact the seller directly for inquiries; if no response within two days, contact customer service.
  • Additional shipping costs apply to Marketplace purchases. Review shipping costs at checkout.

Summary

Interprocess Communications in Linuxexplains exactly how to use Linux processes and interprocess communications to build robust, high-performance systems. Coverage includes: named/unnamed pipes, message queues, semaphores, shared memory, RPC and the rpcgen compiler, sockets-based communication, the /proc file system, LinuxThreads POSIX support, multithreading, and much more. Includes detailed exercises, plus dozens of downloadable program examples compiled with GNU C/C++ 2.96 & 3.2 and tested with Red Hat Linux 7.3 & 8.0.

Author Biography

JOHN SHAPLEY GRAY is Professor of Computer Science and Chair of the Interactive Information Technology degree program at the University of Hartford, West Hartford, CT, and principal of Gray Software Development. Gray has been actively involved with UNIX and its derivatives for over 20 years; his course on UNIX internals has become legendary amongst students and developers throughout the greater Hartford area. He is author of the best-selling Interprocess Communications in UNIX, Second Edition, and co-author of C++ Programmer's Notebook.

Table of Contents

Introduction.
Acknowledgments.
1. Programs and Processes.
Introduction. Library Functions. System Calls. Linking Object Code. Managing Failures. Executable File Format. System Memory. Process Memory. The u Area. Process Memory Addresses. Creating a Process. Summary. Key Terms and Concepts.

2. Processing Environment.
Introduction. Process ID. Parent Process ID. Process Group ID. Permissions. Real and Effective User and Group Ids. File System Information. File Information. Process Resource Limits. Signaling Processes. Command-Line Values. Environment Variables. The/proc Filesystem. Summary. Key Terms and Concepts.

3. Using Processes.
Introduction. The fork System Call Revisited. exec's Minions. Using fork and exec Together. Ending a Process. Waiting on Processes. Summary. Key Terms and Concepts.

4. Primitive Communications.
Introduction. Lock Files. Locking Files. More About Signals. Signal and Signal Management Calls. Summary. Key Terms and Concepts.

5. Pipes.
Introduction. Unnamed Pipes. Named Pipes. Summary. Key Terms and Concepts.

6. Message Queues.
Introduction. IPC System Calls: A Synopsis. Creating a Message Queue. Message Queue Control. Message Queue Operations. A Client-Server Message Queue Example. Message Queue Class. Summary. Key Terms and Concepts.

7. Semaphores.
Introduction. Creating and Accessing Semaphore Sets. Semaphore Control. Semaphore Operations. Semaphore Class. Summary. Key Terms and Concepts

8. Shared Memory.
Introduction. Creating a Shared Memory Segment. Shared Memory Control. Shared Memory Operations. Using a File as Shared Memory. Shared Memory Class. Summary. Key Terms and Concepts.

9. Remote Procedure Calls.
Introduction. Executing Remote Commands at a System Level. Executing Remote Commands in a Program. Transforming a Local Function Call into a Remote Procedure. Debugging RPC Applications. Using RPCGEN to Generate Templates and a MAKEFILE. Encoding and Decoding Arbitrary Data Types. Using Broadcasting to Search for an RPC Service. Summary. Key Terms and Concepts.

10. Sockets.
Introduction. Communication Basics. IPC Using Socketpair. Sockets: The Connection-Oriented Paradigm. Sockets: The Connectionless Paradigm. Multiplexing I/O with select. Peeking at Data. Out of Band Messages. Summary. Key Terms and Concepts.

11. Threads.
Introduction. Creating a Thread.Exiting a Thread. Basic Thread Management. Thread Attributes. Scheduling Threads. Using Signals in Threads. Thread Synchronization. Thread-Specific Data. Debugging Multithreaded Programs. Summary. Nomenclature and Key Concepts.

Appendix A. Using Linux Manual Pages.
Manual Page Sections. Manual Page Format. Standard Linux System Calls.

Appendix B. UNIX Error Messages.
Appendix C. RPC Syntax Diagrams.
Introduction. RPC Definitions. RPC Keywords. Some RPC Examples.

Appendix D. Profiling Programs.
Introduction. Sample Program for Profiling. Generating Profile Data. Viewing and Interpreting Profile Data.

Appendix E. Bibliography.
Index.

Excerpts

Preface The topic of interprocess communication techniques is broad, challenging and dynamic. All but the most basic operating systems provide methods for processes communication. Early on, UNIX supported a number of rudimentary process communication constructs (such as lock files, signals and pipes). In the early 1980s, facilities such as message queues, semaphores, and shared memory were added to the mix by AT&T with its release of UNIX System V. Somewhat concurrently, the Berkeley Software Distribution added support for Internet protocols (4.3BSD) and the socket interface as a communication construct. By the mid-1990s, threads and multithreaded programming techniques were making significant, permanent inroads into the UNIX mainstream. Along the way, UNIX spawned innumerable UNIX-like operating systems. One such operating system was MINIX. MINIX, written by Andrew S. Tanenbaum, is a small (about twelve thousand lines) PC version of UNIX. MINIX was presented as a pedagogical tool to permit the user to gain a better understanding of the inner working of a UNIX-like operating system. As all of the operating system source code was provided, the user could tinker with the code and refine its functionality. As a university student, Linus Torvalds'' exposure to MINIX led him to develop a more robust UNIX-like operating system called Linux. In brief, Linux is a freely distributed hybrid version of UNIX. Linux system administration is BSD-like while its programming environment has a definite AT&T flavor. A number of commercial versions of Linux populate the market. These versions bundle Linux with a variety of other operating system related utilities and software packages. One of the more widely distributed commercial versions is Red Hat Linux. Red Hat Linux includes Richard Stallman''s GNU project C (gcc) and C++ (g++) compilers. This text explores the intricacies of interprocess communications as supported by Red Hat Linux version 7.3 and 8.0. It is assumed that the reader has a working knowledge of C/C++ programming. It is further assumed that while not being an expert, the reader has worked in a UNIX type environment and is reasonably familiar with generating and editing text using an editor such as vi or pico (available from the University of Washington). This text makes extensive references to specific system calls and predefined library functions. The reader is encouraged to read the manual pages for each system call/library function as it is encountered. As in UNIX, the manual pages in Linux are an unparalleled source of information. Appendix A covers the format and use of manual pages. All programming references and examples were generated on a PC Pentium-based platform running Red Hat Linux 7.3, using the GNU C/C++ compiler version 2.96. With the release of Red Hat Linux 8.0 and GNU 3.2 the examples were revisited and tweaked where necessary. Many of the examples and most of the exercises have also been compiled and run in a Solaris 2.8 setting using GNU 2.95. Most often, few if any modifications were needed to generate clean, executable code in this alternate environment. Each example is a complete standalone program. Command line examples, except where noted, are Korn shell based. In any setting, IPC (interprocess communication) support must be available for the user to pursue the materials covered in the chapters on semaphores, message queues, and shared memory. When Linux is installed, usually IPC support is enabled (check the /proc directory for the presence of the sysvipc directory). If it is not present you may need to modify system configuration files and recompile the kernel. There are a number of places that one can peruse for information on how this might be done. One source of information is the Configure.help file that resides in the /usr/src/linuxXXXX/Documentation subdirectory (where XXXX is the version of Linux). However, unless you are the system administrator, you most likely will want to seek help when doing this. To work with threads, a POSIX compliant thread library (such as LinuxThreads) must be available. Fortunately, most new versions of Linux come with thread libraries that are distributed with the GNU compiler (check the /usr/lib directory for files names containing pthread, e.g., libpthread.a or libpthread.so).

An electronic version of this book is available through VitalSource.

This book is viewable on PC, Mac, iPhone, iPad, iPod Touch, and most smartphones.

By purchasing, you will be able to view this book online, as well as download it, for the chosen number of days.

Digital License

You are licensing a digital product for a set duration. Durations are set forth in the product description, with "Lifetime" typically meaning five (5) years of online access and permanent download to a supported device. All licenses are non-transferable.

More details can be found here.

A downloadable version of this book is available through the eCampus Reader or compatible Adobe readers.

Applications are available on iOS, Android, PC, Mac, and Windows Mobile platforms.

Please view the compatibility matrix prior to purchase.