当前位置: 首页 > news >正文

网站建设需要购买服务器么网站建设用什么系统

网站建设需要购买服务器么,网站建设用什么系统,wordpress 黑镜主题,遵义做网站哪家好哪家好进程间通信 前提引入#xff1a; 我们之前接触过管道 | 将前一个命令的输出结果作为后一个命令的输入 如#xff1a;ps | grep “sleep” 其实就是将 ps 的结果写入到一个区域#xff0c;在从这个区域读出目标数据 有名管道 mkfifo 创建管道文件 : mkfifo fifo -创…进程间通信 前提引入 我们之前接触过管道 | 将前一个命令的输出结果作为后一个命令的输入 如ps | grep “sleep” 其实就是将 ps 的结果写入到一个区域在从这个区域读出目标数据 有名管道 mkfifo 创建管道文件 : mkfifo fifo -创建一个名为fifo的管道文件 如图管道文件的大小为0是因为他是在内存中写入读取并不会占用磁盘空间因此速度会快很多。 管道文件只有只读只写两种权限。 1.执行写入文件a.c #include unistd.h #include stdio.h #include fcntl.h #include signal.h #include stdlib.h #include string.hint main() {int fd open(fifo,O_WRONLY);if(fd -1){printf(none file\n);exit(1);}char buff[128];while(1){printf(intput:);fflush(stdout);fgets(buff,128,stdin);buff[strlen(buff)-1]0;if(strcmp(buff,end) 0){break;}write(fd,buff,strlen(buff));}close(fd);exit(0); } 2.执行读取文件 b.c #include unistd.h #include stdio.h #include fcntl.h #include signal.h #include stdlib.h #include string.hint main() {int fd open(fifo,O_RDONLY);if(fd -1){printf(none file\n);exit(1);}printf(fd %d\n,fd);while(1){char buff[128]{0};int n read(fd,buff,127);if(n ! 0){printf(%s\n,buff);}else{break;}}close(fd);exit(0); } 管道文件必须同时被只读只写打开否则无法成功打开 1.只写无法打开 2.只读无法打开 3.正确方式只读只写同时打开 写端关闭读端read返回0退出循环 读端关闭写端write时会收到异常信号(SIGPIPE),进而结束该进程 验证是否产生该信号 写端a.c 测试代码 #include unistd.h #include stdio.h #include fcntl.h #include signal.h #include stdlib.h #include string.h #include signal.hvoid fun_sig(int sig) {printf(%d,%d\n,sig,13 sig); } int main() {signal(SIGPIPE,fun_sig);int fd open(fifo,O_WRONLY);if(fd -1){printf(none file\n);exit(1);}char buff[128];while(1){printf(intput:);fflush(stdout);fgets(buff,128,stdin);buff[strlen(buff)-1]0;if(strcmp(buff,end) 0){break;}write(fd,buff,strlen(buff));}close(fd);exit(0); } 如图 有名管道能在任意两个进程间使用 无名管道 利用函数 int pipe(int fds[2]); int pipe(int fds[2]); pipe()成功返回 0失败返回-1 fds[0]是管道读端的描述符 fds[1]是管道写端的描述符 测试代码 #include unistd.h #include stdio.h #include fcntl.h #include signal.h #include stdlib.h #include string.h #include signal.hint main() {int fd[2];if(pipe(fd) -1) exit(1);int pid fork();if(pid 0){close(fd[0]);printf(child input\n);write(fd[1],hello,6);}else{char buff[128]{0};close(fd[1]);printf(parent read:);read(fd[0],buff,127);printf(%s\n,buff);}exit(0); } 如图 无名管道主要应用于父子进程间的通信。 管道的特点 ◼ 无论有名还是无名写入管道的数据都在内存中 ◼ 管道是一种半双工通信方式通信方式有单工、半双工、全双工 ◼ 有名和无名管道的区别有名可以在任意进程间使用而无名主要在父子进程间
http://wiki.neutronadmin.com/news/311365/

相关文章:

  • 广州做进口商品的网站什么叫网络架构
  • 国内做网站比较好的公司常州云计算网站建设
  • 做网站时怎么让边框细一点婚姻网站建设注意事项
  • 网站流量多少淘宝采集wordpress
  • 美工做网站怎么收费做一个网站需要怎么做
  • 官网指的是什么网站网站建设需要个体营业执照
  • crm网站推荐wordpress前台后台都空白
  • 呼和浩特整站优化网站页尾版权
  • 禹城网站建设公司网站制作需要多少钱k
  • 网站建设怎么把代码放入网站上网络营销有哪些功能
  • 默认网站停止wordpress公式编辑器
  • 凡科的模板做网站游戏大全免费版入口
  • 房地产项目网站建设方案网站建设先进材料
  • 网站开发和平台开发成都网站建设推来客熊掌号
  • 怎么做网站地图导航山东郓城住房和城乡建设厅网站
  • 网站哪里备案wordpress百度分享
  • 找公司做网站需要注意网络怎么设计
  • 站长工具ip地址查询域名集团网站建设的好处
  • 如何做二维码跳转到网站婚庆公司排名
  • 如何给网站弄ftp大学 两学一做专题网站
  • 息烽做网站公司有哪些简单的网站更新 关键词优化 关键词互联
  • 淘客网站模板跨境电商app下载
  • 做网站设计工作的报告网站设计素材包
  • 网站开发语言入门竞价推广开户多少钱
  • 网站站点风格安全教育平台登录入口
  • 西安网站开发公司哪家强自学网官网
  • 便宜做网站潜江资讯网58同城
  • 专门 做鞋子团购的网站有哪些wordpress外链转内链
  • 文山知名网站建设公司网络推广怎么优化
  • 门户网站区别怎样做理财投资网站