---
title: "进程间通信：Shared Memory"
author: "Aoogoo"
date: "2010-01-18T13:58:01Z"
tags: []
categories: ["操作系统"]
slug: "shared-memory"
draft: false
lastmod: "2010-01-18T13:58:01Z"
id: 573384
url: "https://aoogoo.iteye.com/blog/573384"
---

调用shmget()一个进程可以创建一个共享内存。
共享内存的创建者通过shmctl()将控制权赋给其它用户，或者收回控制权。
通过shmat()可以将共享内存和其他进程绑定起来。
如果解除绑定应该调用shmdt()。
一旦和共享内存绑定起来，继承就可以对其进行读写。
每个共享内存都和一个唯一的ID关联。