Next Previous Contents

1. Introduction

1.1 What is Shared Memory?

Shared memory (SHM) is another method of interprocess communication (IPC) whereby 2 or more processes share a single chunk of memory to communicate. The shared memory system can also be used to set permissions on memory, allowing for things like malloc debuggers to be written.

1.2 Types of Shared memory available

Basically there are two different types of shared memory available for most flavors of UNIX. As you may have guessed, each of the two orignal ancestors of modern UNIX have their own implementation, altough almost all modern UNIX flavors implement both. The names of the respective implementations are System V IPC, and BSD mmap.

1.3 General Principles

Basically using shared memory under both systems will involve the following:

Uniquely naming the segment.

Each implementation has a method establishing a system wide unique name for each segment so that other applications may access it. Both also have methods of procuring private (or "anonymous") segments.

Specifying access permissions.

Both implementations allow you to specify access using the traditional read/write/execute scheme.

Race conditions.

Dealing with race conditions varies under each system. What they do have in common is that race conditions do occurr in each :)

Next Previous Contents