Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有两个程序 X 和 Y 要求从stdin. X 和 Y 使用fork()后跟execve()来自 A 的三分之一运行。
stdin
fork()
execve()
发生的事情是首先安排 X。当 X 到达 scanf 语句时,Y 被调度并且 X 永远不会得到输入。我该如何照顾它?
已经调解了和A的输入。可以创建一个往返于每个子进程的管道。它可以从管道读取提示,将提示写入标准输出,从标准输入读取响应,并将响应写入子进程的管道。XYA
A
X
Y