Shared memory: what's the difference between the key and the id?

前端 未结 2 574
生来不讨喜
生来不讨喜 2021-01-13 16:14

When invoking ipcs -a, what is the difference between the key column and the id column?

Here is an example output for ip

2条回答
  •  温柔的废话
    2021-01-13 17:11

    See the documentation for shmget(2). The key is IPC_PRIVATE or 0 on creation. The shmid is the value returned for that specific shm segment so that other processes or system calls can reference the segment.

提交回复
热议问题