问题:
numbers read from the pipe is Hello (3分)
答案:
分析:fork()调用后产生父子 两个进程,当子进程先执行时,sleep2秒钟,所以一定是父进程先执行,父进程关闭读口文件描述符pipe_fd[0],向管道中写入5个字符“Hello”,关闭写文件描述符pipe_fd[1],休眠3秒钟,子进程运行,关闭写文件描述符pipe_fd[1],从管道中读出数据,输出5 numbers read from the pipe is Hello,关闭读文件描述符。(3分)