next up previous index
Next: Appendix A: Making System Up: Chapter 6: Interprocess Communication Previous: Pseudo-Terminals (PTYs)   Index

Deadlock

With interprocess communication comes the problem of deadlock. If a situation arises where two or more processes are all waiting for an signal from one of the other waiting processes, the processes are said to be deadlocked.

The best way to explain deadlock is to give an example. Suppose that two processes are connected with two pipes so that they can communicate bidirectionally. Also suppose that each of the pipes are full, and that when each process writes into one of the pipes they are blocked. Both processes are blocked waiting for the other to unblock them.

There is no way for the operating system to detect every conceivable deadlock condition without expending large amounts of CPU time. Thus, the only way to recover from a deadlock is to kill the processes in question. Responsibility for preventing deadlock situations is placed on the programmer. Fortunately, situations where deadlock can occur are infrequent; however, you should keep an eye out for them and try to work around them when they do occur.


next up previous index
Next: Appendix A: Making System Up: Chapter 6: Interprocess Communication Previous: Pseudo-Terminals (PTYs)   Index
Feedback