0

I have two process P1 and P2. Second process P2 is running infinity. When first process is going to run then second process should going to waiting state until first is not completed.

Can you provide the easiest way to handle this situation.

Thanks !!

4

1 回答 1

0

你的问题不是很清楚。但无论如何,这里是选项:

 kill -s SIGSTOP $P2    #P2 - process id of P2

这将暂停您可以在 P1 运行时使用的 P2,然后继续:

 kill -s SIGCONT $P2

或者wait在进程 P2 中使用:

wait $P1

这将等到 P1 结束。

于 2012-09-26T19:22:18.107 回答