Skip to content

Beej's Guide to Unix IPC

\1. Intro

1.1. Audience

1.2. Platform and Compiler

1.3. Official Homepage

1.4. Email Policy

1.5. Mirroring

1.6. Note for Translators

1.7. Copyright and Distribution

\2. A fork() Primer

2.1. "Seek ye the Gorge of Eternal Peril"

2.2. "I'm mentally prepared! Give me The Button!"

2.3. Summary

\3. Signals

3.1. Catching Signals for Fun and Profit!

3.2. The Handler is not Omnipotent

3.3. What about signal()

3.4. Some signals to make you popular

3.5. What I have Glossed Over

\4. Pipes

4.1. "These pipes are clean!"

4.2. fork() and pipe()—you have the power!

4.3. The search for Pipe as we know it

4.4. Summary

\5. FIFOs

5.1. A New FIFO is Born

5.2. Producers and Consumers

5.3. O_NDELAY! I'm UNSTOPPABLE!

5.4. Concluding Notes

\6. File Locking

6.1. Setting a lock

6.2. Clearing a lock

6.3. A demo program

6.4. Summary

\7. Message Queues

7.1. Where's my queue?

7.2. "Are you the Key Master?"

7.3. Sending to the queue

7.4. Receiving from the queue

7.5. Destroying a message queue

7.6. Sample programs, anyone?

7.7. Summary

\8. Semaphores

8.1. Grabbing some semaphores

8.2. Controlling your semaphores with semctl()

8.3. semop(): Atomic power!

8.4. Destroying a semaphore

8.5. Sample programs

8.6. Summary

\9. Shared Memory Segments

9.1. Creating the segment and connecting

9.2. Attach me—getting a pointer to the segment

9.3. Reading and Writing

9.4. Detaching from and deleting segments

9.5. Concurrency

9.6. Sample code

\10. Memory Mapped Files

10.1. Mapmaker

10.2. Unmapping the file

10.3. Concurrency, again?!

10.4. A simple sample

10.5. Summary

\11. Unix Sockets

11.1. Overview

11.2. What to do to be a Server

11.3. What to do to be a client

11.4. socketpair()—quick full-duplex pipes

\12. More IPC Resources

12.1. Books

12.2. Other online documentation

12.3. Linux man pages