aboutsummaryrefslogtreecommitdiff
path: root/src/testbed
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-09-09 15:44:38 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-09-09 15:44:38 +0000
commitec2744982e61b8057d78734a4f68098ff4fb587f (patch)
tree91052e7b914d850e5b99f558abc38882715b27c2 /src/testbed
parent341039bee18ab92eddb4835b1512d24b33d35fdf (diff)
downloadgnunet-ec2744982e61b8057d78734a4f68098ff4fb587f.tar.gz
gnunet-ec2744982e61b8057d78734a4f68098ff4fb587f.zip
- barriers doc
Diffstat (limited to 'src/testbed')
-rw-r--r--src/testbed/barriers.README.org65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/testbed/barriers.README.org b/src/testbed/barriers.README.org
new file mode 100644
index 000000000..4547009e2
--- /dev/null
+++ b/src/testbed/barriers.README.org
@@ -0,0 +1,65 @@
1* Description
2The barriers component of testbed facilitates coordination among the peers run
3by the testbed and the experiment driver. The concept is similar to the barrier
4synchronisation mechanism found in parallel programming or multithreading
5paradigms - a peer waits at a barrier upon reaching it until it is crossed i.e,
6reached by a predefined number of peers. This predefined number peers required
7to cross a barrier is also called quorum.
8
9Coordination among the peers and the experiment driver is achieved through the
10barriers service and its respective barriers API. The barriers API provides the
11following functions:
12
131) barrier_init(): function to initialse a barrier in the experiment
142) barrier_cancel(): function to cancel a barrier which has been initialised
15 before
163) barrier_wait(): function to signal barrier service that the caller has reached
17 a barrier and is waiting for it to be crossed
184) barrier_wait_cancel(): function to stop waiting for a barrier to be crossed
19
20Among the above functions, the first two, namely barrier_init() and
21barrier_cacel() are used by experiment drivers. All barriers should be
22initialised by the experiment driver by calling barrier_init(). This function
23takes a name to identify the barrier and a notification callback for notifying
24the experiment driver when the barrier is crossed. The function
25barrier_cancel() cancels an initialised barrier and frees the resources
26allocated for it. This function can be called upon a initialised barrier before
27it is crossed.
28
29The remaining two functions barrier_wait() and barrier_wait_cancel() are used in
30the peer's processes. barrier_wait() connects to the local barrier service and
31registers that the caller has reached the barrier and is waiting for the barrier
32to be crossed. Note that this function can only be used by peers which are
33started by testbed as this function tries to access the local barrier service
34which is part of the testbed controller service. Calling barrier_wait() on an
35uninitialised barrier (or not-yet-initialised) barrier results in failure.
36barrier_wait_cancel() cancels the notification registered by barrier_wait().
37
38
39* Implementation
40Since barriers involve coordination between experiment driver and peers the
41barrier service is split into two components. The first component responds to
42the barrier API used by the experiment driver (functions barrier_init() and
43barrier_cancel()) and the second component to the barrier API used by peers
44(functions barrier_wait() and barrier_wait_cancel())
45
46Calling barrier_init() sends a BARRIER_INIT message to the master controller.
47The master controller then registers a barrier and calls barrier_init() for each
48its subcontrollers. In this way barrier initialisation is propagated to the
49controller hierarchy. While propagating initialisation, any errors at a
50subcontroller such as timeout during further propagation are reported up the
51hierarchy back to the experiment driver.
52
53Similar to barrier_init(), barrier_cancel() propagates BARRIER_CANCEL message
54which causes controllers to remove an initialised barrier.
55
56The second component, according to gnunet architecture, is actually an another
57service but runs in the same binary `gnunet-service-testbed'; the reason is
58that it requires access to barrier data created by the first component. This
59component responds to BARRIER_WAIT messages from local peers when they call
60barrier_wait(). Upon receiving BARRIER_WAIT message, the service checks if the
61requested barrier has been initialised before and it was not initialised the
62an error status is sent through BARRIER_STATUS message to the local peer and the
63connection from the peer is terminated. If the barrier is initialised before,
64the barrier's counter for reached peers is incremented and a notification is
65registered to notify this peer when the barrier is reached.