Home > Store

Interprocess Communications in Linux: The Nooks and Crannies

Register your product to gain access to bonus material or receive a coupon.

Interprocess Communications in Linux: The Nooks and Crannies

Book

  • Sorry, this book is no longer in print.
Not for Sale

About

Features

The definitive guide to interprocess communication for Linux - a must-have for serious software developers and sys admins!

° Covers every aspect of Linux interprocess communications in detail

° Zeroes right in on the key techniques of processes and interprocess communication (IPC) - from primitive communications to the complexities of sockets

° Explains Linux internals to sys admins and advanced IPC techniques to software developers

Description

  • Copyright 2003
  • Edition: 1st
  • Book
  • ISBN-10: 0-13-046042-7
  • ISBN-13: 978-0-13-046042-4

Understanding the concepts of processes and interprocess communications (IPC) is fundamental to developing software for Linux. This book zeroes right in on the key techniques of processes and interprocess communication - from primitive communications to the complexities of sockets. It covers every aspect of UNIX/Linux interprocess communications in sufficient detail to allow experienced programmers to begin writing useful code immediately. The book also includes a precise description of the basics of network programming that make this one of the best introductory books on UNIX/Linux network programming using sockets. Grey explains exactly what processes are, how they are generated, how they can access their own environments, and how they can communicate with other processes. From beginning to end, the book truly leads you through the "nooks and crannies" of UNIX - making you a dramatically more effective programmer. Rave reviews for UNIX companion volume-- "I really like this book!!! Concepts that I only vaguely understood now make complete sense to me! The sample code and exercises are so good, they seem to clamp down on the concepts like a vise grip..." S. Lee Henry, Johns Hopkins University.

Extras

Links

There are countless sites on the Internet that deal with Linux and all its variants. It is virtually impossible to generate a list of these sites without leaving out at least one (or more) URLs for which someone will take you to task. This aside, the list below (in no particular order of importance) provides a good starting point. For additional locations and supporting sites, try searching the Internet for the terms GNU, GNU/Linux, Linux, and so on, using any one of the high-powered search engines (e.g., Google, Dogpile, etc.).

Sample Content

Downloadable Sample Chapter

Download the Sample Chapter related to this title.

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.

Preface

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).

Index

Download the Index file related to this title.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020