Ch4LinuxSystemProgrammingndash;Processamp;IPC培训课件.pptVIP

  • 4
  • 0
  • 约2.28万字
  • 约 137页
  • 2019-05-29 发布于湖北
  • 举报

Ch4LinuxSystemProgrammingndash;Processamp;IPC培训课件.ppt

FIFO: named pipe 管道和命名管道 相同点 不同点 文件系统中 同步:一个重要的考虑 mkfifo(1), mkfifo(3), mknod(1), mknod(2) 创建FIFO mkfifo: make a FIFO special file (a named pipe) #include sys/types.h #include sys/stat.h int mkfifo(const char *pathname, mode_t mode); (Returned value: 0 if success, -1 if failure) Examples fifo1.c (Ch12 in BLP) list a fifo (ls –lF) 用open打开一个FIFO Review: “open” system call int open(const char *pathname, int flags); “flags” parameter 必须指定的互斥模式: O_RDONLY, O_WRONLY, O_RDWR O_NONBLOCK consideration: 读端/写端 同步 FIFO的同步和读写 打开FIFO时的同步 一般情况下(没有说明O_NONBLOCK),只读打开要阻塞到某个其它进程为写打开此FIFO;类似的,为写打开一个FIFO要阻塞到某个其它

文档评论(0)

1亿VIP精品文档

相关文档