If you are both sending to and receiving from a process, you must realize that there's only an 8K buffer in each direction. So if you are writing to the other process, and send more than 8K, your process will stop and wait for the other process to start reading. But suppose it has done the same thing, trying to send you more than 8K from a previous response! Now you have two processes in deadlock.
As to how to solve it, the quickest general answer is "careful programming".
If that doesn't make sense to you, then don't attempt it.
-- Randal L. Schwartz, Perl hacker | [reply] |
Probably the simplest example of a deadlock is when a
process (A) is waiting on data from process B before it
can continue.
At the same time process B is waiting on data from process
A before it can continue. Both processes are waiting
on
each other, and neither will ever move forward. Deadlocks
generally occur in
much more complicated scenarios. Deadlocks occur when
multiple processes are
waiting for resources (IO ports, data from other
processes, etc...)
and already have
some resources allocated to them that they will not
free up
until they get the new resources they need.
Deadlocks
aren't
very common at an application level, but OS programmers
must be very careful
to avoid them. | [reply] |