You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Double barriers enable clients to synchronize the beginning and the end of a computation. When enough processes have joined the barrier, processes start their computation and leave the barrier once they have finished. This recipe shows how to use a ZooKeeper node as a barrier.
The pseudo code in this recipe represents the barrier node as b. Every client process p registers with the barrier node on entry and unregisters when it is ready to leave. A node registers with the barrier node via the Enter procedure below, it waits until x client process register before proceeding with the computation. (The x here is up to you to determine for your system.)
Enter
Create a name n = b+"/"+p
Set watch: exists(b + "/ready", true)
Create child: create( n, EPHEMERAL)
L = getChildren(b, false)
if fewer children in L than x, wait for watch event
else create(b + "/ready", REGULAR)
Leave
L = getChildren(b, false)
if no children, exit
if p is only process node in L, delete(n) and exit
if p is the lowest process node in L, wait on highest process node in P
else delete(n) if still exists and wait on lowest process node in L
goto 1
Like #42, it seems like this should go in the same gem as the locker.
The text was updated successfully, but these errors were encountered:
From http://zookeeper.apache.org/doc/trunk/recipes.html
Like #42, it seems like this should go in the same gem as the locker.
The text was updated successfully, but these errors were encountered: