Chapter 25. Shared Memory

Whether the data exists in the form of a table or some other format, separate processes can share data using the shared memory resource. This chapter will look at the mechanics of how processes share memory—how it is created, established, and destroyed.

A utility program dubbed globvar is presented in module form to illustrate the use of shared memory in an actual application. This utility is designed to permit shell programs to share global variables using shared memory. This differs from the exported shell environment variables, which cannot be altered by child processes of the shell. Any process using globvar may inquire or alter the value of a global variable.

Get Advanced UNIX Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.