Advertisement

linux系统编程学习笔记第六节:进程通信方式中IP...机制(共享内存)

阅读量:

“这一路走来的诋毁与误解,若以今日之眼光审视,或许如同一记耳光;而明日回望,却可能化作手中的一把糖果。”
The defamation and misinterpretations encountered during the journey may appear as a slap on the face today, but in the future, they could transform into a handful of candy in one's life.

进程通信方式之IPC通信机制2(共享内存)

共享内存

相关接口函数

int shmget(key_t key, size_t size, int shmflg);

void *shmat(int shmid, const void *shmaddr, int shmflg);

int shmdt(const void *shmaddr);

int shmctl(int shmid, int cmd, struct shmid_ds *buf);


共享内存

共享内存的概念较为基础,各个进程原本拥有独立的虚拟内存空间,彼此间无法直接访问。然而,通过特定手段,可以将同一块物理内存多次映射至不同进程的虚拟地址空间中,从而实现多个进程对同一内存区域的共享访问。

全部评论 (0)

还没有任何评论哟~