随笔分类 -  linux进程间通信

摘要:#include <stdio.h> #include <sys/shm.h> #include <unistd.h> #include <string.h> int main() { key_t key; // 用于打开指定的共享内存 int shm_id; // 共享内存id char *p; 阅读全文
posted @ 2021-12-28 09:05 roverqqq 阅读(33) 评论(0) 推荐(0) 编辑
摘要:#include <stdio.h> #include <unistd.h> #include <string.h> #include <errno.h> int main() { int fd[2]; char buf[1024]; memset(buf,'\0',sizeof(buf)); pi 阅读全文
posted @ 2021-12-28 09:04 roverqqq 阅读(89) 评论(0) 推荐(0) 编辑
摘要:共享内存-进程间通信 基本流程 创建/打开 一块共享内存空间 将共享内存映射到用户进程空间 操作 解除映射 销毁共享内存 创建共享内存源码 #include <stdio.h> #include <sys/shm.h> #include <unistd.h> #include <string.h> 阅读全文
posted @ 2021-11-05 14:59 roverqqq 阅读(65) 评论(0) 推荐(0) 编辑
摘要:无名管道源码 #include <stdio.h> #include <unistd.h> #include <string.h> #include <errno.h> int main() { int fd[2]; char buf[1024]; memset(buf,'\0',sizeof(bu 阅读全文
posted @ 2021-11-05 14:11 roverqqq 阅读(54) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示