no threads

Maximilian Ott max@ccrl.nj.nec.com
Wed, 29 Oct 1997 13:37:14 -0500 (EST)



On Wed, 29 Oct 1997, Sai-Lai Lo wrote:
>
>       +------------+                           +-----------+
>       |Process 1   |                           | Process 2 |
>       | +-----+	   |       (1)                 |  +-----+  |
>       | | A  -+----+---------------------------+->| B   |  |
>       | |     |    |         (4)               |  |     |  |
>       | +-----+ <---------------------------------+-----+  |
>       |            |                           |  ^  |     |
>       |            |        (3)                |  | |      |
>       | +-----+-----------------------------------| |      |
>       | | C   |<---+---------------------------+----+      |
>       | +-----+    |	     (2)	       |	   |
>       +------------+                           +-----------+
>  
>   Object A calls Object B. Object B then do a nested call to Object C
>   before it replies to A. If A and C are in the same process, a single
>   threaded ORB would be deadlocked forever because process 1 would not
>   handle the incoming call to C until it receives a reply from B.
>    

Your example actually works quite nicely if you execute the call to C in
P1 on top of the execution stack of the waiting A (assuming you are
listening for other requests at the same time).

What does cause you problems is the following scenario. 

	P1	P2	P3	P4  processes
	--------------------------

	A -1->	B

	C     <-2-	D   ... B and D are unrelated

	C     	       -3->	E

	  <-4-	B  ... blocks until reply to (3) returns

If you execute on top of waiting objects you get into troubles if each
process has an independent thread.

The above scenario will work if requests to P1 after (1) will only be
related to processing the reply to (1).

Therefore, I can't understand how one can program a single threaded ORB
with a synchronous model. The above scenario doesn't deadlock, but I think
it will be possible (I speak from experience :)
 
Do I make sense ?

Thanks,

-max