This document provides a tutorial on using ZooKeeper to implement basic distributed synchronization primitives like barriers and producer-consumer queues. It includes code examples for Barrier and Queue classes that extend a base SyncPrimitive class. The Barrier class allows processes to synchronize barrier entry and exit. The Queue class implements a distributed queue where producers can add elements and consumers can remove the oldest element. Both use ZooKeeper to coordinate access through ephemeral nodes and watches.