4 <title>Implementation of leader follower model for global resources
</title>
14 <h1>Leader follower model for global resources
</h1>
17 Global resources in TAO mean one ORB and using the reactive strategy
18 one Reactor. TAO uses the ACE Select Reactor for this purpose.
19 One main problem with multithreading and only one Reactor is that
20 only one thread can wait in handle_events at a time.
21 Handle_events is called, when a thread expects input, meaning
22 it is blocking to wait for it.
25 One solution to this problem is to use a leader-follower model,
26 which partitions the set of threads wanting to wait for input
27 into one leader and followers. Every thread is eligible to become
28 a leader. A thread wanting to wait while nobody else is waiting
29 becomes the leader. If the leader gets its input, which is in
30 this case its response, it will select a new leader out of the
31 set of followers. The followers wait on a condition variable they
32 own and register it with the ORB core. The ORB core is thereby
33 responsible for making this access thread-save by providing
34 a lock for the list of followers with some flags, like
37 <h2>Implementation
</h2>
38 The above mentioned condition variables are owned by the
39 connection handlers, because responses are expected per connection,
40 not necessarily, thinking about other resource models, per thread.
42 The involved classes are TAO_ORB_Core, TAO_Client_Connection_Handler
43 and TAO_ORB. In the TAO_ORB_Core class the list of followers, a lock,
44 a leader reference counter and a leader thread ID were added.
45 The handle_input and send_request methods on the TAO_Client_Connection_Handler
46 contain
95% of the code used for implementing the leader-follower
47 model. Care has to be taken, that the connection handlers are
48 suspended and resumed, properly. A special concern is that
49 no deadlocking occurs.
52 For more details and questions,
55 <address><a href=
"mailto:mk1@cs.wustl.edu">Michael Kircher
</a></address>
57 <address><a href=
"mailto:irfan1@cs.wustl.edu">Irfan Pyarali
</a></address>